public bool CheckTopWnd(WndBase Wnd) { if (Wnd == null) { return(false); } WndType wndtype = Wnd.GetWndType(); if (wndtype == WndType.DialogWnd || wndtype == WndType.MenuWnd) { return(true); } if (tParentDialog.childCount > 0) { return(false); } if (tParentWnd.childCount == 0) { return(false); } else if (tParentWnd.GetChild(tParentWnd.childCount - 1) == Wnd.transform) { return(true); } else { return(false); } }
// Use this for initialization public override void WndStart() { base.WndStart(); m_wndType = WndType.ShuXing; //开启向上顶模式 MyHead.HudText.bTopRank = true; RegisterHooks(); DoWndEffect(); MyHead.BtnGetSoulStone.OnClickEventHandler += BtnGetSoulStone_OnClickEventHandler; MyHead.BtnReturn.OnClickEventHandler += BtnClose_OnClickEventHandler; MyHead.BtnClickTrap.OnClickEventHandler += BtnClickTrap_OnClickEventHandler; MyHead.BtnShengJi.OnClickEventHandler += BtnShengJi_OnClickEventHandler; MyHead.BtnShengXing.OnClickEventHandler += BtnShengXing_OnClickEventHandler; MyHead.BtnPre.OnClickEventHandler += BtnPre_OnClickEventHandler; MyHead.BtnNext.OnClickEventHandler += BtnNext_OnClickEventHandler; MyHead.BtnChaiJie.OnClickEventHandler += BtnChaiJie_OnClickEventHandler; MyHead.BtnShuXing.bColorChange = false; MyHead.BtnShengJie.bColorChange = false; MyHead.BtnTuJian.bColorChange = false; EventDelegate.Add(MyHead.BtnShuXing.onChange, TogShuXing_OnValueChange); EventDelegate.Add(MyHead.BtnShengJie.onChange, TogShengJie_OnValueChange); EventDelegate.Add(MyHead.BtnTuJian.onChange, TogTuJian_OnValueChange); }
// 获取UI 挂取结点 public static Transform GetWndParent(WndType wndType) { if (null == g_uiNode) { return(null); } return(g_uiNode.GetWndParent(wndType)); }
public static void ShowContentWindow(string description, InstanceValue inst, WndType wndType) { lock (_lock) { var list = _unlockledWindows[(int)wndType]; if (list.Count > 0) { var node = list.First; list.RemoveFirst(); list.AddLast(node); node.Value.UpdateInstanceValue(inst, description); return; } int id = Utils.GetNewID(); IValueWindow wnd = null; switch (wndType) { case WndType.Content: wnd = new ContentDisplay(id, description != null ? description : inst.GetDescription(), inst) { Owner = GuiUtils.MainWindowInstance }; break; case WndType.Tree: wnd = new ClassStructDisplay(id, inst.GetDescription(), inst) { Owner = GuiUtils.MainWindowInstance }; break; case WndType.List: wnd = new CollectionDisplay(id, inst.GetDescription(), inst) { Owner = GuiUtils.MainWindowInstance }; break; case WndType.KeyValues: wnd = new KeyValueCollectionDisplay(id, inst.GetDescription(), inst) { Owner = GuiUtils.MainWindowInstance }; break; } if (wnd == null) { throw new MdrDeskException("[ValueWindows.ShowContentWindow] Creating content window failed."); } _wndDct.Add(id, wnd); if (!wnd.Locked) { list.AddFirst(wnd); } ((Window)wnd).Show(); } }
void CheckHighLight(WndType mode) { int Idx = (int)m_ShowWndType + 1; m_TopBtnObj[Idx].m_UISprite.spriteName = GetSpriteName(m_ShowWndType, 1); m_ShowWndType = mode; Idx = (int)mode + 1; m_TopBtnObj[Idx].m_UISprite.spriteName = GetSpriteName(m_ShowWndType, 2); }
/// <summary> /// 技能 /// </summary> public void TogShengJie_OnValueChange() { if (!MyHead.BtnShengJie.value) { return; } bool change = m_wndType != WndType.ShengJie; m_wndType = WndType.ShengJie; AddDetailInfo(m_Info, m_wndType); }
public static void ChangeMyLock(int id, WndType wndType, bool lockme) { lock (_lock) { if (lockme) { RemoveFromUnlocked(id, wndType); } else { AddToUnlocked(id, wndType); } } }
// <summary> // 根据类型获取窗口挂靠节点 // </summary> // <returns></returns> public Transform GetWndParent(WndType type) { if (type == WndType.MenuWnd) { return(tParentMenu); } else if (type == WndType.DialogWnd) { return(tParentDialog); } else { return(tParentWnd); } }
public void UpdateWarningState(WndType type) { m_Warning[0].SetActive((PlayerRole.Instance.RoleChar.GetCharList() != null && PlayerRole.Instance.RoleChar.GetCharList().Count > 0) || PlayerRole.Instance.RoleStatesMessage.GetRelationStates()); m_Warning[1].SetActive(PlayerRole.Instance.RoleStatesMessage.GetMailStates() || PlayerRole.Instance.RoleStatesMessage.GetGiffStates()); m_FriendWndUI.UpdateWarningState(); m_EmailWndUI.UpdateWarrningSate(); //if (type == WndType.Emanil_Wnd) //{ // m_Warning[1].SetActive(PlayerRole.Instance.RoleStatesMessage.GetMailStates()); //} //else if (type == WndType.Present_Wnd) //{ // m_Warning[2].SetActive(PlayerRole.Instance.RoleStatesMessage.GetGiffStates()); //} //m_EmailWndUI.UpdateWarrningSate(); }
void ShowChildWnd(WndType type, bool bshow) { switch (type) { case WndType.Friend_Wnd: m_FriendWndUI.ShowWnd(bshow); break; case WndType.Emanil_Wnd: m_EmailWndUI.ShowWnd(bshow); break; case WndType.Present_Wnd: // m_PresentWndUI.ShowWnd(bshow); break; } }
/// <summary> /// 添加属性,升阶,图鉴 /// </summary> /// <param name="Info">Info.</param> /// <param name="wndType">Window type.</param> private void AddDetailInfo(BuildInfo Info, WndType wndType) { if (wndType == WndType.ShuXing) { WndManager.DestoryDialog <TrapShengJieIntroduceWnd>(); TrapShuXingIntroduceWnd wnd = WndManager.FindDialog <TrapShuXingIntroduceWnd>(); if (wnd == null) { wnd = WndManager.GetDialog <TrapShuXingIntroduceWnd>(); wnd.transform.parent = MyHead.SprTrapIntorduct.transform; wnd.transform.localScale = MyHead.SprTrapIntorduct.transform.localScale; wnd.transform.localPosition = Vector3.zero; wnd.transform.localRotation = MyHead.SprTrapIntorduct.transform.localRotation; } if (wnd != null) { wnd.SetBuildInfo(Info); } } else if (wndType == WndType.ShengJie) { WndManager.DestoryDialog <TrapShuXingIntroduceWnd>(); TrapShengJieIntroduceWnd wnd = WndManager.FindDialog <TrapShengJieIntroduceWnd>(); if (wnd == null) { wnd = WndManager.GetDialog <TrapShengJieIntroduceWnd>(); wnd.transform.parent = MyHead.SprTrapIntorduct.transform; wnd.transform.localScale = MyHead.SprTrapIntorduct.transform.localScale; wnd.transform.localPosition = Vector3.zero; wnd.transform.localRotation = MyHead.SprTrapIntorduct.transform.localRotation; } if (wnd != null) { wnd.SetBuildInfo(Info, this); } } else if (wndType == WndType.TuJian) { WndManager.DestoryDialog <TrapShuXingIntroduceWnd>(); WndManager.DestoryDialog <TrapShengJieIntroduceWnd>(); } }
string GetSpriteName(WndType mode, int state) { string str = string.Format(""); switch (mode) { case WndType.Friend_Wnd: str = string.Format("Friend_Btn0{0}", state); return(str); case WndType.Emanil_Wnd: str = string.Format("Email_Btn0{0}", state); return(str); case WndType.Present_Wnd: str = string.Format("Present_Btn0{0}", state); return(str); } return(null); }
public static void RemoveFromUnlocked(int id, WndType wndType) { lock (_lock) { var list = _unlockledWindows[(int)wndType]; if (list.Count < 1) { return; } var node = list.First; while (node != null) { if (node.Value.Id == id) { list.Remove(node); break; } node = node.Next; } } }
//如果不是特别“重”的常用窗口,尽量IsCache = false, 后台会帮你保留 public static bool CreateWnd <T>(WndType wndtype, bool IsCache, bool async, WndCreateHook pfun) where T : WndBase { bool ret = false; string WndName = typeof(T).ToString(); Transform parent = WndManager.GetWndParent(wndtype); // 已经存在 T wnd = FindWnd <T>(); if (wnd != null) { SetWndTop(wnd); //show the wnd wnd.ShowWnd(true); if (pfun != null) { pfun(wnd); } return(true); } // 不存在则创建了。 ResourceManger.LoadWnd(WndName, parent, IsCache, async, (g) => { if (g != null) { wnd = g.GetComponent <T> (); wnd.SetWndType(wndtype); AddWnd(wnd); if (pfun != null) { pfun(wnd); } ret = true; } }); return(ret); }
private static void AddToUnlocked(int id, WndType wndType) { IValueWindow wnd; if (_wndDct.TryGetValue(id, out wnd)) { var list = _unlockledWindows[(int)wndType]; if (list.Count < 1) { list.AddFirst(wnd); return; } var node = list.First; while (node != null) { if (node.Value.Id == id) { return; } node = node.Next; } list.AddFirst(wnd); } }
// <summary> // 获取窗口类型 // </summary> public virtual void SetWndType(WndType wndType) { m_WndType = wndType; }
public void SetData(WndType type = WndType.PackgeShow) { m_iWndType = type; SetUI(); }
public FriendSysMgr() { m_ShowWndType = WndType.Friend_Wnd; }