コード例 #1
0
 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();
     }
 }
コード例 #2
0
 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();
 }
コード例 #3
0
        private void UpdateNode(TreeNode node)
        {
            if (node == null || node.Tag == null)
            {
                return;
            }
            DialogTranslation.LineData tag = node.Tag as DialogTranslation.LineData;
            if (tag.isInterjection)
            {
                node.Text = "*插入对话节点*";
            }
            else if (tag.dialogueLine.Lines.Count <= 0 || string.IsNullOrEmpty(tag.dialogueLine.Lines[0].Translation))
            {
                node.Text = "<Empty>";
            }
            else
            {
                node.Text = tag.dialogueLine.Lines[0].Translation;
            }
            if (tag.isLink)
            {
                node.ForeColor = Color.Gray;
                return;
            }
            TalkerEnum item = (TalkerEnum)tag.data.idata["speaker"];

            if (tag.isInterjection)
            {
                node.BackColor = StateColours.getIntejectionColour(item);
                return;
            }
            node.ForeColor = StateColours.getTalkerColour(item);
        }
コード例 #4
0
        private void grid_OnPropertyChanged(object sender, PropertyChangedArgs e)
        {
            string str = e.Item.Data.ToString();

            this.Item.setReferenceValue(e.Section.Name, str, (GameData.TripleInt)e.Item.Value);
            e.Item.TextColour = StateColours.GetStateColor(this.Item.getState(e.Section.Name, str));
            this.nav.refreshState(this.Item);
            this.nav.HasChanges = true;
        }
コード例 #5
0
        private void contextMenu_Opening(object sender, CancelEventArgs e)
        {
            if (this.grid.SelectedItem == null)
            {
                e.Cancel = true;
                return;
            }
            bool textColour = this.grid.SelectedItem.TextColour != StateColours.GetStateColor(GameData.State.LOCKED);

            this.removeItem.Enabled = textColour;
            this.revertItem.Enabled = textColour;
        }
コード例 #6
0
        public void refresh(GameData.Item item, string instanceID, itemType mask)
        {
            this.Item         = item;
            this.InstanceName = instanceID;
            this.Instance     = item.getInstance(instanceID);
            GameData gameDatum = this.nav.ou.gameData;
            string   str       = this.Instance.sdata["ref"];
            object   obj       = gameDatum.getItem(str);

            if (obj == null)
            {
                obj = str;
            }
            bool   state      = this.Instance.getState() == GameData.State.LOCKED;
            Color  stateColor = StateColours.GetStateColor((state ? GameData.State.LOCKED : GameData.State.ORIGINAL));
            string str1       = "";

            if (mask == itemType.NULL_ITEM)
            {
                str1 = "is node=true";
            }
            this.grid.addItem("Base", "Parent Item", this.Item, "The item this instance belongs to", new Color?(SystemColors.GrayText), false);
            this.grid.addItem("Base", "Instance ID", this.InstanceName, "Unique identifier for this instance. Works the same as StringID but for instances", new Color?(stateColor), !state);
            this.grid.addItem("Base", "Target", obj, "Game object that is instanced", new Color?(stateColor), !state).Property = new GameDataItemProperty(gameDatum, mask, str1);
            GameData.State state1 = this.Instance.getState("ref");
            if (state && state1 != GameData.State.INVALID)
            {
                state1 = GameData.State.LOCKED;
            }
            this.grid.getItem("Target").TextColour = StateColours.GetStateColor(state1);
            this.setItem("Position", "X", "x", "Instance position");
            this.setItem("Position", "Y", "y", "Instance position");
            this.setItem("Position", "Z", "z", "Instance position");
            this.setItem("Orientation", "W", "qw", "Instance oriantetion (quaternion)");
            this.setItem("Orientation", "X", "qx", "Instance oriantetion (quaternion)");
            this.setItem("Orientation", "Y", "qy", "Instance oriantetion (quaternion)");
            this.setItem("Orientation", "Z", "qz", "Instance oriantetion (quaternion)");
            foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in this.Instance.referenceData("states", false))
            {
                GameData.Item item1 = this.nav.ou.gameData.getItem(keyValuePair.Key);
                if (item1 == null)
                {
                    continue;
                }
                PropertyGrid.PropertyGrid propertyGrid = this.grid;
                itemType _itemType = item1.type;
                Color?   nullable  = null;
                PropertyGrid.PropertyGrid.Item gameDataItemProperty = propertyGrid.addItem("State Data", _itemType.ToString(), item1, "Instance state data", nullable, true);
                gameDataItemProperty.Property = new GameDataItemProperty(gameDatum, item1.type, "");
                gameDataItemProperty.Editable = false;
            }
            this.grid.AutosizeDivider();
        }
