public AreaSelectSwitchButton SetModel(AreaSelectSwitchButtonModel model, bool bufEvent) { m_model = model; m_bufEvent = bufEvent; m_model.OnUpdated += () => { SetLabelText(m_model.labelText); UpdateButtonStatus(); }; base.SetModel <AreaSelectSwitchButtonModel>(m_model); RegisterKeyEventCallback("next", () => { ShowNext(); }); return(this); }
private void SetUpSwitchButtons() { var indexActionMap = new List <System.Action> { OnSelectSwitch0, OnSelectSwitch1, OnSelectSwitch2, }; var tabName = new List <string> { GameTextUtil.GetText("map_tab1"), GameTextUtil.GetText("map_tab2"), GameTextUtil.GetText("map_tab3"), }; var areaCategoryLabel = new List <MasterDataDefineLabel.AreaCategory> { MasterDataDefineLabel.AreaCategory.RN_STORY, MasterDataDefineLabel.AreaCategory.RN_SCHOOL, MasterDataDefineLabel.AreaCategory.RN_EVENT, }; m_buttonAnimationFinish = false; int size = m_switchButtonRoots.Length; for (int i = 0; i < size; i++) { int index = i; bool bufEvent = MainMenuUtil.checkHelpBufEvent(areaCategoryLabel[index]); var model = new AreaSelectSwitchButtonModel(index); model.OnClicked += () => { if (model.isSelected) { return; } indexActionMap[index](); }; model.OnShowedNext += () => { if (index == size - 1) { m_buttonAnimationFinish = true; return; } m_switchButtons[index + 1].Appear(); }; model.labelText = tabName[index]; AreaSelectSwitchButton .Attach(m_switchButtonRoots[index]) .SetModel(model, bufEvent); m_switchButtons.Add(model); } { var model = new ButtonModel(); model.OnClicked += () => { OnSelectMapButton(); }; RegionSwitchButton .Attach(RegionButtonRoot) .SetModel(model); } }