Example #1
0
 public IUIUpdate UF_GetDynamicUI(string key)
 {
     if (MapDynamicUI.ContainsKey(key))
     {
         return(MapDynamicUI [key]);
     }
     return(null);
 }
Example #2
0
        public IUIUpdate UF_GetUI(string key)
        {
            if (MapStaticUI.ContainsKey(key))
            {
                return(MapStaticUI [key]);
            }
            else if (MapDynamicUI.ContainsKey(key))
            {
                return(MapDynamicUI [key]);
            }
//			#if UNITY_EDITOR
//			Debugger.UF_Warn (string.Format("Group[{0}] UF_GetUI[{1}] is Null",this.name,key));
//			#endif
            return(null);
        }
Example #3
0
 //只能移除动态类型
 public virtual void UF_RemoveUI(string key)
 {
     if (MapDynamicUI.ContainsKey(key))
     {
         IUIUpdate ui = MapDynamicUI [key];
         if (ui is IReleasable)
         {
             (ui as IReleasable).Release();
         }
         else if (ui is IOnReset)
         {
             (ui as IOnReset).UF_OnReset();
         }
         MapDynamicUI.Remove(key);
     }
 }
Example #4
0
        //只能更改动态加入的UI UpdateKey
        public bool UF_ChangeUIUpdateKey(string source, string target)
        {
            IUIUpdate ui = this.UF_GetDynamicUI(source);

            if (ui == null)
            {
                Debugger.UF_Warn(string.Format("Change UI UpdateKey Failed,Can not find UI[{0}] in Dynamic", source ?? ""));
                return(false);
            }
            else if (MapDynamicUI.ContainsKey(target))
            {
                Debugger.UF_Warn(string.Format("Change UI UpdateKey Failed,Same UI UpdateKey{0}] Has Exist", target ?? ""));
                return(false);
            }
            ui.updateKey = target;
            //移除原有Key
            MapDynamicUI.Remove(source);
            //添加新key
            MapDynamicUI.Add(target, ui);
            return(true);
        }
Example #5
0
 public virtual void UF_AddUI(IUIUpdate ui, bool firstSibling)
 {
     if (ui != null)
     {
         if (!string.IsNullOrEmpty(ui.updateKey) && !MapDynamicUI.ContainsKey(ui.updateKey))
         {
             MapDynamicUI.Add(ui.updateKey, ui);
         }
         else
         {
             //如果没有或有重复UpdateKey ,则使用InstanceID 来代替
             int insID = ((Object)ui).GetInstanceID();
             MapDynamicUI.Add(insID.ToString(), ui);
             Debugger.UF_Warn(string.Format("UI Update Key[{0}] Is Same Or Empty,Map With Instance ID:{1}", ui.updateKey ?? "", insID));
         }
         GameObject uiobject = (ui as MonoBehaviour).gameObject;
         uiobject.transform.SetParent(this.transform, false);
         uiobject.transform.localScale = Vector3.one;
         if (firstSibling)
         {
             uiobject.transform.SetAsFirstSibling();
         }
     }
 }
Example #6
0
 public bool UF_CheckDynamicUI(string key)
 {
     return(MapDynamicUI.ContainsKey(key));
 }