コード例 #7
0
        private void tvDialog_DrawNode(object sender, DrawTreeNodeEventArgs e)
        {
            bool state = (int)(e.State & TreeNodeStates.Selected) != 0;

            if (e.Node.Tag != null && this.currentLine != null && (e.Node.Tag as DialogTranslation.LineData).data == this.currentLine.data)
            {
                state = true;
            }
            if (state)
            {
                e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds);
                TextRenderer.DrawText(e.Graphics, e.Node.Text, this.tvDialog.Font, e.Bounds, SystemColors.HighlightText, TextFormatFlags.Default);
                return;
            }
            if (!this.tvDialog.Focused && this.tvDialog.SelectedNode == e.Node)
            {
                e.Graphics.FillRectangle(SystemBrushes.ControlLight, e.Bounds);
            }
            else if (e.Node.BackColor.IsEmpty)
            {
                e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
            }
            else
            {
                using (SolidBrush solidBrush = new SolidBrush(e.Node.BackColor))
                {
                    e.Graphics.FillRectangle(solidBrush, e.Bounds);
                }
            }
            Color foreColor = e.Node.ForeColor;

            if (e.Node.Tag != null)
            {
                DialogTranslation.LineData tag = e.Node.Tag as DialogTranslation.LineData;
                if (tag.dialogueLine.State != TranslationManager.DialogueTranslationState.OK)
                {
                    using (Pen pen = new Pen(Color.Red))
                    {
                        pen.DashStyle = DashStyle.Dot;
                        Rectangle bounds = e.Bounds;
                        bounds.Size = new System.Drawing.Size(bounds.Width - 1, bounds.Height - 1);
                        e.Graphics.DrawRectangle(pen, bounds);
                    }
                }
                if (!tag.isLink)
                {
                    foreColor = StateColours.getTalkerColour((TalkerEnum)tag.data["speaker"]);
                }
            }
            TextRenderer.DrawText(e.Graphics, e.Node.Text, this.tvDialog.Font, e.Bounds, foreColor, TextFormatFlags.Default);
        }
コード例 #8
0
        private PropertyGrid.PropertyGrid.Item setItem(string section, string name, string key, string desc)
        {
            Color?nullable = null;

            PropertyGrid.PropertyGrid.Item stateColor = this.grid.addItem(section, name, this.Instance[key], desc, nullable, true);
            stateColor.Data       = key;
            stateColor.TextColour = StateColours.GetStateColor(this.Instance.getState(key));
            if (this.Instance.getState() == GameData.State.LOCKED)
            {
                stateColor.TextColour = StateColours.GetStateColor(GameData.State.LOCKED);
                stateColor.Editable   = false;
            }
            return(stateColor);
        }
コード例 #9
0
        private void referenceList_OnPropertyChanged(object sender, PropertyChangedArgs e)
        {
            if (e.Section.Name == "Instances")
            {
                return;
            }
            string str = e.Item.Data.ToString();

            if (this.Item.getState(e.Section.Name, str) == GameData.State.LOCKED)
            {
                return;
            }
            this.Item.setReferenceValue(e.Section.Name, str, (GameData.TripleInt)e.Item.Value);
            e.Item.TextColour = StateColours.GetStateColor(this.Item.getState(e.Section.Name, str));
            this.nav.refreshState(this.Item);
            this.nav.HasChanges = true;
        }
