Esempio n. 1
0
 public Asset(string k, string f, GameData.Item i)
 {
     this.key   = k;
     this.file  = f;
     this.item  = i;
     this.count = 1;
 }
Esempio n. 2
0
 private void grid_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (this.grid.SelectedItem == null)
     {
         return;
     }
     if (this.grid.SelectedItem.Property is GameDataItemProperty)
     {
         object        value = this.grid.SelectedItem.Value;
         GameData.Item item  = null;
         if (value is GameData.Item)
         {
             item = value as GameData.Item;
         }
         else if (value != null)
         {
             item = this.nav.ou.gameData.getItem(value.ToString());
         }
         if (item != null)
         {
             this.nav.showItemProperties(item);
             return;
         }
     }
     else if (this.grid.SelectedItem.Name == "Parent Item")
     {
         this.nav.showItemProperties(this.grid.SelectedItem.Value as GameData.Item);
     }
 }
 private void duplicateItem_Click(object sender, EventArgs e)
 {
     GameData.Item item = this.nav.ou.gameData.cloneItem(this.Item);
     this.nav.showItemProperties(item);
     this.nav.refreshListView();
     this.nav.HasChanges = true;
 }
Esempio n. 4
0
 public OgreSceneImporter(GameData.Item item, navigation nav)
 {
     this.InitializeComponent();
     this.Item            = item;
     this.nav             = nav;
     this.bImport.Enabled = false;
 }
Esempio n. 5
0
    static public void AddItem(int itemid)
    {
        bool done = false;

        for (int i = 0; i < Items.Count; i++)
        {
            //已经有相同的道具,只增加数量
            if (Items[i].id == itemid)
            {
                GameData.Item newitem = Items[i];
                newitem.num += 1;//数量加一
                //取出原来的元素,把新的放进去。。。有点麻烦
                Items.RemoveAt(i);
                Items.Insert(i, newitem);

                //Debug.Log ("id:"+Items[i].id + "  num:"+Items[i].num );
                done = true;
                i    = Items.Count;//end
            }
        }

        if (!done)
        {
            Items.Add(GameData.AllItems[itemid]);
            //Debug.Log ("id:"+item.id + "  num:"+item.num );
        }

        PlayerBagItemDirty            = true;
        GameData.PlayerMakeItemsDirty = true;
    }
 public void setup(GameData.Item item, navigation nv)
 {
     this.Item = item;
     this.nav  = nv;
     this.refresh(item);
     this.setupConditions();
 }
Esempio n. 7
0
        private void addCondition_Click(object sender, EventArgs e)
        {
            DialogConditionEnum selectedIndex = (DialogConditionEnum)(this.possibleConditions.SelectedIndex + 1);

            if (this.CurrentLine == null)
            {
                return;
            }
            int num = this.methodToInt(this.conditionMethod.Text);

            GameData.Item text = this.nav.ou.gameData.createItem(itemType.DIALOG_ACTION);
            text["condition name"] = (int)selectedIndex;
            text["who"]            = this.whoBox.SelectedIndex;
            text["compare by"]     = num;
            text["stringvar"]      = this.stringvarbox.Text;
            text["tag"]            = this.enumBox.SelectedIndex;
            int?nullable  = null;
            int?nullable1 = nullable;

            nullable = null;
            this.CurrentLine.addReference("conditions", text, new int?((int)this.conditionsValue.Value), nullable1, nullable);
            this.refresh(this.CurrentLine);
            if (this.ChangeEvent != null)
            {
                this.ChangeEvent(this);
            }
        }
 private void replaceWithCopyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.referenceList.SelectedItem != null && this.referenceList.SelectedItem.Value is GameData.TripleInt)
     {
         string        data = (string)this.referenceList.SelectedItem.Data;
         GameData.Item item = this.nav.ou.gameData.getItem(data);
         if (this.referenceList.SelectedItem.TextColour == StateColours.GetStateColor(GameData.State.LOCKED))
         {
             return;
         }
         string name = this.referenceList.SelectedSection.Name;
         string str  = this.referenceList.SelectedItem.Name;
         this.referenceList.removeItem(name, this.referenceList.SelectedItem);
         if (data != null)
         {
             this.Item.removeReference(name, data);
         }
         else
         {
             this.Item.removeInstance(str);
         }
         GameData.Item item1     = this.nav.ou.gameData.cloneItem(item);
         int?          nullable  = null;
         int?          nullable1 = nullable;
         nullable = null;
         int?nullable2 = nullable;
         nullable = null;
         this.Item.addReference(name, item1, nullable1, nullable2, nullable);
         this.nav.refreshState(this.Item);
         this.nav.HasChanges = true;
         this.refreshData();
         this.refreshReferenceList();
     }
 }
