示例#1
0
        public void OnButtonQuad(int value)
        {
            BEAudioManager.SoundPlay(0);
            bool bSuccess = ((CardType)value == CardCenter.Symbol) ? true : false;

            ShowResult(bSuccess, 4.0f);
        }
示例#2
0
        void Awake()
        {
            instance = this;

            AudioSourcePool = new List <AudioSource>();
            AudioSourceAlloc();
        }
示例#3
0
 void Start()
 {
     // when start, if music volume is not 0, play music
     if (BESetting.MusicVolume != 0)
     {
         BEAudioManager.MusicPlay();
     }
 }
示例#4
0
 // when user clicked sfx button
 public void SoundToggled(bool value)
 {
     BEAudioManager.SoundPlay(6);
     //toggle sound value and save
     BESetting.SoundVolume = value ? 0 : 100;
     BESetting.Save();
     //Debug.Log ("SoundVolume:"+BEUtil.instance.SoundVolume.ToString ());
 }
示例#5
0
 public void MessageBoxResultUpgradeCancel(int result)
 {
     BEAudioManager.SoundPlay(6);
     if (result == 0)
     {
         building.UpgradeCancel();
         Hide();
     }
 }
示例#6
0
 // result of quit messagebox
 public void MessageBoxResult(int result)
 {
     BEAudioManager.SoundPlay(6);
     if (result == 0)
     {
                         #if UNITY_EDITOR
         UnityEditor.EditorApplication.isPlaying = false;
                         #else
         Application.Quit();
                         #endif
     }
 }
示例#7
0
        public void OnButtonBuy()
        {
            //Debug.Log ("UISGShop::OnButtonBuy");
            BEAudioManager.SoundPlay(0);
            if (Selected == -1)
            {
                return;
            }

            BESetting.Gold.ChangeDelta(ItemList[Selected].total);
            BESetting.Save();
            Hide();
        }
示例#8
0
        public void ItemSelected(int value)
        {
            if (SceneSlotGame.uiState == 0)
            {
                return;
            }

            BEAudioManager.SoundPlay(0);
            if (Toggles[value].isOn)
            {
                Selected = value;
                //Debug.Log ("UISGShop::ItemSelected"+value.ToString ());
            }
        }
示例#9
0
        public void OnButtonDouble(int value)
        {
            BEAudioManager.SoundPlay(0);
            bool bSuccess = false;

            if (value == 0)
            {
                bSuccess = UICard.isRedColor(CardCenter.Symbol);
            }
            else
            {
                bSuccess = !UICard.isRedColor(CardCenter.Symbol);
            }

            ShowResult(bSuccess, 2.0f);
        }
示例#10
0
        // user clicked spin button
        public void OnButtonSpin()
        {
            //Debug.Log ("OnButtonSpin");

            BEAudioManager.SoundPlay(0);

            // start spin
            SlotReturnCode code = Slot.Spin();

            // if spin succeed
            if (SlotReturnCode.Success == code)
            {
                // disabled inputs
                ButtonEnable(false);
                btnDouble.gameObject.SetActive(false);
                UpdateUI();
                // apply decreased user gold
                BESetting.Gold.ChangeTo(Slot.Gold);
                BESetting.Save();

                // set info text
                if (Slot.gameResult.InFreeSpin())
                {
                    textInfo.text = "Free Spin " + Slot.gameResult.FreeSpinCount.ToString() + " of " + Slot.gameResult.FreeSpinTotalCount.ToString();
                }
                else
                {
                    textInfo.text = "";
                }
            }
            else
            {
                // if spin fails
                // show Error Message
                if (SlotReturnCode.InSpin == code)
                {
                    UISGMessage.Show("Error", "Slot is in spin now.", MsgType.Ok, null);
                }
                else if (SlotReturnCode.NoGold == code)
                {
                    UISGMessage.Show("Error", "Not enough gold.", MsgType.Ok, null);
                }
                else
                {
                }
            }
        }
示例#11
0
        // when use clicked music button
        public void MusicToggled(bool value)
        {
            BEAudioManager.SoundPlay(6);
            // toggle music value and save
            BESetting.MusicVolume = value ? 0 : 100;
            BESetting.Save();

            // play or stop music
            if (value)
            {
                BEAudioManager.instance.MusicStop();
            }
            else
            {
                BEAudioManager.instance.MusicPlay();
            }
        }
示例#12
0
        //when splash window shows
        public void OnSplashShow(int value)
        {
            //Debug.Log ("OnSplashShow:"+value.ToString());
            BEAudioManager.SoundPlay(3);
            UISGSplash.Show(value);

            // change background image if free spin
            if (value == (int)SplashType.FreeSpin)
            {
                FreeSpinBackground.SetActive(true);
            }
            else if (value == (int)SplashType.FreeSpinEnd)
            {
                FreeSpinBackground.SetActive(false);
            }
            else
            {
            }
        }