コード例 #10
0
 private void refresh()
 {
     foreach (object item in this.eventsList.Items)
     {
         ((ListViewItem)item).ForeColor = Color.Gray;
     }
     foreach (KeyValuePair <string, GameData.TripleInt> black in this.Item.referenceData("dialogs", false))
     {
         if (black.Value.v0 > 0 && black.Value.v0 <= this.eventsList.Items.Count)
         {
             this.eventsList.Items[black.Value.v0 - 1].ForeColor = Color.Black;
         }
         if (black.Value.v1 > 0 && black.Value.v1 <= this.eventsList.Items.Count)
         {
             this.eventsList.Items[black.Value.v1 - 1].ForeColor = Color.Black;
         }
         if (black.Value.v2 <= 0 || black.Value.v2 > this.eventsList.Items.Count)
         {
             continue;
         }
         this.eventsList.Items[black.Value.v2 - 1].ForeColor = Color.Black;
     }
     this.treeView1.Nodes.Clear();
     foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in this.Item.referenceData("dialogs", false))
     {
         if (keyValuePair.Value.v0 != (int)this.SelectedEvent && keyValuePair.Value.v1 != (int)this.SelectedEvent && keyValuePair.Value.v2 != (int)this.SelectedEvent)
         {
             continue;
         }
         GameData.Item item1 = this.nav.ou.gameData.getItem(keyValuePair.Key);
         if (item1 == null)
         {
             continue;
         }
         TreeNode stateColor = this.treeView1.Nodes.Add(item1.Name);
         stateColor.ForeColor = StateColours.GetStateColor(this.Item.getState("dialogs", keyValuePair.Key));
         stateColor.Tag       = item1;
         Conversation.createConversationTree(this.nav.ou.gameData, item1, stateColor.Nodes);
     }
     this.conditionControl1.refresh(this.SelectedItem);
     this.objectPropertyBox1.refresh(this.SelectedItem);
     this.objectPropertyBox1.grid.removeSection("Base");
 }
コード例 #11
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]);
            }
            AssetList.Asset item         = this.Assets[index];
            ListViewItem    listViewItem = new ListViewItem()
            {
                Text      = item.file,
                ForeColor = StateColours.GetStateColor(item.item.getState(item.key))
            };

            if (!File.Exists(item.file))
            {
                listViewItem.ForeColor = Color.Red;
            }
            return(listViewItem);
        }
コード例 #12
0
 private void grid_OnPropertyChanged(object sender, PropertyChangedArgs e)
 {
     if (e.Item.Name == "Instance ID")
     {
         string str = e.Item.Value.ToString();
         if (str == null)
         {
             e.Item.Value = e.OldValue;
         }
         else if (!this.Item.renameInstance(this.InstanceName, str))
         {
             MessageBox.Show("此id已经存在一个实例");
             e.Item.Value = e.OldValue;
         }
         else
         {
             this.InstanceName = str;
         }
     }
     else if (e.Item.Name == "Target")
     {
         if (!(e.Item.Value is GameData.Item))
         {
             this.Instance["ref"] = e.Item.Value.ToString();
         }
         else
         {
             this.Instance["ref"] = (e.Item.Value as GameData.Item).stringID;
         }
         this.Item.refreshState();
         this.nav.refreshItemWindow(this.Item);
     }
     else if (e.Item.Data is string)
     {
         string data = (string)e.Item.Data;
         this.Instance[data] = (float)e.Item.Value;
         e.Item.TextColour   = StateColours.GetStateColor(this.Instance.getState(data));
     }
     this.Item.refreshState();
     this.nav.refreshItemWindow(this.Item);
     this.nav.refreshState(this.Item);
     this.nav.HasChanges = true;
 }
コード例 #13
0
        private void bRemoveReference_Click(object sender, EventArgs e)
        {
            string data;

            if (this.referenceList.SelectedItem == null)
            {
                return;
            }
            if (this.referenceList.SelectedItem.TextColour == StateColours.GetStateColor(GameData.State.LOCKED))
            {
                return;
            }
            string name = this.referenceList.SelectedSection.Name;
            string str  = this.referenceList.SelectedItem.Name;

            if (this.referenceList.SelectedItem.Data is string)
            {
                data = (string)this.referenceList.SelectedItem.Data;
            }
            else
            {
                data = null;
            }
            string str1 = data;

            this.referenceList.removeItem(name, this.referenceList.SelectedItem);
            if (this.referenceList.getSection(name).Items.Count == 0)
            {
                this.referenceList.removeSection(name);
            }
            if (str1 != null)
            {
                this.Item.removeReference(name, str1);
            }
            else
            {
                this.Item.removeInstance(str);
            }
            this.nav.refreshState(this.Item);
            this.nav.HasChanges = true;
        }
