private void MenuItem7_Click(object sender, EventArgs e)
        {
            IEnumerator enumerator = null;

            Transition.Transition transition      = new Transition.Transition();
            TransitionTable       transitionTable = new TransitionTable();

            if (this.Select_Group_A != null)
            {
                if (this.Select_Group_B != null)
                {
                    if (ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null), false) != 0)
                    {
                        #region Label Formatting

                        //Edit The '↔' To Change How You Want Your Labels To Look
                        //Original 'To' Was The Transition Keyword For The Labels
                        //This Keyword Was Changed To Arrows To Show The Back And Forth Between Transitions
                        string str = string.Format("{0} ↔ {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null)));

                        #endregion

                        string      str1        = string.Format("{0}Data\\Engine\\Templates\\2Way_Template.xml", AppDomain.CurrentDomain.BaseDirectory);
                        XmlDocument xmlDocument = new XmlDocument();
                        transitionTable.Clear();
                        try
                        {
                            xmlDocument.Load(str1);
                            try
                            {
                                enumerator = xmlDocument.SelectNodes("//Wizard/Tile").GetEnumerator();
                                while (enumerator.MoveNext())
                                {
                                    XmlElement            current     = (XmlElement)enumerator.Current;
                                    string                attribute   = current.GetAttribute("Pattern");
                                    string                attribute1  = current.GetAttribute("MapTile");
                                    string                attribute2  = current.GetAttribute("StaticTile");
                                    Transition.Transition transition1 = new Transition.Transition(str, attribute, (ClsTerrain)this.Select_Group_A.SelectedItem, (ClsTerrain)this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute1), this.Get_StaticTiles(attribute2));
                                    transitionTable.Add(transition1);
                                }
                            }
                            finally
                            {
                                if (enumerator is IDisposable)
                                {
                                    ((IDisposable)enumerator).Dispose();
                                }
                            }
                        }
                        catch (Exception exception)
                        {
                            ProjectData.SetProjectError(exception);
                            Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
                            ProjectData.ClearProjectError();
                        }
                        transitionTable.Save(string.Format("{0}.xml", str));
                    }
                }
            }
        }
Example #2
0
        public void Valid(T from, T to)
        {
            if (from.Equals(to))
            {
                return;
            }

            transitionTable.Add(from, to);
        }
        public void AddTransition(S initial_state, S end_state, StateHandler call)
        {
            StateTransition <S> temp_transition = new StateTransition <S>(initial_state, end_state);

            if (TransitionTable.ContainsKey(temp_transition))
            {
                return;
            }

            TransitionTable.Add(temp_transition, call);
        }
        //Save
        private void MenuItem7_Click(object sender, EventArgs e)
        {
            IEnumerator enumerator = null;

            Transition.Transition transition      = new Transition.Transition();
            TransitionTable       transitionTable = new TransitionTable();

            if (this.Select_Group_A != null)
            {
                if (this.Select_Group_B != null)
                {
                    if (ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null), false) != 0)
                    {
                        string      str         = string.Format("{0} To {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null)));
                        string      str1        = string.Format("{0}Data\\System\\2Way_Template.xml", AppDomain.CurrentDomain.BaseDirectory);
                        XmlDocument xmlDocument = new XmlDocument();
                        transitionTable.Clear();
                        try
                        {
                            xmlDocument.Load(str1);
                            try
                            {
                                enumerator = xmlDocument.SelectNodes("//Wizard/Tile").GetEnumerator();
                                while (enumerator.MoveNext())
                                {
                                    XmlElement            current     = (XmlElement)enumerator.Current;
                                    string                attribute   = current.GetAttribute("Pattern");
                                    string                attribute1  = current.GetAttribute("MapTile");
                                    string                attribute2  = current.GetAttribute("StaticTile");
                                    Transition.Transition transition1 = new Transition.Transition(str, attribute, (ClsTerrain)this.Select_Group_A.SelectedItem, (ClsTerrain)this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute1), this.Get_StaticTiles(attribute2));
                                    transitionTable.Add(transition1);
                                }
                            }
                            finally
                            {
                                if (enumerator is IDisposable)
                                {
                                    ((IDisposable)enumerator).Dispose();
                                }
                            }
                        }
                        catch (Exception exception)
                        {
                            ProjectData.SetProjectError(exception);
                            Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
                            ProjectData.ClearProjectError();
                        }
                        transitionTable.Save(string.Format("{0}.xml", str));
                    }
                }
            }
        }
Example #5
0
 public void InitTransitionTable(StateAdapter adapter)
 {
     TransitionTable.Add(Inventory.API.Messages.CLOSE_LOOT_MENU, adapter._riffleState);
 }
Example #6
0
 public void InitTransitionTable(StateAdapter adapter)
 {
     TransitionTable.Add(Inventory.API.Messages.WANT_OPEN_LOOT_MENU, adapter._lootMenuState);
 }