Example #1
0
        // CREATE CONTAINERS
        private void CreateContainers()
        {
            // CREATE OVERVIEW PANEL
            OverviewContainer = new OverviewContainer();
            Controls.Add(OverviewContainer);

            // CREATE SCRIPT PANEL
            ScriptContainer = new ScriptContainer
            {
                Visible = false
            };
            Controls.Add(ScriptContainer);

            // CREATE SETTINGS PANEL
            SettingsContainer = new SettingsContainer
            {
                Visible = false
            };
            Controls.Add(SettingsContainer);

            // CREATE ACTIONS PANEL
            ActionsContainer = new ActionsContainer
            {
                Visible = false
            };
            Controls.Add(ActionsContainer);

            // CREATE EFFICIENCY PANEL
            EfficiencyContainer = new EfficiencyContainer
            {
                Visible = false
            };
            Controls.Add(EfficiencyContainer);
        }
Example #2
0
 private void ReadActions(IEnumerable <XmlNode> nodes, ActionsContainer container, int index = -1)
 {
     foreach (var action in ReadActions(nodes, index))
     {
         container.AddAction(action);
     }
 }
Example #3
0
        private void Clear()
        {
            actionsContainer = new ActionsContainer();
            ContainerWrapper = new List <ActionContainerWrapper>();
            foreach (var item in actionsContainer.Actions)
            {
                ContainerWrapper.Add(new ActionContainerWrapper(actionsContainer, item.Key));
            }

            Grammar   = "";
            InputData = "";
            Result    = "";
            Splitter  = "";
            Or        = "";
            Range     = "";
            Empty     = "";

            OnPropertyChanged(nameof(Grammar));
            OnPropertyChanged(nameof(InputData));
            OnPropertyChanged(nameof(Result));
            OnPropertyChanged(nameof(Splitter));
            OnPropertyChanged(nameof(Or));
            OnPropertyChanged(nameof(Range));
            OnPropertyChanged(nameof(Empty));
            OnPropertyChanged(nameof(ContainerWrapper));
        }
        private void Init(IColorPreset colorPreset)
        {
            Color = colorPreset.DarkBackground;

            menuHolder = CreateChild <MenuHolder>("menu", 0);
            {
                menuHolder.Anchor   = AnchorType.TopStretch;
                menuHolder.Pivot    = PivotType.Top;
                menuHolder.RawWidth = 0f;
                menuHolder.Y        = 0f;
                menuHolder.Height   = 56f;
            }
            versionDisplay = CreateChild <VersionDisplay>("version", 1);
            {
                versionDisplay.Anchor   = AnchorType.TopStretch;
                versionDisplay.Pivot    = PivotType.Top;
                versionDisplay.RawWidth = 0f;
                versionDisplay.Y        = -56f;
                versionDisplay.Height   = 72f;
            }
            contentScroll = CreateChild <UguiScrollView>("content", 2);
            {
                contentScroll.Anchor = AnchorType.Fill;
                contentScroll.Offset = new Offset(0f, 128f, 0f, 0f);

                contentScroll.Background.Alpha = 0f;

                metaContainer = contentScroll.Container.CreateChild <MetaContainer>("meta");
                {
                    metaContainer.Anchor = AnchorType.TopStretch;
                    metaContainer.Pivot  = PivotType.Top;
                    metaContainer.Y      = -32f;
                    metaContainer.Height = 360f;
                    metaContainer.SetOffsetHorizontal(64f);
                }
                rankingContainer = contentScroll.Container.CreateChild <RankingContainer>("ranking");
                {
                    rankingContainer.Anchor = AnchorType.TopStretch;
                    rankingContainer.Pivot  = PivotType.Top;
                    rankingContainer.Y      = -424f;
                    rankingContainer.Height = 360f;
                    rankingContainer.SetOffsetHorizontal(64f);
                }
                actionsContainer = contentScroll.Container.CreateChild <ActionsContainer>("actions");
                {
                    actionsContainer.Anchor = AnchorType.TopStretch;
                    actionsContainer.Pivot  = PivotType.Top;
                    actionsContainer.Y      = -816f;
                    actionsContainer.Height = 48f;
                    actionsContainer.SetOffsetHorizontal(64f);
                }

                // Calculate height of the scrollview content.
                contentScroll.Container.Height = GetContentHeight();
            }
        }
Example #5
0
        //private void ReadIfAction(IfAcion ifAction)
        //{

        //}

        private static IfAcion ReadIfAction(FSMXmlReader reader)
        {
            IfAcion ifAction = new IfAcion();
            var     node     = reader.CurrentNode;
            var     condNode = node.SelectSingleNode("s:cond", reader.nsmgr);

            if (condNode != null)
            {
                reader.ReadStartNode(condNode);
                ifAction.Cond = reader.ReadFirstChildExpression();
                reader.ReadEndNode();
            }
            var thenNode = node.SelectSingleNode("s:then", reader.nsmgr);

            if (thenNode != null)
            {
                reader.ReadStartNode(thenNode);
                reader.ReadActions(reader.FilterChildNodeType(), ifAction);
                reader.ReadEndNode();
            }


            //ReadIfAction(ifAction);

            foreach (XmlNode elseIfNode in node.SelectNodes("s:elseIf", reader.nsmgr))
            {
                reader.ReadStartNode(elseIfNode);
                //IfAcion elseIfAction = new IfAcion();
                //ReadIfAction(elseIfAction);
                IfAcion elseIfAction = ReadIfAction(reader);
                ifAction.AddElseIf(elseIfAction);
                reader.ReadEndNode();
            }
            var elseNode = node.SelectSingleNode("s:else", reader.nsmgr);

            if (elseNode != null)
            {
                reader.ReadStartNode(elseNode);
                ActionsContainer elseAction = new ActionsContainer();
                reader.ReadActions(reader.FilterChildNodeType(), elseAction);
                ifAction.Else = elseAction;
                reader.ReadEndNode();
            }
            return(ifAction);
        }
        /// <summary>
        /// Unsubscribe this gameobject from the action system
        /// </summary>
        /// <param name="gameObject"></param>
        private void UnsubscribeFromActions(GameObject gameObject)
        {
            // @TODO: Why is this an issue?
            if (gameObject == null)
            {
                return;
            }

            if (StratusActions.debug)
            {
                StratusDebug.Log("'" + gameObject.name + "'");
            }

            ActionsContainer container = this.actionsOwnerMap[gameObject];

            this.activeActions.Remove(container);
            this.actionsOwnerMap.Remove(gameObject);
        }
        /// <summary>
        /// Subscribes this gameobject to the action space
        /// </summary>
        /// <param name="gameObject"></param>
        /// <returns></returns>
        private StratusActionDriver SubscribeToActions(GameObject gameObject)
        {
            if (this.actionsOwnerMap.ContainsKey(gameObject))
            {
                return(this.actionsOwnerMap[gameObject].owner);
            }

            if (StratusActions.debug)
            {
                StratusDebug.Log("Adding the GameObject to the ActionSpace");
            }

            StratusActionDriver owner     = new StratusActionDriver(gameObject);
            ActionsContainer    container = new ActionsContainer(gameObject, owner);

            this.activeActions.Add(container);
            this.actionsOwnerMap.Add(gameObject, container);
            gameObject.GetOrAddComponent <StratusActionsRegistration>();
            return(owner);
        }
Example #8
0
 public ActionContainerWrapper(ActionsContainer container, string Key)
 {
     this.container = container;
     this.name      = Key;
     Description    = container.Actions.Where(a => a.Key == Key).Select(a => a.Description).First();
 }