コード例 #14
0
        private ListViewItem createItem(GameData.Item item)
        {
            ListViewItem listViewItem = new ListViewItem(item.Name)
            {
                ForeColor = StateColours.GetStateColor(item.getState())
            };

            foreach (ColumnHeader column in base.Columns)
            {
                if (column.Index == 0)
                {
                    continue;
                }
                if (column.Tag == null)
                {
                    column.Tag = "Name";
                }
                string str = column.Tag.ToString();
                if (str == "Name")
                {
                    listViewItem.SubItems.Add(item.Name);
                }
                else if (str == "StringID")
                {
                    listViewItem.SubItems.Add(item.stringID);
                }
                else if (str == "Type")
                {
                    listViewItem.SubItems.Add(item.type.ToString());
                }
                else if (str == "Ref")
                {
                    listViewItem.SubItems.Add(item.refCount.ToString());
                }
                else if (column.Tag is GameDataList.ColumnInfo && item.hasReference(str))
                {
                    GameDataList.ColumnInfo tag = column.Tag as GameDataList.ColumnInfo;
                    string str1 = "";
                    if (tag.showNames || tag.showValues)
                    {
                        GameData.Desc desc = GameData.getDesc(item.type, str);
                        foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in item.referenceData(str, false))
                        {
                            GameData.Item item1 = this.Source.getItem(keyValuePair.Key);
                            if (tag.showNames)
                            {
                                str1 = string.Concat(str1, (item1 == null ? keyValuePair.Key : item1.Name));
                            }
                            if (!tag.showValues)
                            {
                                if (!tag.showNames)
                                {
                                    continue;
                                }
                                str1 = string.Concat(str1, "; ");
                            }
                            else
                            {
                                if (desc.flags == 1)
                                {
                                    str1 = string.Concat(new object[] { str1, " ", keyValuePair.Value.v0, "; " });
                                }
                                if (desc.flags == 2)
                                {
                                    str1 = string.Concat(new object[] { str1, " ", keyValuePair.Value.v0, " ", keyValuePair.Value.v1, "; " });
                                }
                                if (desc.flags != 3)
                                {
                                    continue;
                                }
                                str1 = string.Concat(new object[] { str1, " ", keyValuePair.Value.v0, " ", keyValuePair.Value.v1, " ", keyValuePair.Value.v2, "; " });
                            }
                        }
                    }
                    else
                    {
                        str1 = string.Concat("Size: ", item.getReferenceCount(str));
                    }
                    listViewItem.SubItems.Add(str1);
                }
                else if (str == "Data")
                {
                    int referenceValue = 0;
                    if (item.hasReference("cost"))
                    {
                        referenceValue = item.getReferenceValue("cost", 0).v0;
                    }
                    listViewItem.SubItems.Add(referenceValue.ToString());
                }
                else if (!item.ContainsKey(str))
                {
                    listViewItem.SubItems.Add("-");
                }
                else
                {
                    object bah = item[str];
                    if (bah is int)
                    {
                        GameData.Desc desc1 = GameData.getDesc(item.type, str);
                        if (desc1 != GameData.nullDesc && desc1.defaultValue.GetType().IsEnum)
                        {
                            if (desc1.flags != 256)
                            {
                                string name = Enum.GetName(desc1.defaultValue.GetType(), bah);
                                if (name != null)
                                {
                                    bah = name;
                                }
                            }
                            else
                            {
                                bah = (new BitSetProperty(desc1.defaultValue.GetType(), false)).getAsString(bah);
                            }
                        }
                    }
                    listViewItem.SubItems.Add(bah.ToString());
                }
            }
            return(listViewItem);
        }