Esempio n. 9
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();
        }
Esempio n. 10
0
        private void contextMenu_Opening(object sender, CancelEventArgs e)
        {
            GameData.Item item;
            if (this.referenceList.SelectedSection == null)
            {
                e.Cancel = true;
                return;
            }
            if (this.referenceList.SelectedItem == null)
            {
                this.bRemoveSection.Visible   = true;
                this.bRemoveReference.Visible = false;
                this.bOpenReference.Visible   = false;
                this.bReplaceWithCopy.Visible = false;
                return;
            }
            string data = (string)this.referenceList.SelectedItem.Data;

            if (data == null)
            {
                item = null;
            }
            else
            {
                item = this.nav.ou.gameData.getItem(data);
            }
            GameData.Item item1 = item;
            this.bRemoveSection.Visible   = false;
            this.bRemoveReference.Visible = true;
            this.bOpenReference.Visible   = true;
            this.bReplaceWithCopy.Visible = (item1 == null || item1.type == itemType.DIALOGUE ? false : item1.type != itemType.DIALOGUE_LINE);
            this.bRemoveReference.Enabled = this.referenceList.SelectedItem.TextColour != StateColours.GetStateColor(GameData.State.LOCKED);
        }
 private void addDialogRef(GameData.Item what)
 {
     if (!this.Item.hasReferenceTo("dialogs", what.stringID))
     {
         this.Item.addReference("dialogs", what, new int?((int)this.SelectedEvent), new int?(0), new int?(0));
         return;
     }
     GameData.TripleInt referenceValue = this.Item.getReferenceValue("dialogs", what.stringID);
     if (referenceValue.v1 == 100)
     {
         referenceValue.v1 = 0;
     }
     if (referenceValue.v0 == 0)
     {
         referenceValue.v0 = (int)this.SelectedEvent;
     }
     else if (referenceValue.v1 == 0)
     {
         referenceValue.v1 = (int)this.SelectedEvent;
     }
     else if (referenceValue.v2 != 0)
     {
         MessageBox.Show("对该对话对象引用过多,对话包最多只能引用一个对象3次", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         referenceValue.v2 = (int)this.SelectedEvent;
     }
     this.Item.setReferenceValue("dialogs", what.stringID, new int?(referenceValue.v0), new int?(referenceValue.v1), new int?(referenceValue.v2));
 }
 public void refresh(GameData.Item item)
 {
     this.Item = item;
     this.grid.AddPropertyType(typeof(GameData.Instance), new InstanceProperty(item, this.nav));
     this.refreshAddList();
     this.refreshGrid();
 }
Esempio n. 13
0
 private void selectRecursiveData(GameData.Item item, bool check, HashSet <GameData.Item> traversed)
 {
     if (traversed.Contains(item))
     {
         return;
     }
     traversed.Add(item);
     foreach (string str in item.referenceLists())
     {
         foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in item.referenceData(str, true))
         {
             GameData.Item item1 = this.tempData.getItem(keyValuePair.Key);
             if (item1 == null || item1.getState() == GameData.State.ORIGINAL)
             {
                 continue;
             }
             this.checkItem(item1, check);
             this.selectRecursiveData(item1, check, traversed);
         }
     }
     foreach (KeyValuePair <string, GameData.Instance> keyValuePair1 in item.instanceData())
     {
         string        str1  = keyValuePair1.Value.sdata["ref"];
         GameData.Item item2 = this.tempData.getItem(str1);
         if (item2 == null || item2.getState() == GameData.State.ORIGINAL)
         {
             continue;
         }
         this.checkItem(item2, check);
         this.selectRecursiveData(item2, check, traversed);
     }
 }
