public void OnButtonQuad(int value) { BEAudioManager.SoundPlay(0); bool bSuccess = ((CardType)value == CardCenter.Symbol) ? true : false; ShowResult(bSuccess, 4.0f); }
void Awake() { instance = this; AudioSourcePool = new List <AudioSource>(); AudioSourceAlloc(); }
void Start() { // when start, if music volume is not 0, play music if (BESetting.MusicVolume != 0) { BEAudioManager.MusicPlay(); } }
// 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 ()); }
public void MessageBoxResultUpgradeCancel(int result) { BEAudioManager.SoundPlay(6); if (result == 0) { building.UpgradeCancel(); Hide(); } }
// 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 } }
public void OnButtonBuy() { //Debug.Log ("UISGShop::OnButtonBuy"); BEAudioManager.SoundPlay(0); if (Selected == -1) { return; } BESetting.Gold.ChangeDelta(ItemList[Selected].total); BESetting.Save(); Hide(); }
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 ()); } }
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); }
// 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 { } } }
// 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(); } }
//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 { } }
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(); } } }
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)); } }
// 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(); }
// 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 { } } }
public void OnButtonBackToGame() { BEAudioManager.SoundPlay(0); Hide(); }
public void OnButtonGet() { BEAudioManager.SoundPlay(0); }
// when reel stoped public void OnReelStop(int value) { //Debug.Log ("OnReelStop:"+value.ToString()); BEAudioManager.SoundPlay(2); }
// if user clicked auto spin public void AutoSpinToggled(bool value) { BEAudioManager.SoundPlay(0); }
public void OnButtonSelected(int value) { BEAudioManager.SoundPlay(0); Application.LoadLevel("SlotGame"); }
//user clicked double button, then start double game public void OnButtonDouble() { BEAudioManager.SoundPlay(0); UIDoubleGame.Show(Slot.gameResult.GameWin); }
//user clicked shop button, then show shop public void OnButtonShop() { BEAudioManager.SoundPlay(0); UISGShop.Show(); }
public void OnButtonMenu() { BEAudioManager.SoundPlay(0); Application.LoadLevel("Lobby"); }
// user clicked paytable button, then show paytable public void OnButtonPayTable() { BEAudioManager.SoundPlay(0); UISGPayTable.Show(Slot); }
// user clicked option button, then show option public void OnButtonOption() { BEAudioManager.SoundPlay(0); UISGOption.Show(); }
public void SoundToggled(bool value) { BEAudioManager.SoundPlay(0); BESetting.SoundVolume = value ? 0 : 100; BESetting.Save(); }
//user clicked line button, increase line count public void OnButtonLines() { BEAudioManager.SoundPlay(0); Slot.LineSet(Slot.Line + 1); UpdateUI(); }
public void OnButtonContinue() { //Debug.Log("UISGOption::OnButtonContinue"); BEAudioManager.SoundPlay(0); //Hide(); }
// user clicked bet button, then increase bet number public void OnButtonBet() { BEAudioManager.SoundPlay(0); Slot.BetSet(Slot.Bet + 1); UpdateUI(); }