コード例 #15
0
        public void refreshReferenceList()
        {
            KeyValuePair <string, GameData.Desc> keyValuePair;

            this.referenceList.clear();
            foreach (string str in this.Item.referenceLists())
            {
                GameData.Desc     desc = GameData.getDesc(this.Item.type, str);
                int               num  = (desc == GameData.nullDesc ? 3 : desc.flags);
                TripleIntProperty tripleIntProperty = new TripleIntProperty(num);
                foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair1 in this.Item.referenceData(str, false))
                {
                    GameData.Item  item                = this.nav.ou.gameData.getItem(keyValuePair1.Key);
                    GameData.State state               = this.Item.getState(str, keyValuePair1.Key);
                    string         str1                = (item != null ? item.Name : keyValuePair1.Key);
                    Color          stateColor          = StateColours.GetStateColor(state);
                    PropertyGrid.PropertyGrid.Item key = this.referenceList.addItem(str, str1, keyValuePair1.Value, desc.description, new Color?(stateColor), num > 0);
                    key.Property = tripleIntProperty;
                    key.Data     = keyValuePair1.Key;
                    key.Editable = state != GameData.State.LOCKED;
                }
            }
            if (this.Item.HasInstances)
            {
                Dictionary <itemType, KeyValuePair <string, GameData.Desc> > itemTypes = new Dictionary <itemType, KeyValuePair <string, GameData.Desc> >();
                if (GameData.desc.ContainsKey(this.Item.type))
                {
                    foreach (KeyValuePair <string, GameData.Desc> item1 in GameData.desc[this.Item.type])
                    {
                        if (!(item1.Value.defaultValue is GameData.Instance))
                        {
                            continue;
                        }
                        itemTypes.Add(item1.Value.list, item1);
                    }
                }
                if (itemTypes.Count != 0)
                {
                    foreach (KeyValuePair <string, GameData.Instance> keyValuePair2 in this.Item.instanceData())
                    {
                        if (keyValuePair2.Value.getState() == GameData.State.REMOVED)
                        {
                            continue;
                        }
                        GameData.Item item2 = this.nav.ou.gameData.getItem(keyValuePair2.Value.sdata["ref"]);
                        Color         color = StateColours.GetStateColor(keyValuePair2.Value.getState());
                        bool          flag  = keyValuePair2.Value.getState() != GameData.State.LOCKED;
                        if (item2 == null || !itemTypes.TryGetValue(item2.type, out keyValuePair))
                        {
                            this.referenceList.addItem("Instances", keyValuePair2.Key, keyValuePair2.Value, "Object instances", new Color?(color), flag);
                        }
                        else
                        {
                            this.referenceList.addItem(keyValuePair.Key, keyValuePair2.Key, keyValuePair2.Value, keyValuePair.Value.description, new Color?(color), flag).Data = item2.type;
                        }
                    }
                }
                else
                {
                    foreach (KeyValuePair <string, GameData.Instance> keyValuePair3 in this.Item.instanceData())
                    {
                        if (keyValuePair3.Value.getState() == GameData.State.REMOVED)
                        {
                            continue;
                        }
                        bool  state1      = keyValuePair3.Value.getState() != GameData.State.LOCKED;
                        Color stateColor1 = StateColours.GetStateColor(keyValuePair3.Value.getState());
                        this.referenceList.addItem("Instances", keyValuePair3.Key, keyValuePair3.Value, "Object instances", new Color?(stateColor1), state1);
                    }
                }
                if (this.nav.FileMode == navigation.ModFileMode.SINGLE)
                {
                    foreach (KeyValuePair <string, GameData.Instance> keyValuePair4 in this.Item.instanceData())
                    {
                        if (keyValuePair4.Value.getState() != GameData.State.REMOVED)
                        {
                            continue;
                        }
                        Color color1 = StateColours.GetStateColor(keyValuePair4.Value.getState());
                        this.referenceList.addItem("Instances", keyValuePair4.Key, keyValuePair4.Value, "Object instances", new Color?(color1), false);
                    }
                }
            }
            this.referenceList.AutosizeDivider();
        }
コード例 #16
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);
        }