تغییر در اکشن یک بازی با hex

ferreroir

New Member
سلام دوستان

من یک بازی دارم که مربوط به شرط بندی شیر یا خط هست،

پول میگذریم و سکه انداخته می‌شه اگه درست حدس زده باشیم پول بالا میره اگر نه کم می‌شه از پول.

حالا من می‌خوام کاری کنم که فقط یاا شیر بیاد یاا خط و همیشه برنده باشم.

من کد بازی اینجا گذشتم همچنین تنها SWF این بازی رو دارم و امکان تبدیلش به FLA نیست و تنها راه برای تغییر VALUE ها استفاده از HEX EDITOR هست ،

لطفا اگر کسی‌ میتون تغییری تو VALUE ایجاد کنه که فقط شیر یا خط بیاد بگه . یا مثلا یه متغیر CONST VAR اول کار تعریف شه که فقط شیر بیاد . اگر Hex این تغییری که میدید هم میدونید حتما بگید که لازمه.


دوستان کمترین تغییر مهم چون باید به صورت هکس گنجانده شه این تغییر و کار سختیه

ممنونم









PHP:
package MyLife.FlipRollGame
{
    import MyLife.*;
    import MyLife.Events.*;
    import MyLife.Media.*;
    import MyLife.UI.*;
    import MyLife.Utils.*;
    import flash.display.*;
    import flash.events.*;
    import flash.media.*;
    import flash.system.*;
    import flash.text.*;
    import flash.utils.*;

    public class FlipRollDialog extends ContentDialogTemplate
    {
        private var _tossSoundChannel:SoundChannel;
        private var onexstate1:MovieClip = null;
        private var onexstate2:MovieClip = null;
        private var onexstate3:MovieClip = null;
        private var sixxstate2:MovieClip = null;
        private var sixxstate3:MovieClip = null;
        private var sixxstate1:MovieClip = null;
        public var tossResult:String = null;
        private var tails:SimpleButton = null;
        private var _goalContent:Sprite;
        private var hardluck:MovieClip = null;
        private var bet2Active:MovieClip = null;
        private var _tossSound:Sound;
        private var winner:MovieClip = null;
        private var anmTimer:Timer;
        private var fivexstate2:MovieClip = null;
        private var howToPlayBtn:SimpleButton = null;
        private var bet1Inactive:SimpleButton = null;
        public var coinToss:String;
        private var bet3Inactive:SimpleButton = null;
        private var fivexstate3:MovieClip = null;
        private var sparkleanimation:MovieClip = null;
        private var fourxstate1:MovieClip = null;
        private var bet2Inactive:SimpleButton = null;
        private var currentBet:int;
        private var fourxstate2:MovieClip = null;
        private var fourxstate3:MovieClip = null;
        private var headstatic:MovieClip = null;
        private var fivexstate1:MovieClip = null;
        private var coinText:TextField = null;
        private var myscore:MovieClip = null;
        private var bet3Active:MovieClip = null;
        private var potvalue:TextField = null;
        private var twoxstate1:MovieClip = null;
        private var twoxstate2:MovieClip = null;
        private var twoxstate3:MovieClip = null;
        private var sparkleBoard:MovieClip = null;
        private var coinAnimationStopped:Boolean = false;
        public var gameTimer:Timer;
        private var payTableBtn:SimpleButton = null;
        private var tossHistoryInstHead:Array;
        private var _tossCall:String;
        private var diceAnimationStopped:Boolean = false;
        private var _flipRollConfig:FlipRollConfig;
        private var winCount:int = 0;
        private var _frDialog:Sprite = null;
        private var diceAnimation:MovieClip = null;
        private var soundManager:SoundManager;
        private var playerCoins:int = 0;
        private var heads:SimpleButton = null;
        public var diceResult:int;
        public var currentCoin:int;
        private var playagain:TextField = null;
        private var resultShowTimer:Timer;
        private var indexStart:int = -1;
        private var tailstatic:MovieClip = null;
        private var indexEnd:int = -1;
        private var myscoreAnimation:MovieClip = null;
        private var tossHistoryInstTail:Array;
        private var _gameSelector:Sprite = null;
        private var threexstate1:MovieClip = null;
        private var threexstate2:MovieClip = null;
        private var threexstate3:MovieClip = null;
        private var bet1Active:MovieClip = null;
        private var flipRollCloseBtn:SimpleButton = null;
        private var coinAnimation:MovieClip = null;
        private var tossHistory:Array;
        public static var FlipRollDialogContent:Class = null;
        private static var swfFileName:String = MyLifeConfiguration.getInstance().variables["global"]["asset_path"] + "dialogs/Casino/FlipRollDialog.swf" + MyLifeConfiguration.getInstance().assetVersionParam;
        private static var _betValue1:int = 30;
        private static var _betValue2:int = 300;
        private static var TossSound:Class;
        private static var _betValue3:int = 3000;
        private static var _soundManager:FlipRollSoundManager;

        public function FlipRollDialog(param1:FlipRollConfig)
        {
            var _loc_2:DialogParams = null;
            tossHistory = new Array();
            currentBet = _betValue1;
            tossHistoryInstTail = new Array();
            tossHistoryInstHead = new Array();
            resultShowTimer = new Timer(500);
            _flipRollConfig = param1;
            if (!FlipRollDialogContent)
            {
                loadFlipRollDialogContent();
            }
            else
            {
                UIDispatcher.instance.dispatchEvent(new UIEvent(UIEvent.FLIPROLL_DIALOG_READY));
                _loc_2 = new DialogParams(" ", " ", null, null);
                _frDialog = new FlipRollDialogContent();
                _goalContent = new Sprite();
                _goalContent.addChild(_frDialog);
                _loc_2.displayObject = _goalContent;
                _loc_2.displayObject.visible = true;
                loadSWFComponents();
                addEventLesteners();
                loadDefaultGameState();
                super(_loc_2);
                removeChild(_titleBar);
            }
            return;
        }// end function

        private function loadSWFComponents() : void
        {
            var _loc_1:String = null;
            bet1Inactive = _frDialog.getChildByName("bet1Inactive") as SimpleButton;
            bet2Inactive = _frDialog.getChildByName("bet2Inactive") as SimpleButton;
            bet3Inactive = _frDialog.getChildByName("bet3Inactive") as SimpleButton;
            bet1Active = _frDialog.getChildByName("bet1Active") as MovieClip;
            bet2Active = _frDialog.getChildByName("bet2Active") as MovieClip;
            bet3Active = _frDialog.getChildByName("bet3Active") as MovieClip;
            heads = _frDialog.getChildByName("heads") as SimpleButton;
            tails = _frDialog.getChildByName("tails") as SimpleButton;
            headstatic = _frDialog.getChildByName("headstatic") as MovieClip;
            tailstatic = _frDialog.getChildByName("tailstatic") as MovieClip;
            playagain = _frDialog.getChildByName("playagain") as TextField;
            onexstate1 = _frDialog.getChildByName("onexstate1") as MovieClip;
            twoxstate1 = _frDialog.getChildByName("twoxstate1") as MovieClip;
            threexstate1 = _frDialog.getChildByName("threexstate1") as MovieClip;
            fourxstate1 = _frDialog.getChildByName("fourxstate1") as MovieClip;
            fivexstate1 = _frDialog.getChildByName("fivexstate1") as MovieClip;
            sixxstate1 = _frDialog.getChildByName("sixxstate1") as MovieClip;
            onexstate2 = _frDialog.getChildByName("onexstate2") as MovieClip;
            twoxstate2 = _frDialog.getChildByName("twoxstate2") as MovieClip;
            threexstate2 = _frDialog.getChildByName("threexstate2") as MovieClip;
            fourxstate2 = _frDialog.getChildByName("fourxstate2") as MovieClip;
            fivexstate2 = _frDialog.getChildByName("fivexstate2") as MovieClip;
            sixxstate2 = _frDialog.getChildByName("sixxstate2") as MovieClip;
            onexstate3 = _frDialog.getChildByName("onexstate3") as MovieClip;
            twoxstate3 = _frDialog.getChildByName("twoxstate3") as MovieClip;
            threexstate3 = _frDialog.getChildByName("threexstate3") as MovieClip;
            fourxstate3 = _frDialog.getChildByName("fourxstate3") as MovieClip;
            fivexstate3 = _frDialog.getChildByName("fivexstate3") as MovieClip;
            sixxstate3 = _frDialog.getChildByName("sixxstate3") as MovieClip;
            winner = _frDialog.getChildByName("winner") as MovieClip;
            hardluck = _frDialog.getChildByName("hardluck") as MovieClip;
            potvalue = _frDialog.getChildByName("potvalue") as TextField;
            coinText = _frDialog.getChildByName("coins") as TextField;
            myscore = _frDialog.getChildByName("myscore") as MovieClip;
            myscoreAnimation = myscore.getChildByName("myscoreAnimation") as MovieClip;
            payTableBtn = _frDialog.getChildByName("paytableBtn") as SimpleButton;
            howToPlayBtn = _frDialog.getChildByName("howtoplayBtn") as SimpleButton;
            flipRollCloseBtn = _frDialog.getChildByName("flipRollCloseBtn") as SimpleButton;
            potvalue = _frDialog.getChildByName("potvalue") as TextField;
            coinAnimation = _frDialog.getChildByName("coinAnimation") as MovieClip;
            diceAnimation = _frDialog.getChildByName("diceAnimation") as MovieClip;
            sparkleanimation = _frDialog.getChildByName("sparkleanimation") as MovieClip;
            sparkleBoard = _frDialog.getChildByName("sparkleBoard") as MovieClip;
            soundManager = new SoundManager(MyLifeSoundController.isMuted);
            var _loc_2:int = 0;
            while (_loc_2 < 5)
            {
                
                _loc_1 = ((_loc_2 + 1)).toString();
                tossHistoryInstTail[_loc_2] = _frDialog.getChildByName("fliphistorytail" + _loc_1) as MovieClip;
                _frDialog.removeChild(tossHistoryInstTail[_loc_2]);
                tossHistoryInstHead[_loc_2] = _frDialog.getChildByName("fliphistoryhead" + _loc_1) as MovieClip;
                _frDialog.removeChild(tossHistoryInstHead[_loc_2]);
                _loc_2++;
            }
            return;
        }// end function

        public function isFacebook() : Boolean
        {
            return MyLifeConfiguration.checkPlatform(MyLifeConfiguration.PLATFORM_FACEBOOK);
        }// end function

        private function tossCall(param1:String) : void
        {
            resetResultDisplay();
            _tossCall = param1;
            diceAnimation.gotoAndStop(1);
            coinAnimation.gotoAndStop(1);
            if (playerCoins < currentBet * 6)
            {
                showNoCoinDialog();
                return;
            }
            FlipRollManager.getInstance().playFlipRollGame(currentBet);
            diceAnimationStopped = false;
            coinAnimationStopped = false;
            diceAnimation.gotoAndPlay(1);
            _soundManager.play("diceRollStart");
            diceAnimation.addEventListener(Event.ENTER_FRAME, diceAnimationCheckFrame);
            if (param1 == "head")
            {
                headstatic.visible = true;
            }
            else
            {
                tailstatic.visible = true;
            }
            heads.mouseEnabled = false;
            tails.mouseEnabled = false;
            bet1Inactive.mouseEnabled = false;
            bet2Inactive.mouseEnabled = false;
            bet3Inactive.mouseEnabled = false;
            return;
        }// end function

        private function showHowToPlayDialog(event:Event) : void
        {
            FlipRollManager.getInstance().showHowToPlayDialog();
            return;
        }// end function

        private function updateTossHistoryDisplay(param1:String) : void
        {
            if (param1 == "tail")
            {
                tossHistory.push(0);
            }
            else
            {
                tossHistory.push(1);
            }
            var _loc_5:* = indexEnd + 1;
            indexEnd = _loc_5;
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            _loc_3 = indexEnd;
            if (tossHistory.length > 5)
            {
                var _loc_5:* = indexStart + 1;
                indexStart = _loc_5;
            }
            while (_loc_3 > indexStart)
            {
                
                if (tossHistory[_loc_3] != null)
                {
                    if (tossHistory[_loc_3] == 0)
                    {
                        _frDialog.addChild(tossHistoryInstTail[_loc_2]);
                    }
                    else
                    {
                        _frDialog.addChild(tossHistoryInstHead[_loc_2]);
                    }
                }
                _loc_2++;
                _loc_3 = _loc_3 - 1;
            }
            return;
        }// end function

        override protected function dialogButtonClicked(event:MouseEvent) : void
        {
            cleanUp();
            UIDispatcher.instance.dispatchEvent(new UIEvent(UIEvent.SHOW_CASINO_GAME_SELECTOR));
            return;
        }// end function

        private function showDiceAnmResult(param1:int) : void
        {
            var _loc_2:* = diceAnimation.dicenumber1;
            diceAnimation.gotoAndStop(42 + (param1 - 1) * 8);
            anmTimer.start();
            anmTimer.addEventListener(TimerEvent.TIMER, moveDiceToFinalPositionAfterResult);
            var _loc_3:* = 0 + param1 * currentBet;
            currentCoin = 1;
            gameTimer.addEventListener(TimerEvent.TIMER, glowCoin);
            gameTimer.start();
            potvalue.text = _loc_3.toString();
            _frDialog.addChild(potvalue);
            return;
        }// end function

        private function addEventLesteners() : void
        {
            bet1Inactive.addEventListener(MouseEvent.CLICK, function () : void
            {
                selectBet(_betValue1);
                return;
            }// end function
            );
            bet2Inactive.addEventListener(MouseEvent.CLICK, function () : void
            {
                selectBet(_betValue2);
                return;
            }// end function
            );
            bet3Inactive.addEventListener(MouseEvent.CLICK, function () : void
            {
                selectBet(_betValue3);
                return;
            }// end function
            );
            bet1Active.addEventListener(MouseEvent.CLICK, function () : void
            {
                selectBet(_betValue1);
                return;
            }// end function
            );
            bet2Active.addEventListener(MouseEvent.CLICK, function () : void
            {
                selectBet(_betValue2);
                return;
            }// end function
            );
            bet3Active.addEventListener(MouseEvent.CLICK, function () : void
            {
                selectBet(_betValue3);
                return;
            }// end function
            );
            heads.addEventListener(MouseEvent.CLICK, function () : void
            {
                tossCall("head");
                return;
            }// end function
            );
            tails.addEventListener(MouseEvent.CLICK, function () : void
            {
                tossCall("tail");
                return;
            }// end function
            );
            howToPlayBtn.addEventListener(MouseEvent.CLICK, showHowToPlayDialog);
            payTableBtn.addEventListener(MouseEvent.CLICK, payTableDialog);
            flipRollCloseBtn.addEventListener(MouseEvent.CLICK, dialogButtonClicked);
            return;
        }// end function

        private function loadFlipRollDialogContent() : void
        {
            if (FlipRollDialogContent)
            {
                UIDispatcher.instance.dispatchEvent(new UIEvent(UIEvent.FLIPROLL_DIALOG_READY));
                return;
            }
            with ({})
            {
                {}.loadComplete = function (param1) : void
            {
                if (param1.filepath != swfFileName)
                {
                    return;
                }
                AssetsManager.getInstance().removeEventListener(AssetManagerEvent.LOAD_GENERIC_COMPLETE, loadComplete);
                var _loc_2:* = param1.data.applicationDomain;
                FlipRollDialogContent = _loc_2.getDefinition("FlipRollDialog") as Class;
                _soundManager = new FlipRollSoundManager(_loc_2);
                UIDispatcher.instance.dispatchEvent(new UIEvent(UIEvent.FLIPROLL_DIALOG_READY));
                return;
            }// end function
            ;
            }
            AssetsManager.getInstance().addEventListener(AssetManagerEvent.LOAD_GENERIC_COMPLETE, function (param1) : void
            {
                if (param1.filepath != swfFileName)
                {
                    return;
                }
                AssetsManager.getInstance().removeEventListener(AssetManagerEvent.LOAD_GENERIC_COMPLETE, loadComplete);
                var _loc_2:* = param1.data.applicationDomain;
                FlipRollDialogContent = _loc_2.getDefinition("FlipRollDialog") as Class;
                _soundManager = new FlipRollSoundManager(_loc_2);
                UIDispatcher.instance.dispatchEvent(new UIEvent(UIEvent.FLIPROLL_DIALOG_READY));
                return;
            }// end function
            );
            AssetsManager.getInstance().loadGeneric(swfFileName);
            return;
        }// end function

        private function handleDiceAnimationAfterResult(event:Event) : void
        {
            if (diceAnimation.currentFrame == 41 + diceResult * 8)
            {
                diceAnimation.removeEventListener(Event.ENTER_FRAME, handleDiceAnimationAfterResult);
                diceAnimation.stop();
                _soundManager.play("coinFlipStart");
                coinAnimation.play();
            }
            return;
        }// end function

        private function showNoCoinDialog() : void
        {
            var _loc_1:* = new FlipRollNoCoinDialog();
            DisplayManager.showDialog(_loc_1);
            return;
        }// end function

        private function showCoinAnmResult(param1:String) : void
        {
            updateTossHistoryDisplay(param1);
            if (param1 == "head")
            {
                coinAnimation.gotoAndStop(28);
            }
            else
            {
                coinAnimation.gotoAndStop(36);
            }
            return;
        }// end function

        private function animateCoinAndPotCoinUpdate(param1:int) : void
        {
            var coinUpdateTimer:Timer;
            var potAmount:int;
            var mycoinText:TextField;
            var mycoin:int;
            var delta:int;
            var isWin:* = param1;
            coinUpdateTimer = new Timer(1);
            coinUpdateTimer.start();
            potAmount = 0 + diceResult * currentBet;
            mycoinText = myscoreAnimation.getChildByName("coins") as TextField;
            mycoin = playerCoins;
            delta;
            delta = currentBet / 10;
            with ({})
            {
                {}.changeCoinAndPotCountByOne = function (event:Event) : void
            {
                potAmount = potAmount - delta;
                if (isWin)
                {
                    mycoin = mycoin + delta;
                    potvalue.text = potAmount.toString();
                }
                else
                {
                    mycoin = mycoin - delta;
                    potvalue.text = "";
                }
                mycoinText.text = "You have: " + mycoin.toString();
                if (potAmount < 1)
                {
                    coinUpdateTimer.stop();
                    coinUpdateTimer.removeEventListener(TimerEvent.TIMER, changeCoinAndPotCountByOne);
                    heads.mouseEnabled = true;
                    tails.mouseEnabled = true;
                    bet1Inactive.mouseEnabled = true;
                    bet2Inactive.mouseEnabled = true;
                    bet3Inactive.mouseEnabled = true;
                    headstatic.visible = false;
                    tailstatic.visible = false;
                    playagain.visible = true;
                    playerCoins = int(_flipRollConfig.getPlayerCoins());
                    potvalue.text = "";
                    _soundManager.stop("win");
                    dispatchEvent(new MyLifeEvent(MyLifeEvent.UPDATE_BALANCE, {balance:_flipRollConfig.getPlayerCoins()}));
                }
                return;
            }// end function
            ;
            }
            coinUpdateTimer.addEventListener(TimerEvent.TIMER, function (event:Event) : void
            {
                potAmount = potAmount - delta;
                if (isWin)
                {
                    mycoin = mycoin + delta;
                    potvalue.text = potAmount.toString();
                }
                else
                {
                    mycoin = mycoin - delta;
                    potvalue.text = "";
                }
                mycoinText.text = "You have: " + mycoin.toString();
                if (potAmount < 1)
                {
                    coinUpdateTimer.stop();
                    coinUpdateTimer.removeEventListener(TimerEvent.TIMER, changeCoinAndPotCountByOne);
                    heads.mouseEnabled = true;
                    tails.mouseEnabled = true;
                    bet1Inactive.mouseEnabled = true;
                    bet2Inactive.mouseEnabled = true;
                    bet3Inactive.mouseEnabled = true;
                    headstatic.visible = false;
                    tailstatic.visible = false;
                    playagain.visible = true;
                    playerCoins = int(_flipRollConfig.getPlayerCoins());
                    potvalue.text = "";
                    _soundManager.stop("win");
                    dispatchEvent(new MyLifeEvent(MyLifeEvent.UPDATE_BALANCE, {balance:_flipRollConfig.getPlayerCoins()}));
                }
                return;
            }// end function
            );
            return;
        }// end function

        private function coinAnimationCheckFrame(event:Event) : void
        {
            if (coinAnimation.currentFrame == 27)
            {
                coinAnimation.stop();
                coinAnimationStopped = true;
                coinAnimation.removeEventListener(Event.ENTER_FRAME, coinAnimationCheckFrame);
                _frDialog.dispatchEvent(new Event(FlipRollEvent.FLIPROLL_COIN_STOPPED));
            }
            return;
        }// end function

        private function moveDiceToFinalPositionAfterResult(event:Event) : void
        {
            anmTimer.stop();
            anmTimer.removeEventListener(TimerEvent.TIMER, moveDiceToFinalPositionAfterResult);
            diceAnimation.addEventListener(Event.ENTER_FRAME, handleDiceAnimationAfterResult);
            diceAnimation.play();
            return;
        }// end function

        private function loadDefaultGameState() : void
        {
            resetResultDisplay();
            playerCoins = int(_flipRollConfig.getPlayerCoins());
            playagain.visible = false;
            gameTimer = new Timer(100);
            anmTimer = new Timer(1000);
            gameTimer.start();
            currentCoin = 0;
            headstatic.visible = false;
            tailstatic.visible = false;
            bet1Active.visible = true;
            bet2Active.visible = false;
            bet3Active.visible = false;
            bet1Inactive.visible = false;
            bet2Inactive.visible = true;
            bet3Inactive.visible = true;
            (bet1Active.getChildByName("text") as TextField).text = _betValue1.toString() + " Coins";
            (bet2Active.getChildByName("text") as TextField).text = _betValue2.toString() + " Coins";
            (bet3Active.getChildByName("text") as TextField).text = _betValue3.toString() + " Coins";
            (myscoreAnimation.getChildByName("coins") as TextField).text = "You have: " + _flipRollConfig.getPlayerCoins();
            return;
        }// end function

        public function showFlipRollResult(param1:Object) : void
        {
            var _showTossFace:String;
            var data:* = param1;
            diceResult = data.diceResult;
            tossResult = data.tossWon;
            var tossResultBool:* = tossResult as Boolean;
            (_frDialog.getChildByName("tip") as TextField).text = "";
            _showTossFace;
            if (tossResult == "1")
            {
                if (_tossCall == "tail")
                {
                    _showTossFace;
                }
                else
                {
                    _showTossFace;
                }
            }
            else if (_tossCall == "tail")
            {
                _showTossFace;
            }
            else
            {
                _showTossFace;
            }
            if (diceAnimationStopped)
            {
                showDiceAnmResult(diceResult);
            }
            else
            {
                _frDialog.addEventListener(FlipRollEvent.FLIPROLL_DICE_STOPPED, function (event:Event) : void
            {
                showDiceAnmResult(diceResult);
                return;
            }// end function
            );
            }
            if (coinAnimationStopped)
            {
                showCoinAnmResult(_showTossFace);
            }
            else
            {
                with ({})
                {
                    {}.anmComplete = function (event:Event) : void
            {
                showCoinAnmResult(_showTossFace);
                resultShowTimer.addEventListener(TimerEvent.TIMER, resultAfterAnm);
                resultShowTimer.start();
                _frDialog.removeEventListener(FlipRollEvent.FLIPROLL_COIN_STOPPED, anmComplete);
                return;
            }// end function
            ;
                }
                _frDialog.addEventListener(FlipRollEvent.FLIPROLL_COIN_STOPPED, function (event:Event) : void
            {
                showCoinAnmResult(_showTossFace);
                resultShowTimer.addEventListener(TimerEvent.TIMER, resultAfterAnm);
                resultShowTimer.start();
                _frDialog.removeEventListener(FlipRollEvent.FLIPROLL_COIN_STOPPED, anmComplete);
                return;
            }// end function
            );
            }
            return;
        }// end function

        private function resultAfterAnm(event:Event) : void
        {
            (myscoreAnimation.getChildByName("coins") as TextField).text = "You have: " + _flipRollConfig.getPlayerCoins();
            resultShowTimer.stop();
            resultShowTimer.removeEventListener(TimerEvent.TIMER, resultAfterAnm);
            (_frDialog.getChildByName("tip") as TextField).text = "";
            coinAnimation.addEventListener(Event.ENTER_FRAME, moveCoinToLastFrame);
            coinAnimation.play();
            if (tossResult == "1")
            {
                var _loc_4:* = winCount + 1;
                winCount = _loc_4;
                _soundManager.play("win");
                _frDialog.addChild(winner);
                sparkleanimation.visible = true;
                sparkleBoard.play();
                myscore.play();
                animateCoinAndPotCoinUpdate(1);
                if (_frDialog.getChildByName("hardluck"))
                {
                    _frDialog.removeChild(hardluck);
                }
            }
            else
            {
                winCount = 0;
                _frDialog.addChild(hardluck);
                _soundManager.play("lose");
                sparkleanimation.visible = false;
                animateCoinAndPotCoinUpdate(0);
                if (_frDialog.getChildByName("winner"))
                {
                    _frDialog.removeChild(winner);
                }
            }
            dispatchEvent(new MyLifeEvent(MyLifeEvent.UPDATE_BALANCE, {balance:_flipRollConfig.getPlayerCoins()}));
            if (winCount > 2 && isFacebook())
            {
                FlipRollManager.getInstance().showWinnerDialog();
                winCount = 0;
            }
            var _loc_2:* = 0 + diceResult * currentBet;
            return;
        }// end function

        private function diceAnimationCheckFrame(event:Event) : void
        {
            if (diceAnimation.currentFrame == 41)
            {
                diceAnimation.stop();
                diceAnimationStopped = true;
                diceAnimation.removeEventListener(Event.ENTER_FRAME, diceAnimationCheckFrame);
                coinAnimation.addEventListener(Event.ENTER_FRAME, coinAnimationCheckFrame);
                _frDialog.dispatchEvent(new FlipRollEvent(FlipRollEvent.FLIPROLL_DICE_STOPPED));
            }
            return;
        }// end function

        private function glowCoin(event:TimerEvent) : void
        {
            switch(currentCoin)
            {
                case 1:
                {
                    break;
                }
                case 2:
                {
                    break;
                }
                case 3:
                {
                    break;
                }
                case 4:
                {
                    break;
                }
                case 5:
                {
                    break;
                }
                case 6:
                {
                    break;
                }
                default:
                {
                    break;
                }
            }
            switch(currentCoin)
            {
                case 1:
                {
                    break;
                }
                case 2:
                {
                    break;
                }
                case 3:
                {
                    break;
                }
                case 4:
                {
                    break;
                }
                case 5:
                {
                    break;
                }
                case 6:
                {
                    break;
                }
                default:
                {
                    break;
                }
            }
            var _loc_3:* = currentCoin + 1;
            currentCoin = _loc_3;
            return;
        }// end function

        private function resetResultDisplay() : void
        {
            sparkleanimation.visible = false;
            sparkleBoard.gotoAndStop(1);
            potvalue.text = "";
            playagain.visible = false;
            onexstate2.visible = false;
            twoxstate2.visible = false;
            threexstate2.visible = false;
            fourxstate2.visible = false;
            fivexstate2.visible = false;
            sixxstate2.visible = false;
            onexstate1.visible = true;
            twoxstate1.visible = true;
            threexstate1.visible = true;
            fourxstate1.visible = true;
            fivexstate1.visible = true;
            sixxstate1.visible = true;
            onexstate3.visible = false;
            twoxstate3.visible = false;
            threexstate3.visible = false;
            fourxstate3.visible = false;
            fivexstate3.visible = false;
            sixxstate3.visible = false;
            if (_frDialog.getChildByName("hardluck"))
            {
                _frDialog.removeChild(hardluck);
            }
            if (_frDialog.getChildByName("winner"))
            {
                _frDialog.removeChild(winner);
            }
            return;
        }// end function

        private function moveCoinToLastFrame(event:Event) : void
        {
            if (coinAnimation.currentFrame == 35 || coinAnimation.currentFrame == 43)
            {
                coinAnimation.removeEventListener(Event.ENTER_FRAME, moveCoinToLastFrame);
                coinAnimation.stop();
            }
            return;
        }// end function

        public function selectBet(param1:int) : void
        {
            trace(param1);
            _soundManager.play("click");
            if (playerCoins < param1 * 6)
            {
                showNoCoinDialog();
            }
            currentBet = param1;
            switch(param1)
            {
                case _betValue1:
                {
                    ZtrackHelper.trackCounter("flip_n_roll", 1, "stakes", "button_one");
                    bet1Active.visible = true;
                    bet2Active.visible = false;
                    bet3Active.visible = false;
                    bet1Inactive.visible = false;
                    bet2Inactive.visible = true;
                    bet3Inactive.visible = true;
                    break;
                }
                case _betValue2:
                {
                    ZtrackHelper.trackCounter("flip_n_roll", 1, "stakes", "button_two");
                    bet1Active.visible = false;
                    bet2Active.visible = true;
                    bet3Active.visible = false;
                    bet1Inactive.visible = true;
                    bet2Inactive.visible = false;
                    bet3Inactive.visible = true;
                    break;
                }
                case _betValue3:
                {
                    ZtrackHelper.trackCounter("flip_n_roll", 1, "stakes", "button_three");
                    bet1Active.visible = false;
                    bet2Active.visible = false;
                    bet3Active.visible = true;
                    bet1Inactive.visible = true;
                    bet2Inactive.visible = true;
                    bet3Inactive.visible = false;
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        private function payTableDialog(event:Event) : void
        {
            FlipRollManager.getInstance().showPayTableDialog();
            return;
        }// end function

        var _loc_1:* = MyLifeConfiguration.getInstance().variables["global"]["asset_path"] + "dialogs/Casino/FlipRollDialog.swf" + MyLifeConfiguration.getInstance().assetVersionParam;
        swfFileName = _loc_1;
    }
}
 

++Hadi++

Active Member
من حاضرم از اول بازی رو بنویسم تا اینکه تو این کد قمر در عقرب بگردم...
در کل الگریتم اصلیش فکر می کنم سبک تر از این حرفاست...
در کل الگریتمش اینه...
اولا من یه کلاس برا جنریت اعداد رندوم به راحتی نوشتم و از اون استفاده می کنیم...
در ثانی با زدن دکمه ای مثلا دکمه به اسم btn :
PHP:
import Classes.Random;//import my class for easy generate random numbers(Hadi)

var Positions:Array=["Shir","Khat"];//all the positions
var YourGuessWillAccept:Boolean=false;//true for make it in your guess
var YourValue:Boolean=true;//->true:Shir     false:Khat 
btn.addEventListener(MouseEvent.CLICK,clicking);//if you click btn
function clicking(evt:MouseEvent):void//after clicking the btn
{
    if(YourGuessWillAccept)//if you want to  make result of game in your guess selected in YourValue variable
    {
        trace(Positions[YourValue?0:1]);//will trace your value
        coinmc.gotoAndStop(YourValue?2:3);//coin will go to your value
    }
    else
    {
        var choice:int=Random.randomIntBetween(0,1);//generate an integer  number between 0 and 1
        trace(Positions[choice]);//the generated random number will manage the andis of positions array for trace shir or khat
        coinmc.gotoAndStop(choice+2);//because the frames if a movieclip starts from 1 and first frame is question sign,2 will add to our generated integer
    }
    
}
تو این بازی اگه بخواهین همه چی به شانس بره باید متغیر YourGuessWillAccept رو false کنین و اگه اونو true کنین،بسته به متغیر بولین YourValue اگه YourValue برابر true باشه،اعداد بدست آمده همیشه شیر و در غیر اینصورت خط می شه...
بیشتر از این وقت برا توضیح ندارم...سمپل رو دان کنین ...good luckkkkkkkkk
 

پیوست ها

  • Coin.rar
    19.1 کیلوبایت · بازدیدها: 102

جدیدترین ارسال ها

بالا