private void InitToggles() { int start = (int)BlackMarketType.BlackMarket_Min + 1; int end = (int)BlackMarketType.BlackMarket_Max; if (!BlackMarketProxy.instance.isLimitActivityOpen) { end = (int)BlackMarketType.BlackMarket_LimitActivity; } TransformUtil.ClearChildren(toggleRoot, true); togglePrefab.gameObject.SetActive(true); for (int i = start; i < end; i++) { Toggle toggle = Instantiate <Toggle>(togglePrefab); toggle.transform.SetParent(toggleRoot, false); ToggleContent content = toggle.GetComponent <ToggleContent>(); content.Set(i, Localization.Get(string.Format("ui.black_market_view.toggle.{0}", i))); if (i == (int)BlackMarketProxy.instance.selectType) { toggle.isOn = true; } else { toggle.isOn = false; } } togglePrefab.gameObject.SetActive(false); }
public void ClickToggleHandler(Toggle toggle) { if (_currentToggle == toggle) { return; } if (toggle.isOn) { _currentToggle = toggle; ToggleContent content = toggle.GetComponent <ToggleContent>(); BlackMarketProxy.instance.selectType = (BlackMarketType)content.id; InitTable(); RefreshCurrentItemIcon(); RefreshMaterial(); } }
// 0 音效 1背景音乐 2推送 public void ClickToggleHandler(ToggleContent toggleContent) { switch (toggleContent.id) { case 0: AudioController.instance.isOpenAudio = toggleSound.isOn; break; case 1: AudioController.instance.isOpenAudioBg = toggleSoundBg.isOn; break; case 2: GameSetting.instance.pushMessage = toggleMsgPush.isOn; break; case 3: GameSetting.instance.effectPlayable = toggleEffectPlayable.isOn; break; } RefreshSoundSprite(); AudioController.instance.SavePlayerPref(); }
public void OnClickToggleHandler(Toggle toggle) { //if(_currentToggle == toggle) //return; if (toggle.isOn) { FriendProxy friendProxy = FriendProxy.instance; ToggleContent tc = toggle.GetComponent <ToggleContent>(); _currentToggleId = tc.id; if (_currentToggleId == 1 && friendProxy.NewFriendListComing) { FriendController.instance.CLIENT2LOBBY_FriendListReq_REQ(); } else if (_currentToggleId == 3 && friendProxy.NewFriendRequestComing) { FriendController.instance.CLIENT2LOBBY_FriendMsgListReq_REQ(); } else { Refresh(true); } if (_currentToggleId == 1) { FriendProxy.instance.NewFriendListComing = false; } else if (_currentToggleId == 3) { FriendProxy.instance.NewFriendRequestComing = false; } for (int i = 0; i < bottomBtnRoot.Length; i++) { bottomBtnRoot[i].SetActive(i == (_currentToggleId - 1)); } _currentToggle = toggle; } }