Esempio n. 14
0
        private void lockedDescription_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int         i;
            char        text;
            TextBox     textBox = sender as TextBox;
            string      str     = "";
            List <char> chrs    = new List <char>(new char[] { ' ', '\t', '\n', '\r', '[', ']', '{', '}' });

            for (i = textBox.SelectionStart - 1; i >= 0 && !chrs.Contains(textBox.Text[i]); i--)
            {
                text = textBox.Text[i];
                str  = string.Concat(text.ToString(), str);
            }
            for (i = textBox.SelectionStart; i < textBox.Text.Length && !chrs.Contains(textBox.Text[i]); i++)
            {
                text = textBox.Text[i];
                str  = string.Concat(str, text.ToString());
            }
            if (str.EndsWith(".") || str.EndsWith(","))
            {
                str = str.Substring(0, str.Length - 1);
            }
            GameData.Item item = this.nav.ou.gameData.getItem(str);
            if (item != null)
            {
                this.nav.showItemProperties(item);
            }
        }
Esempio n. 15
0
        private void fixReferences_Click(object sender, EventArgs e)
        {
            int num = 0;
            HashSet <string> strs = new HashSet <string>();

            foreach (GameData.Item value in this.gameData.items.Values)
            {
                num += this.findMissingReferences(value, strs);
            }
            int count = 0;

            while (strs.Count != count)
            {
                HashSet <string> strs1 = new HashSet <string>();
                foreach (string str in strs)
                {
                    GameData.Item item = this.tempData.getItem(str);
                    this.findMissingReferences(item, strs1);
                }
                count = strs.Count;
                foreach (string str1 in strs1)
                {
                    strs.Add(str1);
                }
            }
            foreach (string str2 in strs)
            {
                GameData.Item item1 = this.tempData.getItem(str2);
                this.checkItem(item1, true);
            }
            MessageBox.Show(string.Concat("已选择的 ", strs.Count, " 丢失引用"), "合并");
        }
Esempio n. 16
0
        private int findMissingReferences(GameData.Item item, HashSet <string> added)
        {
            int num = 0;

            foreach (string str in item.referenceLists())
            {
                foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in item.referenceData(str, true))
                {
                    if (this.gameData.getItem(keyValuePair.Key) != null || this.tempData.getItem(keyValuePair.Key) == null)
                    {
                        continue;
                    }
                    added.Add(keyValuePair.Key);
                    num++;
                }
            }
            foreach (KeyValuePair <string, GameData.Instance> keyValuePair1 in item.instanceData())
            {
                string str1 = keyValuePair1.Value.sdata["ref"];
                if (this.gameData.getItem(str1) != null || this.tempData.getItem(str1) == null)
                {
                    continue;
                }
                added.Add(str1);
                num++;
            }
            return(num);
        }
Esempio n. 17
0
        private bool checkItem(GameData.Item item, bool check)
        {
            bool flag;

            List <ChangeListTree.RootNode> .Enumerator enumerator = this.tree.Nodes.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ChangeListTree.TreeNode current = enumerator.Current;
                    if (this.tree.GetItem(current) != item)
                    {
                        continue;
                    }
                    this.checkItem(current, check);
                    flag = true;
                    return(flag);
                }
                return(false);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(flag);
        }
Esempio n. 18
0
        private object getCurrentValue(string key)
        {
            object obj;

            if (!this.items[0].ContainsKey(key))
            {
                return(null);
            }
            object bah = this.items[0][key];

            List <GameData.Item> .Enumerator enumerator = this.items.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    GameData.Item current = enumerator.Current;
                    if (!current.ContainsKey(key) || current[key].Equals(bah))
                    {
                        continue;
                    }
                    obj = null;
                    return(obj);
                }
                return(bah);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(obj);
        }
 private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
 {
     this.SelectedItem = (GameData.Item)e.Node.Tag;
     this.conditionControl1.refresh(this.SelectedItem);
     this.objectPropertyBox1.refresh(this.SelectedItem);
     this.objectPropertyBox1.grid.removeSection("Base");
 }
