Exemplo n.º 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));
     }
 }
Exemplo n.º 2
0
        public bool UF_SetKValue(string key, object value)
        {
            IUIUpdate ui = this.UF_GetUI(key) as IUIUpdate;

            if (ui != null)
            {
                ui.UF_SetValue(value);
                return(true);
            }
            else
            {
                return(false);
            }
        }