示例#13
0
        public void MusicToggled(bool value)
        {
            //Debug.Log ("MusicToggled "+value);
            BEAudioManager.SoundPlay(0);
            BESetting.MusicVolume = value ? 0 : 100;
            BESetting.Save();

            if (value)
            {
                BEAudioManager.MusicStop();
            }
            else
            {
                if (!BEAudioManager.MusicIsPlaying())
                {
                    BEAudioManager.MusicPlay();
                }
            }
        }
示例#14
0
        void ShowResult(bool bSuccess, float fMultiply)
        {
            if (InShowResult)
            {
                return;
            }

            if (bSuccess)
            {
                BEAudioManager.SoundPlay(3);
            }

            InShowResult = true;
            InputEnable(false);
            SelectCount++;

            CardCenter.Flip();

            if (bSuccess && (SelectCount < SelectCountMax))
            {
                CoinWins *= fMultiply;
                UpdateText();
                animator.Play("Move");
            }
            else
            {
                // in case 5th choice
                if (bSuccess)
                {
                    CoinWins *= fMultiply;
                    SceneSlotGame.instance.OnDoubleGameEnd(CoinWins - CoinStart);
                }
                else
                {
                    CoinWins *= 0.0f;
                    SceneSlotGame.instance.OnDoubleGameEnd(-CoinStart);
                }

                UpdateText();
                StartCoroutine(HideDelay(1.5f));
            }
        }
示例#15
0
 // user clicked Max line button, then ser slot's line count to max
 public void OnButtonMaxLine()
 {
     BEAudioManager.SoundPlay(0);
     Slot.LineSet(Slot.Lines.Count);
     UpdateUI();
 }
示例#16
0
        // when button clicked
        public void ButtonClicked(CommandType ct)
        {
            //Debug.Log ("ButtonClicked "+ct.ToString());
            BEAudioManager.SoundPlay(6);

            // if newly created building is selected
            // only perform create and cancel
            if (building.OnceLanded == false)
            {
                // if user clicked 'create' button
                if (ct == CommandType.Create)
                {
                    // building can land
                    if (building.Landable)
                    {
                        // hide command dialog
                        Hide();
                        // land building and unselect
                        SceneTown.instance.BuildingLandUnselect();

                        // decrease build price of the building
                        BuildingDef bd = TBDatabase.GetBuildingDef(building.Type, (building.Level == 0) ? 1 : building.Level);
                        building.PayforBuild(bd);
                        // if building level is 0(need buildtime), upgrade to level 1 start
                        // if not, check resource capacity
                        if (building.Level == 0)
                        {
                            building.Upgrade();
                        }
                        else
                        {
                            SceneTown.instance.CapacityCheck();
                        }
                    }

                    // if house is created add worker
                    if (building.Type == 1)
                    {
                        BEWorkerManager.instance.AddWorker();
                    }

                    // if wall is created,automatically next wall create for convenience
                    if (building.Type == 2)
                    {
                        // check if user has enough gold and wall count is not max count
                        BuildingDef bd        = TBDatabase.GetBuildingDef(building.Type, 1);
                        bool        Available = bd.PriceInfoCheck(null);
                        int         CountMax  = BEGround.instance.GetBuildingCountMax(building.Type);
                        int         Count     = BEGround.instance.GetBuildingCount(building.Type);
                        if (Available && (Count < CountMax))
                        {
                            //Debug.Log ("wall tilePos:"+building.tilePos.ToString ());
                            // add another wall automatically
                            Building script = BEGround.instance.BuildingAdd(2, 1);
                            if (script != null)
                            {
                                // choose whicj direction
                                Building buildingNeighbor = null;
                                Vector2  tilePos          = Vector2.zero;
                                int      NeighborX        = 0;
                                int      NeighborZ        = 0;
                                bool     bFind            = false;
                                // check prev and next tile in x,z coordination
                                for (int dir = 0; dir < 2; ++dir)
                                {
                                    for (int value = 0; value < 2; ++value)
                                    {
                                        if (dir == 0)
                                        {
                                            NeighborX = 0;
                                            NeighborZ = ((value == 0) ? -1 : 1);
                                        }
                                        else
                                        {
                                            NeighborX = ((value == 0) ? -1 : 1);
                                            NeighborZ = 0;
                                        }
                                        buildingNeighbor = BEGround.instance.GetBuilding((int)building.tilePos.x + NeighborX, (int)building.tilePos.y + NeighborZ);

                                        // if wall finded
                                        if ((buildingNeighbor != null) && (buildingNeighbor.Type == 2))
                                        {
                                            bFind = true;
                                            break;
                                        }
                                    }

                                    if (bFind)
                                    {
                                        break;
                                    }
                                }
                                //Debug.Log ("wall NeighborX:"+NeighborX.ToString ()+ "NeighborZ:"+NeighborZ.ToString ());

                                // set inverse direction
                                tilePos = building.tilePos;
                                if (NeighborX == 0)
                                {
                                    tilePos.y -= (float)NeighborZ;
                                }
                                else
                                {
                                    tilePos.x -= (float)NeighborX;
                                }

                                //Debug.Log ("wall tilePos New:"+tilePos.ToString ());
                                script.Move((int)tilePos.x, (int)tilePos.y);
                                script.CheckLandable();
                                SceneTown.instance.BuildingSelect(script);
                            }
                        }
                    }

                    SceneTown.instance.Save();
                    BEWorkerManager.instance.SetWorker(building);
                }
                // if user clicked 'cancel' button
                else if (ct == CommandType.CreateCancel)
                {
                    // hide command dialog
                    Hide();
                    // delete temporary created building
                    SceneTown.instance.BuildingDelete();
                }
                else
                {
                }
            }
            else
            {
                if (ct == CommandType.Info)
                {
                    Hide();
                    UIDialogInfo.Show(building);
                }
                else if (ct == CommandType.Upgrade)
                {
                    // check if worker available
                    if (BEWorkerManager.instance.WorkerAvailable())
                    {
                        Hide();
                        UIDialogUpgradeAsk.Show(building);
                    }
                    else
                    {
                        UIDialogMessage.Show("All workers are working now", "Ok", "No Worker Available");
                    }
                }
                else if (ct == CommandType.UpgradeCancel)
                {
                    UIDialogMessage.Show("Cancel current upgrade?", "Yes,No", "Cancel Upgrade ?", null, (result) => { MessageBoxResultUpgradeCancel(result); });
                }
                else if (ct == CommandType.UpgradeFinish)
                {
                    // if instant finish button was clicked
                    int FinishGemCount = building.GetFinishGemCount();
                    // user has enough gem to finish
                    if (SceneTown.Gem.Target() >= FinishGemCount)
                    {
                        // decrease gem
                        SceneTown.Gem.ChangeDelta(-FinishGemCount);
                        // complete upgrade
                        building.UpgradeCompleted = true;
                        Hide();
                    }
                    else
                    {
                        UIDialogMessage.Show("You need more gems to finish this work immediately", "Ok", "Need More Gems");
                    }
                }
                else if (ct == CommandType.Training)
                {
                    Hide();
                    UIDialogTraining.Show(building);
                }
                else
                {
                }
            }
        }
