private void Init() { var rules = GlobalData.FavorabilityMainModel.DressUpUnlockRuleLists; var curRole = GlobalData.FavorabilityMainModel.CurrentRoleVo; var clothItemId = curRole.Apparel[0]; var backgroundItemId = curRole.Apparel[1]; foreach (var t in rules) { switch (t.ItemType) { case DressUpTypePB.TypeClothes: if (t.Player == curRole.Player) { ReloadingVO vo1 = new ReloadingVO(t); vo1.IsPitchOn = vo1.ItemId == clothItemId; _cloths.Add(vo1); } break; case DressUpTypePB.TypeBackground: ReloadingVO vo2 = new ReloadingVO(t); vo2.IsPitchOn = vo2.ItemId == backgroundItemId; _backgrounds.Add(vo2); break; } } _cloths.Sort(); _backgrounds.Sort(); SetSpecialBackgroundRedFrame(); }
public ReloadingVO GetData(int itemId, ReloadingListState state) { ReloadingVO vo = null; switch (state) { case ReloadingListState.Clothing: foreach (var t in _cloths) { if (t.ItemId == itemId) { vo = t; break; } } break; case ReloadingListState.Backgroud: foreach (var t in _backgrounds) { if (t.ItemId == itemId) { vo = t; break; } } break; } return(vo); }
public override void OnMessage(Message message) { string name = message.Name; object[] body = message.Params; var pb = GlobalData.FavorabilityMainModel.CurrentRoleVo.Player; switch (name) { case MessageConst.CMD_RELOADING_RESET_CLOTH_RED_FRAME: var clothItemId = Convert.ToInt32(message.Body); _model.UpdateListItemRedFrameShow(clothItemId, ReloadingListState.Clothing); View.RefreshRedFrameShow(_model.GetList(ReloadingListState.Clothing), ReloadingListState.Clothing); _cloth = _model.GetData(clothItemId, ReloadingListState.Clothing); break; case MessageConst.CMD_RELOADING_RESET_BACKGROUND_RED_FARME: var backgroundItemId = Convert.ToInt32(message.Body); _model.UpdateListItemRedFrameShow(backgroundItemId, ReloadingListState.Backgroud); View.RefreshRedFrameShow(_model.GetList(ReloadingListState.Backgroud), ReloadingListState.Backgroud); _background = _model.GetData(backgroundItemId, ReloadingListState.Backgroud); break; case MessageConst.CMD_FACORABLILITY_VIEW_ONSAVE_BTN: OnClickSaveBtnEvent(); break; } }
/// <summary> /// 点击保存按钮设置Key值 /// </summary> private void OnClickSaveBtnEvent() { var curRole = GlobalData.FavorabilityMainModel.CurrentRoleVo; var clothId = curRole.Apparel[0]; var background = curRole.Apparel[1]; if (_cloth == null) { _cloth = _model.GetData(clothId, ReloadingListState.Clothing); } if (_background == null) { _background = _model.GetData(background, ReloadingListState.Backgroud); } if (_cloth.IsGet && _background.IsGet) { //发请求 SendSaveReq(curRole.Player); } else { if (_cloth.IsGet == false) { FlowText.ShowMessage(I18NManager.Get("Reloading_ClothNounlock")); } if (_background.IsGet == false) { FlowText.ShowMessage(I18NManager.Get("Reloading_BackgroundNounlock")); } } }
private void ResetBackground() { if (_lastOnClickBackground != null && _lastOnClickBackground.IsGet == false)//把背景切回原来的 { BGTexture(_model.GetBgImagePath(_curRole.Apparel[1])); SendMessage(new Message(MessageConst.CMD_RELOADING_RESET_BACKGROUND_RED_FARME, _curRole.Apparel[1])); _clothHint.gameObject.Hide(); _lastOnClickBackground = null; } }
private void ResetCloth() { if (_lastOnClickCloth != null && _lastOnClickCloth.IsGet == false) //把衣服切回原来的 { PresonBGTexture(_curRole.Apparel[0].ToString()); SendMessage(new Message(MessageConst.CMD_RELOADING_RESET_CLOTH_RED_FRAME, _curRole.Apparel[0])); _clothHint.gameObject.Hide(); _lastOnClickCloth = null; } }
public void SetData(ReloadingVO vo) { transform.Find("RedDot").gameObject.SetActive(vo.IsShowRedDot); transform.Find("PictononFrame").gameObject.SetActive(vo.IsPitchOn); transform.Find("Frame").gameObject.SetActive(!vo.IsPitchOn); transform.GetImage("Icon").sprite = ResourceManager.Load <Sprite>(vo.IconPath); transform.GetText("InfoText").text = vo.Name; transform.Find("Lock").gameObject.SetActive(!vo.IsGet); _data = vo; }
/// <summary> /// 点击预设物 /// </summary> private void OnReloadingItemClick(ReloadingVO vo) { switch (vo.ItemType) { case DressUpTypePB.TypeClothes: _cloth = vo; _model.UpdateListItemRedFrameShow(vo.ItemId, ReloadingListState.Clothing); View.ShowHint(vo, GlobalData.FavorabilityMainModel.CurrentRoleVo, _model); View.RefreshRedFrameShow(_model.GetList(ReloadingListState.Clothing), ReloadingListState.Clothing); break; case DressUpTypePB.TypeBackground: _background = vo; _model.UpdateListItemRedFrameShow(vo.ItemId, ReloadingListState.Backgroud); var path = _model.GetBgImagePath(vo.ItemId); View.ShowHint(vo, GlobalData.FavorabilityMainModel.CurrentRoleVo, _model, path); View.RefreshRedFrameShow(_model.GetList(ReloadingListState.Backgroud), ReloadingListState.Backgroud); break; } }
public void ShowHint(ReloadingVO vo, UserFavorabilityVo cur, ReloadingModel model, string bgImage = null) { _curRole = cur; _model = model; var clothHintTxt = _clothHint.GetText("Text"); if (vo.ItemType == DressUpTypePB.TypeClothes) { _lastOnClickCloth = vo; if (vo.IsGet == false) { _clothHint.gameObject.Show(); clothHintTxt.text = I18NManager.Get("Reloading_Hint1", vo.UnlockDesc); } else { _clothHint.gameObject.Hide(); clothHintTxt.text = ""; } PresonBGTexture(vo.ItemId.ToString()); } if (vo.ItemType == DressUpTypePB.TypeBackground) { _lastOnClickBackground = vo; if (vo.IsGet == false) { _clothHint.gameObject.Show(); clothHintTxt.text = I18NManager.Get("Reloading_Hint2", vo.UnlockDesc); } else { _clothHint.gameObject.Hide(); clothHintTxt.text = ""; } BGTexture(bgImage); } }