public SetFieldValue(navigation nav, List <GameData.Item> items)
 {
     this.InitializeComponent();
     this.items = items;
     this.nav   = nav;
     this.updateFieldList();
 }
        public dialogCollection(GameData.Item item, navigation n)
        {
            this.InitializeComponent();
            this.Item = item;
            this.nav  = n;
            this.referenceList1.Exclusions.Add("dialogs");
            this.referenceList1.setup(this.Item, this.nav);
            this.objectPropertyBox1.setup(null, this.nav);
            this.objectPropertyBox1.grid.OnPropertyChanged += new PropertyGrid.PropertyGrid.PropertyChangedHandler(this.grid_OnPropertyChanged);
            this.packageName.Text = this.Item.Name;
            bool state = this.Item.getState() != GameData.State.LOCKED;

            this.packageName.Enabled   = state;
            this.addNew.Enabled        = state;
            this.addItem.Enabled       = state;
            this.removeItem.Enabled    = state;
            this.buttonAddItem.Enabled = state;
            this.buttonAddNew.Enabled  = state;
            this.SelectedEvent         = EventTriggerEnum.EV_I_SEE_NEUTRAL_SQUAD;
            this.eventsList.Items.Clear();
            foreach (EventTriggerEnum value in Enum.GetValues(typeof(EventTriggerEnum)))
            {
                if (value == EventTriggerEnum.EV_NONE || value == EventTriggerEnum.EV_MAX)
                {
                    continue;
                }
                this.eventsList.Items.Add(value.ToString());
            }
            this.conditionControl1.setup(null, this.nav);
            this.refresh();
        }
Beispiel #3
0
        public diplomat(GameData.Item item, navigation n)
        {
            this.InitializeComponent();
            this.Item = item;
            this.ou   = n.ou;
            this.nav  = n;
            this.conditionControl1.setup(item, this.nav);
            this.propertyList.setup(null, this.nav);
            this.referenceList.setup(null, this.nav);
            this.referenceList.Exclusions.Add("conditions");
            this.propertyList.grid.OnPropertyChanged += new PropertyGrid.PropertyGrid.PropertyChangedHandler(this.grid_OnPropertyChanged);
            this.nameBox.Text = this.Item.Name;
            bool state = item.getState() != GameData.State.LOCKED;

            this.nameBox.Enabled       = state;
            this.addAssault.Enabled    = state;
            this.removeAssault.Enabled = state;
            this.assaultList.Items.Clear();
            foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in this.Item.referenceData("assaults", false))
            {
                GameData.Item item1 = this.ou.gameData.getItem(keyValuePair.Key);
                this.assaultList.Items.Add(item1);
            }
            this.assaultList.Refresh();
        }
Beispiel #4
0
 public OgreSceneImporter(GameData.Item item, navigation nav)
 {
     this.InitializeComponent();
     this.Item            = item;
     this.nav             = nav;
     this.bImport.Enabled = false;
 }
Beispiel #5
0
 public InstanceDialog(GameData.Item item, string inst, itemType mask, navigation nav)
 {
     this.InitializeComponent();
     this.nav = nav;
     this.grid.OnPropertyChanged += new PropertyGrid.PropertyGrid.PropertyChangedHandler(this.grid_OnPropertyChanged);
     this.grid.MouseDoubleClick  += new MouseEventHandler(this.grid_MouseDoubleClick);
     this.refresh(item, inst, mask);
 }
Beispiel #6
0
 public TranslationDialog(navigation nav, NavigationTranslation navTranslation)
 {
     this.nav            = nav;
     this.navTranslation = navTranslation;
     this.InitializeComponent();
     base.CenterToScreen();
     this.Calculate();
 }
 private void bOk_Click(object sender, EventArgs e)
 {
     this.Items = this.listView1.SelectedItems;
     if (this.Items.Count > 0 && this.Items[0] == this.NewItem)
     {
         navigation nav = this.getNav();
         this.Items[0] = nav.ou.gameData.createItem(this.NewItem.type);
     }
 }
 public itemproperties(GameData.Item itm, navigation n)
 {
     this.InitializeComponent();
     base.MdiParent = n.MdiParent;
     this.Item      = itm;
     this.nav       = n;
     this.Text      = this.Item.Name;
     this.propertyList.setCustomDescriptionControls(this.selected, this.description);
     this.init();
 }