Esempio n. 20
0
        private ListViewItem RetrieveVirtualItem(int index)
        {
            if (this.itemCache != null && index >= this.cacheOffset && index < this.cacheOffset + (int)this.itemCache.Length)
            {
                return(this.itemCache[index - this.cacheOffset]);
            }
            if (this.mappedNodes[index] is ChangeListTree.RootNode)
            {
                GameData.Item item         = (this.mappedNodes[index] as ChangeListTree.RootNode).Item;
                ListViewItem  listViewItem = new ListViewItem(item.Name);
                ListViewItem.ListViewSubItemCollection subItems = listViewItem.SubItems;
                itemType _itemType = item.type;
                subItems.Add(_itemType.ToString(), listViewItem.ForeColor, listViewItem.BackColor, listViewItem.Font);
                listViewItem.SubItems.Add("");
                listViewItem.Checked   = this.mappedNodes[index].Checked;
                listViewItem.ForeColor = StateColours.GetStateColor(item.getState());
                listViewItem.Tag       = this.mappedNodes[index];
                return(listViewItem);
            }
            if (!(this.mappedNodes[index] is ChangeListTree.ChangeData))
            {
                return(null);
            }
            ChangeListTree.ChangeData changeDatum = this.mappedNodes[index] as ChangeListTree.ChangeData;
            ListViewItem @checked = new ListViewItem(changeDatum.Text ?? changeDatum.Key);

            ListViewItem.ListViewSubItemCollection listViewSubItemCollections = @checked.SubItems;
            ChangeListTree.ChangeType type = changeDatum.Type;
            listViewSubItemCollections.Add(type.ToString(), @checked.ForeColor, @checked.BackColor, @checked.Font);
            @checked.SubItems.Add(changeDatum.ToString(), @checked.ForeColor, @checked.BackColor, @checked.Font);
            @checked.Checked   = changeDatum.Checked;
            @checked.ForeColor = changeDatum.Colour;
            @checked.Tag       = changeDatum;
            return(@checked);
        }
        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();
        }
 public void refreshGrid()
 {
     this.grid.clear();
     if (this.Item == null)
     {
         return;
     }
     foreach (string str in this.Item.referenceLists())
     {
         GameData.Desc     desc = GameData.getDesc(this.Item.type, str);
         TripleIntProperty tripleIntProperty = new TripleIntProperty(desc.flags);
         foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in this.Item.referenceData(str, false))
         {
             if (this.Exclusions.Contains(str))
             {
                 continue;
             }
             GameData.Item  item                = this.nav.ou.gameData.getItem(keyValuePair.Key);
             GameData.State state               = this.Item.getState(str, keyValuePair.Key);
             string         str1                = (item != null ? item.Name : keyValuePair.Key);
             Color          stateColor          = StateColours.GetStateColor(state);
             PropertyGrid.PropertyGrid.Item key = this.grid.addItem(str, str1, keyValuePair.Value, desc.description, new Color?(stateColor), desc.flags > 0);
             key.Property = tripleIntProperty;
             key.Data     = keyValuePair.Key;
             key.Editable = state != GameData.State.LOCKED;
         }
     }
     foreach (KeyValuePair <string, GameData.Instance> keyValuePair1 in this.Item.instanceData())
     {
         bool  flag  = (keyValuePair1.Value.getState() == GameData.State.LOCKED ? false : !this.readOnly);
         Color color = StateColours.GetStateColor(keyValuePair1.Value.getState());
         this.grid.addItem("Instances", keyValuePair1.Key, keyValuePair1.Value, "Object instances", new Color?(color), flag);
     }
     this.grid.AutosizeDivider();
 }
