private static int iToolsNum;   // 工具个数

    void Awake()
    {
        Debug.Log("ListTools Awake");

        uiMgr = Singleton.GetInstance("UIMgr") as UIMgr;
        toolMgr = Singleton.GetInstance("ToolMgr") as ToolMgr;
    }
    void Awake()
    {
        //Managers
        itemsInfoMgr = Singleton.GetInstance("ItemsInfoMgr") as ItemsInfoMgr;
        toolMgr = Singleton.GetInstance("ToolMgr") as ToolMgr;

        PanelInit();
    }
    void Awake()
    {
        if (Instance != this)
        {
            Destroy(gameObject);
            Debug.Log("DestroyedObjectPersist");
        }
        else
        {
            DontDestroyOnLoad(gameObject);
        }

        audioMgr = GetComponent<AudioMgr>();
        itemsInfoMgr = GetComponent<ItemsInfoMgr>();
        networkMgr = GetComponent<NetworkMgr>();
        toolMgr = GetComponent<ToolMgr>();
        uiMgr = GetComponent<UIMgr>();
    }
    int[] m_iInputNum = new int[m_iMethodsNum];  //各Method的需求答案个数

    void Awake()
    {
        uiMgr = Singleton.GetInstance("UIMgr") as UIMgr;
        toolMgr = Singleton.GetInstance("ToolMgr") as ToolMgr;

        Methods[0] = transform.FindChild("Method00");

        m_iInputNum[0] = 1;

        for (int i = 0; i < m_iMethodsNum; i++)
        {
            Btns_Confirm[i] = Methods[i].GetComponentInChildren<Button>();

            int a = i;
            Btns_Confirm[i].onClick.AddListener(delegate ()
            {
                Confirm(a);
            });
        }
    }
    private static int iToolsNum;   //工具个数


    void Awake()
    {
        toolMgr = Singleton.GetInstance("ToolMgr") as ToolMgr;

        iToolsNum = toolMgr.list_Tools.Count;
        Panels_Tool = new Transform[iToolsNum];
        string strIndex;

        for (int i = 0; i < Panels_Tool.Length; i++)
        {
            //将序号转换为01,02...09,10的形式
            //用于按名字find Transform
            strIndex = i.ToString();
            if (i < 10)
                strIndex = "0" + strIndex;

            //Get Panel_Tool
            Panels_Tool[i] = transform.FindChild("Panel_Tool" + strIndex);
        }
    }
Пример #6
0
            public override void Process(CmdTrigger <C> trigger)
            {
                StringStream text = trigger.Text;

                if (!text.HasNext)
                {
                    trigger.Reply("Invalid arguments - " + this.CreateInfo(trigger));
                }
                else
                {
                    IExecutable executable1;
                    if (text.ConsumeNext('-'))
                    {
                        if (!text.HasNext)
                        {
                            trigger.Reply("Invalid arguments - " + this.CreateInfo(trigger));
                            return;
                        }

                        if (char.ToLower(text.Remainder[0]) == 'l')
                        {
                            ++text.Position;
                            string[] strArray = text.Remainder.Split(new char[1]
                            {
                                ' '
                            }, StringSplitOptions.RemoveEmptyEntries);
                            ToolMgr toolMgr = ((CommandMgr <C> .CallCommand) this.RootCmd).ToolMgr;
                            trigger.Reply("Callable functions ({0}):", (object)toolMgr.Executables.Count);
                            for (int index = 0; index < toolMgr.ExecutableList.Count; ++index)
                            {
                                IExecutable executable2 = toolMgr.ExecutableList[index];
                                if (strArray.Length != 0)
                                {
                                    bool flag = false;
                                    foreach (string str in strArray)
                                    {
                                        if (executable2.Name.IndexOf(str, StringComparison.InvariantCultureIgnoreCase) >
                                            -1)
                                        {
                                            flag = true;
                                            break;
                                        }
                                    }

                                    if (!flag)
                                    {
                                        continue;
                                    }
                                }

                                trigger.Reply(" {0}: {1}", (object)index, (object)executable2);
                            }

                            return;
                        }

                        uint num = text.NextUInt(uint.MaxValue);
                        executable1 = (long)num >= (long)this.ToolMgr.ExecutableList.Count
                            ? (IExecutable)null
                            : this.ToolMgr.ExecutableList[(int)num];
                    }
                    else
                    {
                        executable1 = this.ToolMgr.Get(text.NextWord());
                    }

                    if (executable1 == null)
                    {
                        trigger.Reply("Could not find specified Executable.");
                    }
                    else
                    {
                        int      length   = executable1.ParameterTypes.Length;
                        object[] objArray = new object[length];
                        object   obj      = (object)null;
                        for (int index = 0; index < length; ++index)
                        {
                            Type parameterType = executable1.ParameterTypes[index];
                            StringParser.Parse(index == length - 1 ? text.Remainder : text.NextWord(), parameterType,
                                               ref obj);
                            objArray[index] = obj;
                        }

                        executable1.Exec(objArray);
                    }
                }
            }
Пример #7
0
 public CallCommand(ToolMgr toolMgr)
 {
     this.ToolMgr = toolMgr;
 }
Пример #8
0
 /// <summary>
 /// Removes all Commands of the specific Type from the CommandsByAlias.
 /// </summary>
 /// <returns>True if any commands have been removed, otherwise false.</returns>
 public void AddDefaultCallCommand(ToolMgr mgr)
 {
     this.Add((Command <C>) new CommandMgr <C> .CallCommand(mgr));
 }
Пример #9
0
 public CallCommand(ToolMgr toolMgr)
 {
     ToolMgr = toolMgr;
 }
Пример #10
0
        /// <summary>
        /// Removes all Commands of the specific Type from the CommandsByAlias.
        /// </summary>
        /// <returns>True if any commands have been removed, otherwise false.</returns>
        //public static bool Remove(Type cmdType) {
        //    Command cmd = Get(cmdType);
        //    if (cmd != null) {
        //        Remove(cmd);
        //        return true;
        //    }
        //    return false;
        //}

        public void AddDefaultCallCommand(ToolMgr mgr)
        {
            Add(new CallCommand(mgr));
        }