Beispiel #9
0
        public MergeDialog(GameData gameData, navigation nav)
        {
            int i;

            this.gameData = gameData;
            this.InitializeComponent();
            base.ShowIcon          = true;
            base.Icon              = System.Drawing.Icon.FromHandle(Resources.Merge_24x.GetHicon());
            this.tree.ItemChecked += new ChangeListTree.ItemCheckedEventHandler(this.Tree_ItemChecked);
            if (nav.FileMode != navigation.ModFileMode.SINGLE && !TranslationManager.TranslationMode)
            {
                if (nav.BasePath != null)
                {
                    FileInfo[] files = (new DirectoryInfo(nav.BasePath)).GetFiles("*.mod");
                    for (i = 0; i < (int)files.Length; i++)
                    {
                        FileInfo fileInfo = files[i];
                        this.modBox.Items.Add(new MergeDialog.ModListItem(fileInfo.Name, fileInfo.FullName));
                    }
                }
                if (nav.RootPath != null)
                {
                    DirectoryInfo[] directories = (new DirectoryInfo(string.Concat(nav.RootPath, "\\mods"))).GetDirectories();
                    for (i = 0; i < (int)directories.Length; i++)
                    {
                        DirectoryInfo directoryInfo = directories[i];
                        FileInfo      fileInfo1     = new FileInfo(string.Concat(directoryInfo.FullName, "\\", directoryInfo.Name, ".mod"));
                        if (fileInfo1.Exists)
                        {
                            this.modBox.Items.Add(new MergeDialog.ModListItem(fileInfo1.Name, fileInfo1.FullName));
                        }
                    }
                }
            }
            this.tempData = new GameData();
            this.Cursor   = Cursors.WaitCursor;
            foreach (GameData.Item value in gameData.items.Values)
            {
                if (value.getState() == GameData.State.LOCKED)
                {
                    continue;
                }
                this.tempData.items.Add(value.stringID, value.createFlatCopy());
            }
            foreach (GameData.Item item in this.tempData.items.Values)
            {
                item.resolveReferences(this.tempData);
            }
            this.Cursor              = Cursors.Default;
            this.tree.GameData       = this.tempData;
            this.tree.CheckBoxes     = true;
            this.mergeButton.Enabled = false;
            this.leveldata.Visible   = nav.FileMode != navigation.ModFileMode.SINGLE;
            this.leveldata.Enabled   = false;
        }
Beispiel #10
0
 public ChangeList(navigation nav)
 {
     this.InitializeComponent();
     base.ShowIcon               = true;
     base.Icon                   = System.Drawing.Icon.FromHandle(Resources.ChangesetGroup_16x.GetHicon());
     this.nav                    = nav;
     this.gameData               = nav.ou.gameData;
     base.Activated             += new EventHandler(this.ChangeList_Activated);
     this.tree.MouseDoubleClick += new MouseEventHandler(this.Tree_MouseDoubleClick);
     this.tree.GameData          = this.gameData;
 }
Beispiel #11
0
 public ToDo(Form parent, navigation nav)
 {
     base.MdiParent = parent;
     this.nav       = nav;
     this.InitializeComponent();
     this.listView.ListViewItemSorter = new ToDo.ItemComparer();
     this.listView.EnableDoubleBuferring();
     this.assignList = new List <string>()
     {
         "-"
     };
 }
