Controller.RegisterViewCommand C# (CSharp) Method

RegisterViewCommand() public method

public RegisterViewCommand ( IView view, string commandNames ) : void
view IView
commandNames string
return void
    public virtual void RegisterViewCommand(IView view, string[] commandNames)
    {
        lock (mSyncRoot)
        {
            if (mViewCmdMap.ContainsKey(view))
            {
                List<string> list = null;
                if (mViewCmdMap.TryGetValue(view, out list))
                {
                    for (int i = 0; i < commandNames.Length; i++)
                    {
                        if (list.Contains(commandNames[i])) continue;
                        list.Add(commandNames[i]);
                    }
                }
            }
            else
            {
                mViewCmdMap.Add(view, new List<string>(commandNames));
            }
        }
    }

Usage Example

Esempio n. 1
0
 static int RegisterViewCommand(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         Controller obj  = (Controller)ToLua.CheckObject <Controller>(L, 1);
         IView      arg0 = (IView)ToLua.CheckObject <IView>(L, 2);
         string[]   arg1 = ToLua.CheckStringArray(L, 3);
         obj.RegisterViewCommand(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }