private void OnSkinChanged(EventParam param) { string tag = param.GetString("tag"); int skinIndex = param.GetInt(tag); GameSetting.Instance.currentCardSkin = skinIndex; StartCoroutine(ChangeCardSkin(skinIndex)); AppController.Instance.SaveSetting(); //Utilities.Instance.DispatchEvent(Solitaire.Event.SaveData, "save_data", 0); }
private void OnPlayEffect(EventParam param) { string tag = param.GetString("tag"); switch (tag) { case "firework": { m_FireworkLeft.SetActive(true); m_FireworkRight.SetActive(true); break; } } }
private void OnUndoPutback(EventParam param) { string tag = param.GetString("tag"); if (tag.Equals("undo_putback")) { m_IsEmpty = param.GetBoolean(tag); m_Renderer.sprite = m_Empty; return; } if (tag.Equals("undo_draw")) { m_IsEmpty = false; m_Renderer.sprite = m_Back; return; } }
private void OnPlayAudio(EventParam param) { string tag = param.GetString("tag"); switch (tag) { case "play_one": { PlayAudio(param.GetInt(tag)); break; } case "play_loop": { PlayLoop(param.GetInt(tag)); break; } } }
private void OnBtnUndoChanged(EventParam param) { string tag = param.GetString("tag"); if (tag.Equals("undo")) { m_BtnUndo.interactable = param.GetBoolean(tag); if (m_BtnUndo.IsInteractable()) { m_UndoColor.a = 1.0f; } else { m_UndoColor.a = 0.5f; } m_UndoIcon.color = m_UndoColor; m_UndoText.color = m_UndoColor; } }
private void ShowPopup(EventParam param) { string tag = param.GetString("tag"); switch (tag) { case "game_over": { int score = param.GetInt(tag); OnGameOver(score); break; } case "tutorial": { m_ScorePanel.gameObject.SetActive(true); m_TutorialPanel.SetActive(true); break; } } }
private void OnSettingValueChanged(EventParam param) { string tag = param.GetString("tag"); switch (tag) { case "audio": { GameSetting.Instance.enableAudio = param.GetBoolean(tag); break; } case "enable_ads": { GameSetting.Instance.enableAds = param.GetBoolean(tag); break; } } Utilities.Instance.DispatchEvent(Solitaire.Event.OnSettingChanged, "setting_changed", 0); AppController.Instance.SaveSetting(); //Utilities.Instance.DispatchEvent(Solitaire.Event.SaveData, "save_data", 0); }
private void OnDataChanged(EventParam param) { Logger.Instance.PrintLog(Common.DEBUG_TAG, "OnDataChanged"); string tag = param.GetString("tag"); if (!String.IsNullOrEmpty(tag)) { switch (tag) { case "score": { m_ScoreText.text = param.GetString(tag); break; } case "move": { m_MoveText.text = param.GetString(tag); break; } case "time": { m_TimeText.text = param.GetString(tag); break; } case "difficulty": { m_DifficultyText.text = param.GetString(tag); break; } case "game_mode": { m_GameText.text = param.GetString(tag); break; } } } }
private void ShowPopup(EventParam param) { string tag = param.GetString("tag"); if (!String.IsNullOrEmpty(tag)) { switch (tag) { case "option": { if (m_PopupList.ContainsKey(tag)) { m_PopupList[tag].SetActive(true); } else { m_PopupList.Add(tag, Instantiate(m_OptionMenuPrefab, Vector3.zero, Quaternion.identity)); } break; } case "new_game": { if (m_PopupList.ContainsKey(tag)) { m_PopupList[tag].SetActive(true); } else { m_PopupList.Add(tag, Instantiate(m_NewGamePopupPrefab, Vector3.zero, Quaternion.identity)); } break; } case "game_result": { int result = param.GetInt(tag); if (m_PopupList.ContainsKey(tag)) { m_PopupList[tag].SetActive(true); } else { m_PopupList.Add(tag, Instantiate(m_GameResultPopupPrefab, Vector3.zero, Quaternion.identity)); } m_PopupList[tag].GetComponent <ResultPopup>().IsWin = result == 1 ? true : false; break; } case "how_to_play": { if (m_PopupList.ContainsKey(tag)) { m_PopupList[tag].SetActive(true); } else { m_PopupList.Add(tag, Instantiate(m_HowToPlayPopupPrefab, Vector3.zero, Quaternion.identity)); m_PopupList[tag].GetComponent <HowToPlayPopup>().SetData(); } break; } case "card_skin": { if (m_PopupList.ContainsKey(tag)) { m_PopupList[tag].SetActive(true); } else { m_PopupList.Add(tag, Instantiate(m_CardSkinPopupPrefab, Vector3.zero, Quaternion.identity)); } break; } } } }