Beispiel #12
0
 public AssetList(navigation nav)
 {
     this.InitializeComponent();
     base.ShowIcon = true;
     base.Icon     = System.Drawing.Icon.FromHandle(Resources.AppRoot_16x.GetHicon());
     this.nav      = nav;
     this.view.RetrieveVirtualItem += new RetrieveVirtualItemEventHandler(this.view_RetrieveVirtualItem);
     this.view.CacheVirtualItems   += new CacheVirtualItemsEventHandler(this.view_CacheVirtualItems);
     this.view.VirtualMode          = true;
     this.Assets = new List <AssetList.Asset>();
     this.refreshList();
 }
        protected void openItem_Click(object sender, EventArgs e)
        {
            navigation nav = this.getNav();

            foreach (GameData.Item selectedItem in this.listView1.SelectedItems)
            {
                if (selectedItem == this.NewItem)
                {
                    continue;
                }
                nav.showItemProperties(selectedItem);
            }
        }
        private static void parseLayout(StreamReader r, navigation nav)
        {
            nav.clearCategories();
            Stack <Tuple <string, int> > tuples = new Stack <Tuple <string, int> >();

            while (!r.EndOfStream && r.Peek() != 91)
            {
                string str = Definitions.readLine(r);
                int    num = str.IndexOf("//");
                if (num >= 0)
                {
                    str.Remove(num);
                }
                int length = str.TrimStart(new char[0]).Length - str.Length;
                if (string.IsNullOrWhiteSpace(str))
                {
                    continue;
                }
                string[] strArrays = str.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                string   str1      = strArrays[0].Trim();
                itemType _itemType = itemType.NULL_ITEM;
                string   str2      = strArrays[1].TrimStart(new char[0]);
                int      num1      = str2.IndexOfAny(new char[] { ' ', '\t', '\"', ',', ';', '/', '#' });
                if (num1 > 0)
                {
                    str2 = str2.Remove(num1);
                }
                Enum.TryParse <itemType>(str2, out _itemType);
                string str3 = null;
                int    num2 = strArrays[1].IndexOf('\"') + 1;
                if (num2 > 0)
                {
                    int num3 = strArrays[1].IndexOf('\"', num2);
                    str3 = strArrays[1].Substring(num2, num3 - num2);
                }
                Tuple <string, int> tuple = new Tuple <string, int>(str1, length);
                while (tuples.Count > 0 && tuples.Peek().Item2 <= length)
                {
                    tuples.Pop();
                }
                if (tuples.Count != 0)
                {
                    nav.AddCategory(tuples.Peek().Item1, str1, new navigation.Filter(_itemType, str3));
                }
                else
                {
                    nav.AddCategory(str1, new navigation.Filter(_itemType, str3));
                }
                tuples.Push(new Tuple <string, int>(str1, length));
            }
        }
Beispiel #15
0
 public Wordswaps(GameData.Item item, navigation nav) : base(item, nav)
 {
     this.btnAddChild.Enabled        = false;
     this.btnAddInterjection.Enabled = false;
     this.addChild.Visible           = false;
     this.addInterjection.Visible    = false;
     this.Text = "Ìæ»»´Ê";
     this.tree.Nodes[0].Text = "Ìæ»»´Ê";
     this.tree.AfterSelect  += new TreeViewEventHandler(this.tree_AfterSelect);
     this.btnAddChild.Click -= new EventHandler(this.addChild_Click);
     this.btnAddChild.Click += new EventHandler(this.addChild_Click);
     this.addChild.Click    -= new EventHandler(this.addChild_Click);
     this.addChild.Click    += new EventHandler(this.addChild_Click);
 }
        protected navigation getNav()
        {
            navigation _navigation = null;

            foreach (Form openForm in Application.OpenForms)
            {
                if (openForm.GetType() != typeof(baseForm))
                {
                    continue;
                }
                _navigation = ((baseForm)openForm).nav;
            }
            return(_navigation);
        }
Beispiel #17
0
 public DialogTranslation(NavigationTranslation nt, navigation nav, TranslationManager.TranslationDialogue item)
 {
     this.InitializeComponent();
     this.nav                    = nav;
     this.navTranslation         = nt;
     this.gameData               = nav.ou.gameData;
     this.dialogueItem           = item.Item;
     this.item                   = item;
     this.txtDialogName.Text     = this.dialogueItem.Name;
     this.txtDialogName.ReadOnly = item.Item.getState() != GameData.State.OWNED;
     this.referenceList1.Exclusions.Add("lines");
     this.referenceList1.Exclusions.Add("conditions");
     this.referenceList1.Exclusions.Add("effects");
     this.referenceList1.setup(null, nav);
     this.createConversationTree(this.dialogueItem, this.tvDialog.Nodes);
 }
