Пример #1
0
        public static CommandHelperMessage New(string _primary, string _secondary, RectTransform ScrollZone, GameObject Prefab)
        {
            CommandHelperMessage message = CreateFromPool(ScrollZone, Prefab);

            message.Initialize(_primary, _secondary);

            return(message);
        }
Пример #2
0
        private void SetHierarchy(CommandHelperHierarchy hierarchy, string input)
        {
            ClearCommandsZone();

            if (hierarchy == CommandHelperHierarchy.Commands)
            {
                foreach (Command cmd in Manager.Commands.Methods.Values)
                {
                    if (cmd.Name.Contains(input) || input.Length < 2)
                    {
                        CommandHelperMessage message = CommandHelperMessage.New(cmd.Name, cmd.Description, CommandHelperWindow.ScrollZone, CommandHelperWindow.UIElementPrefab);
                        CommandsMessage.Add(message);
                    }
                }

                HighlightCommandHelper(0);
            }
            else if (hierarchy == CommandHelperHierarchy.Items)
            {
                foreach (RCDItem item in Manager.InternalItems.Items)
                {
                    CommandHelperMessage message = CommandHelperMessage.New(Manager.InternalItems.Items.IndexOf(item).ToString(), item.Obj.name, CommandHelperWindow.ScrollZone, CommandHelperWindow.UIElementPrefab);
                    CommandsMessage.Add(message);
                }

                HighlightCommandHelper(0);
            }
            else if (hierarchy == CommandHelperHierarchy.Behaviours)
            {
                foreach (RCDMethodsItem behaviour in CmdHelperStruct.obj.components.Values)
                {
                    CommandHelperMessage message = CommandHelperMessage.New(behaviour.nameBehaviour, behaviour.MethodLookup.Count.ToString(), CommandHelperWindow.ScrollZone, CommandHelperWindow.UIElementPrefab);
                    CommandsMessage.Add(message);
                }

                HighlightCommandHelper(0);
            }
            else if (hierarchy == CommandHelperHierarchy.Methods)
            {
                foreach (string method in CmdHelperStruct.behavior.MethodLookup.Keys)
                {
                    MethodInfo info = CmdHelperStruct.behavior.MethodLookup[method];

                    CommandHelperMessage message = CommandHelperMessage.New(method, info.GetParameters().Length.ToString(), CommandHelperWindow.ScrollZone, CommandHelperWindow.UIElementPrefab);
                    CommandsMessage.Add(message);
                }

                HighlightCommandHelper(0);
            }
            else if (hierarchy == CommandHelperHierarchy.Parameters)
            {
                Command cmd          = CmdHelperStruct.cmd;
                int     currentParam = CmdHelperStruct.currentParam;

                CommandsMessage.Add(CommandHelperMessage.New(cmd.GetParamName(currentParam),
                                                             "Type of " + cmd.GetParamType(currentParam).ToString(),
                                                             CommandHelperWindow.ScrollZone,
                                                             CommandHelperWindow.UIElementPrefab));

                SelectedCommmandHelperMessageID = -1;
            }
            else if (hierarchy == CommandHelperHierarchy.InvalidCommand)
            {
                CommandHelperMessage message = CommandHelperMessage.New("Invalid",
                                                                        CmdHelperStruct.InvalidCommandMessage,
                                                                        CommandHelperWindow.ScrollZone,
                                                                        CommandHelperWindow.UIElementPrefab);
                CommandsMessage.Add(message);

                SelectedCommmandHelperMessageID = -1;
            }
            else if (hierarchy == CommandHelperHierarchy.NoMoreParams)
            {
                CommandHelperMessage message = CommandHelperMessage.New("Stop",
                                                                        CmdHelperStruct.InvalidCommandMessage,
                                                                        CommandHelperWindow.ScrollZone,
                                                                        CommandHelperWindow.UIElementPrefab);
                CommandsMessage.Add(message);

                SelectedCommmandHelperMessageID = -1;
            }

            CommandHelperWindow.CalculateZone(CommandsMessage.Count);
        }