示例#17
0
 public void OnButtonBackToGame()
 {
     BEAudioManager.SoundPlay(0);
     Hide();
 }
示例#18
0
 public void OnButtonGet()
 {
     BEAudioManager.SoundPlay(0);
 }
示例#19
0
 // when reel stoped
 public void OnReelStop(int value)
 {
     //Debug.Log ("OnReelStop:"+value.ToString());
     BEAudioManager.SoundPlay(2);
 }
示例#20
0
 // if user clicked auto spin
 public void AutoSpinToggled(bool value)
 {
     BEAudioManager.SoundPlay(0);
 }
示例#21
0
 public void OnButtonSelected(int value)
 {
     BEAudioManager.SoundPlay(0);
     Application.LoadLevel("SlotGame");
 }
示例#22
0
 //user clicked double button, then start double game
 public void OnButtonDouble()
 {
     BEAudioManager.SoundPlay(0);
     UIDoubleGame.Show(Slot.gameResult.GameWin);
 }
示例#23
0
 //user clicked shop button, then show shop
 public void OnButtonShop()
 {
     BEAudioManager.SoundPlay(0);
     UISGShop.Show();
 }
示例#24
0
 public void OnButtonMenu()
 {
     BEAudioManager.SoundPlay(0);
     Application.LoadLevel("Lobby");
 }
示例#25
0
 // user clicked paytable button, then show paytable
 public void OnButtonPayTable()
 {
     BEAudioManager.SoundPlay(0);
     UISGPayTable.Show(Slot);
 }
示例#26
0
 // user clicked option button, then show option
 public void OnButtonOption()
 {
     BEAudioManager.SoundPlay(0);
     UISGOption.Show();
 }
示例#27
0
 public void SoundToggled(bool value)
 {
     BEAudioManager.SoundPlay(0);
     BESetting.SoundVolume = value ? 0 : 100;
     BESetting.Save();
 }
示例#28
0
 //user clicked line button, increase line count
 public void OnButtonLines()
 {
     BEAudioManager.SoundPlay(0);
     Slot.LineSet(Slot.Line + 1);
     UpdateUI();
 }
示例#29
0
 public void OnButtonContinue()
 {
     //Debug.Log("UISGOption::OnButtonContinue");
     BEAudioManager.SoundPlay(0);
     //Hide();
 }
示例#30
0
 // user clicked bet button, then increase bet number
 public void OnButtonBet()
 {
     BEAudioManager.SoundPlay(0);
     Slot.BetSet(Slot.Bet + 1);
     UpdateUI();
 }