Example #1
0
 static int UF_set_ui(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         bool           ret    = false;
         IUIUpdateGroup target = (IUIUpdateGroup)ToLua.CheckObject(L, 1, typeof(IUIUpdateGroup));
         if (target != null)
         {
             string    key = LuaDLL.lua_tostring(L, 2);
             IUIUpdate ui  = target.UF_GetUI(key);
             if (ui != null)
             {
                 ret = true;
                 //判断是否真实是bool 值,去除nil
                 if (LuaDLL.lua_isrboolean(L, 3))
                 {
                     bool active = LuaDLL.lua_toboolean(L, 3);
                     ui.UF_SetActive(active);
                 }
                 else
                 {
                     object value = ToLua.ToVarObject(L, 3);
                     ui.UF_SetValue(value);
                 }
             }
         }
         LuaDLL.lua_pushboolean(L, ret);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #2
0
        public bool UF_SetKActive(string key, bool value)
        {
            IUIUpdate ui = this.UF_GetUI(key) as IUIUpdate;

            if (ui != null)
            {
                ui.UF_SetActive(value);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
 public void UF_Switch(string key)
 {
     if (m_SourceCount == 0)
     {
         m_SourceCount = m_Targets.Count;
     }
     if (m_Targets != null && m_Targets.Count > 0)
     {
         IUIUpdate handle = null;
         foreach (MonoBehaviour target in m_Targets)
         {
             if (target != null)
             {
                 handle = target as IUIUpdate;
                 if (handle != null)
                 {
                     handle.UF_SetActive(handle.updateKey == key);
                 }
             }
         }
     }
 }