Beispiel #18
0
        private void removeReferences_Click(object sender, EventArgs e)
        {
            navigation mdiParent = (base.MdiParent as baseForm).nav;

            foreach (ListViewItem selectedItem in this.errorList.SelectedItems)
            {
                Errors.Item tag = selectedItem.Tag as Errors.Item;
                int         num = tag.item.removeInvalidReferences();
                if (num <= 0)
                {
                    continue;
                }
                tag.item  = null;
                tag.state = 4;
                this.setState(selectedItem, string.Concat("removed ", num, " references"));
                mdiParent.HasChanges = true;
            }
        }
Beispiel #19
0
        private void clearChangesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            navigation mdiParent = (base.MdiParent as baseForm).nav;

            foreach (ListViewItem selectedItem in this.errorList.SelectedItems)
            {
                Errors.Item tag = selectedItem.Tag as Errors.Item;
                if (tag.item.getState() != GameData.State.MODIFIED)
                {
                    continue;
                }
                tag.item.revert();
                tag.state = 3;
                this.setState(selectedItem, "reverted");
                mdiParent.refreshItemWindow(tag.item);
                mdiParent.HasChanges = true;
            }
        }
Beispiel #20
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GameData   mdiParent   = (base.MdiParent as baseForm).nav.ou.gameData;
            navigation _navigation = (base.MdiParent as baseForm).nav;

            foreach (ListViewItem selectedItem in this.errorList.SelectedItems)
            {
                Errors.Item tag = selectedItem.Tag as Errors.Item;
                if (tag.item == null)
                {
                    continue;
                }
                _navigation.closeItemProperties(tag.item);
                mdiParent.deleteItem(tag.item);
                tag.item  = null;
                tag.state = 2;
                this.setState(selectedItem, "deleted");
                _navigation.HasChanges = true;
            }
        }
 public void setup(GameData.Item item, navigation nv)
 {
     this.nav = nv;
     this.refresh(item);
 }
        public static bool load(string filename, navigation nav)
        {
            itemType _itemType;

            Definitions.lineNumber = 0;
            Definitions.errors     = "";
            if (!File.Exists(filename))
            {
                return(false);
            }
            using (MemoryStream memoryStream = new MemoryStream())
            {
                File.OpenRead(filename).CopyTo(memoryStream);
                memoryStream.Position = (long)0;
                using (StreamReader streamReader = new StreamReader(memoryStream))
                {
                    while (!streamReader.EndOfStream)
                    {
                        string str = Definitions.readLine(streamReader);
                        if (!str.StartsWith("["))
                        {
                            if (!str.StartsWith("enum"))
                            {
                                continue;
                            }
                            Definitions.parseEnum(streamReader, str);
                        }
                        else
                        {
                            string str1 = str.Substring(1, str.IndexOf(']') - 1);
                            if (str1 != "FCS_LAYOUT")
                            {
                                List <itemType> itemTypes = new List <itemType>();
                                string[]        strArrays = str1.Split(new char[] { ',' });
                                for (int i = 0; i < (int)strArrays.Length; i++)
                                {
                                    string str2 = strArrays[i];
                                    if (!Enum.TryParse <itemType>(str2, out _itemType))
                                    {
                                        Definitions.error(string.Concat("Invalid item type ", str2));
                                    }
                                    else
                                    {
                                        itemTypes.Add(_itemType);
                                    }
                                }
                                if (itemTypes.Count <= 0)
                                {
                                    continue;
                                }
                                Definitions.parseItem(streamReader, itemTypes);
                            }
                            else
                            {
                                //TODO 不需要外部翻译
                                //Definitions.parseLayout(streamReader, nav);
                            }
                        }
                    }
                }
            }
            if (Definitions.errors.Length > 0)
            {
                MessageBox.Show(Definitions.errors, string.Concat(filename, " 错误"), MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            return(true);
        }