Esempio n. 23
0
        private void export(string filename)
        {
            GameData gameDatum = new GameData();

            this.Cursor = Cursors.WaitCursor;
            navigation.ModFileMode fileMode = this.nav.FileMode;
            this.nav.FileMode = navigation.ModFileMode.SINGLE;
            gameDatum.load(this.fileA.Text, GameData.ModMode.ACTIVE, false);
            gameDatum.load(this.fileB.Text, GameData.ModMode.ACTIVE, false);
            foreach (object item in this.listView.Items)
            {
                TranslationFix.LineData tag = ((ListViewItem)item).Tag as TranslationFix.LineData;
                if (tag.@value == null)
                {
                    continue;
                }
                GameData.Item item1 = gameDatum.getItem(tag.item.stringID);
                if (tag.key != null)
                {
                    item1[tag.key] = tag.@value;
                }
                else
                {
                    item1.Name = tag.@value;
                }
            }
            gameDatum.save(filename);
            this.nav.FileMode = fileMode;
            this.Cursor       = Cursors.Default;
        }
 private void grid_OnPropertyChanged(object sender, PropertyChangedArgs e)
 {
     GameData.Desc desc;
     if (e.Item.Value == null)
     {
         e.Item.Value = e.OldValue;
         return;
     }
     if (e.Item.Name == "Name")
     {
         this.Item.Name = (string)e.Item.Value;
         this.grid.SelectedItem.TextColour = StateColours.GetStateColor(this.Item.getNameState());
     }
     else if (e.Item.Name != "String ID")
     {
         if (e.Item.Value.GetType().IsEnum)
         {
             this.Item[e.Item.Name] = (int)e.Item.Value;
         }
         else if (e.Item.Value is Color)
         {
             GameData.Item item  = this.Item;
             string        name  = e.Item.Name;
             Color         value = (Color)e.Item.Value;
             item[name] = value.ToArgb() & 16777215;
         }
         else if (!(e.Item.Property is FileProperty))
         {
             this.Item[e.Item.Name] = e.Item.Value;
         }
         else
         {
             string str = this.validateFile(e.Item.Value.ToString());
             if (str == null)
             {
                 MessageBox.Show("文件必须在游戏data目录或者你MOD目录下的某个地方", "无效路径", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 e.Item.Value = e.OldValue;
             }
             else
             {
                 e.Item.Value           = new GameData.File(str);
                 this.Item[e.Item.Name] = e.Item.Value;
             }
         }
         GameData.State state = this.Item.getState(e.Item.Name);
         e.Item.TextColour = StateColours.GetStateColor(state);
     }
     else
     {
         this.nav.ou.gameData.changeID(this.Item, (string)e.Item.Value);
     }
     this.nav.refreshState(this.Item);
     this.nav.HasChanges = true;
     if (this.Item.isLooper(e.Item.Name, out desc))
     {
         this.ProcessLooper(e.Item.Name, desc);
     }
     this.updateConditions(e.Item.Name);
 }
Esempio n. 25
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);
 }
Esempio n. 26
0
 public void setup(GameData.Item item, navigation n)
 {
     this.Item = item;
     this.nav  = n;
     this.refresh(null);
     this.addCondition.Enabled    = (item == null ? true : item.getState() != GameData.State.LOCKED);
     this.removeCondition.Enabled = (item == null ? true : item.getState() != GameData.State.LOCKED);
 }
 private void openItem_Click(object sender, EventArgs e)
 {
     if (this.grid.SelectedItem != null && this.grid.SelectedSection.Name != "Instances")
     {
         GameData.Item item = this.nav.ou.gameData.getItem(this.grid.SelectedItem.Data.ToString());
         this.nav.showItemProperties(item);
     }
 }
Esempio n. 28
0
        public void closeItemProperties(GameData.Item item)
        {
            Form form;

            if (navigation.forms.TryGetValue(item, out form))
            {
                form.Close();
            }
        }
Esempio n. 29
0
        public void refreshItemWindow(GameData.Item item)
        {
            Form form;

            if (navigation.forms.TryGetValue(item, out form) && form is itemproperties)
            {
                (form as itemproperties).refreshReferenceList();
            }
        }
Esempio n. 30
0
        public void RefreshItem(GameData.Item item)
        {
            int num = this.Items.IndexOf(item);

            if (this.itemCache != null && num >= this.cacheOffset && num < this.cacheOffset + (int)this.itemCache.Length)
            {
                this.itemCache[num - this.cacheOffset] = this.createItem(item);
                this.Refresh();
            }
        }