Beispiel #1
0
        private void bTarget_Click(object sender, EventArgs e)
        {
            ItemDialog itemDialog;

            OgreSceneImporter.NodeType nodeType = OgreSceneImporter.NodeType.PART;
            foreach (TreeNode node in this.tree.Nodes)
            {
                if (!node.Checked)
                {
                    continue;
                }
                nodeType = this.getNodeType(node.Tag as OgreSceneImporter.Node);
                goto Label0;
            }
Label0:
            switch (nodeType)
            {
            case OgreSceneImporter.NodeType.PART:
            {
                itemDialog = new ItemDialog("Parts", this.nav.ou.gameData, itemType.BUILDING_PART, false, "", itemType.NULL_ITEM);
                break;
            }

            case OgreSceneImporter.NodeType.LIGHT:
            {
                itemDialog = new ItemDialog("Lights", this.nav.ou.gameData, itemType.LIGHT, false, "", itemType.NULL_ITEM);
                break;
            }

            case OgreSceneImporter.NodeType.EFFECT:
            {
                itemDialog = new ItemDialog("Effects", this.nav.ou.gameData, itemType.EFFECT, false, "", itemType.NULL_ITEM);
                break;
            }

            case OgreSceneImporter.NodeType.NODE:
            {
                itemDialog = new ItemDialog("Nodes", this.nav.ou.gameData, itemType.BUILDING, false, "is node=true", itemType.NULL_ITEM);
                break;
            }

            default:
            {
                return;
            }
            }
            if (itemDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                foreach (TreeNode str in this.tree.Nodes)
                {
                    if (!str.Checked || (!(str.Tag is OgreSceneImporter.Light) || nodeType != OgreSceneImporter.NodeType.LIGHT) && (!(str.Tag is OgreSceneImporter.Entity) || nodeType != OgreSceneImporter.NodeType.PART) && (!(str.Tag is OgreSceneImporter.Node) || nodeType != OgreSceneImporter.NodeType.EFFECT && nodeType != OgreSceneImporter.NodeType.NODE))
                    {
                        continue;
                    }
                    OgreSceneImporter.Node tag = (OgreSceneImporter.Node)str.Tag;
                    tag.target = itemDialog.Items[0];
                    str.Text   = tag.ToString();
                }
            }
        }
        private void addButton_Click(object sender, EventArgs e)
        {
            string str = this.addList.SelectedItem.ToString();

            GameData.Desc desc       = GameData.getDesc(this.Item.type, str);
            ItemDialog    itemDialog = new ItemDialog(string.Concat("选择 ", str, " 的关联"), this.nav.ou.gameData, desc.list, true, "", itemType.NULL_ITEM);

            if (itemDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (GameData.Item item in itemDialog.Items)
                {
                    int?nullable  = null;
                    int?nullable1 = nullable;
                    nullable = null;
                    int?nullable2 = nullable;
                    nullable = null;
                    this.Item.addReference(str, item, nullable1, nullable2, nullable);
                }
                if (itemDialog.Items.Count > 0)
                {
                    this.refresh(this.Item);
                    this.nav.refreshState(this.Item);
                    this.nav.HasChanges = true;
                    if (this.ChangeEvent != null)
                    {
                        this.ChangeEvent(this);
                    }
                }
            }
        }
 private void bExtra_Click(object sender, EventArgs e)
 {
     GameData.Desc desc = this.getDesc(this.fieldName.Text);
     if (desc == null)
     {
         return;
     }
     if (desc.flags == 16)
     {
         TextDialog textDialog = new TextDialog(this.fieldName.Text, this.fieldValue.Text, null);
         if (textDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             this.fieldValue.Text = textDialog.Text;
             return;
         }
     }
     else if (desc.defaultValue is GameData.TripleInt)
     {
         string   str       = "";
         itemType _itemType = desc.list;
         if (_itemType == itemType.NULL_ITEM)
         {
             _itemType = itemType.BUILDING;
             str       = "is node=true";
         }
         ItemDialog itemDialog = new ItemDialog(string.Concat("选择 ", this.fieldName.Text, " 的关联"), this.nav.ou.gameData, _itemType, true, str, _itemType);
         if (itemDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             List <string> strs = new List <string>();
             foreach (GameData.Item item in itemDialog.Items)
             {
                 string str1 = item.stringID;
                 if (desc.flags > 0)
                 {
                     str1 = string.Concat(str1, " ", (desc.defaultValue as GameData.TripleInt).v0.ToString());
                 }
                 if (desc.flags > 1)
                 {
                     str1 = string.Concat(str1, " ", (desc.defaultValue as GameData.TripleInt).v1.ToString());
                 }
                 if (desc.flags > 2)
                 {
                     str1 = string.Concat(str1, " ", (desc.defaultValue as GameData.TripleInt).v2.ToString());
                 }
                 strs.Add(str1);
             }
             this.fieldValue.Text = string.Join("; ", strs);
         }
     }
 }
        private void bAddReference_Click(object sender, EventArgs e)
        {
            if (this.referenceTypes.SelectedItem == null)
            {
                return;
            }
            string str = this.referenceTypes.SelectedItem.ToString();

            GameData.Desc desc      = GameData.getDesc(this.Item.type, str);
            itemType      _itemType = desc.list;
            string        str1      = "";

            if (_itemType == itemType.NULL_ITEM)
            {
                _itemType = itemType.BUILDING;
                str1      = "is node=true";
            }
            ItemDialog itemDialog = new ItemDialog(string.Concat("选择 ", str, " 的引用"), this.nav.ou.gameData, _itemType, true, str1, _itemType);

            if (itemDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!(desc.defaultValue is GameData.Instance))
                {
                    foreach (GameData.Item item in itemDialog.Items)
                    {
                        int?nullable  = null;
                        int?nullable1 = nullable;
                        nullable = null;
                        int?nullable2 = nullable;
                        nullable = null;
                        this.Item.addReference(str, item, nullable1, nullable2, nullable);
                    }
                }
                else
                {
                    foreach (GameData.Item item1 in itemDialog.Items)
                    {
                        this.Item.addInstance(item1, (GameData.Instance)desc.defaultValue);
                    }
                }
                this.refreshReferenceList();
                this.nav.refreshState(this.Item);
                this.nav.HasChanges = true;
            }
        }
        private void addItem_Click(object sender, EventArgs e)
        {
            ItemDialog itemDialog = new ItemDialog("Add Dialogue", this.nav.ou.gameData, itemType.DIALOGUE, true, "", itemType.NULL_ITEM);

            if (itemDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                foreach (GameData.Item item in itemDialog.Items)
                {
                    this.addDialogRef(item);
                }
                if (itemDialog.Items.Count > 0)
                {
                    this.refresh();
                }
                this.nav.refreshState(this.Item);
                this.nav.HasChanges = true;
            }
        }
Beispiel #6
0
        private void tree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            ItemDialog itemDialog;

            OgreSceneImporter.Node tag = (OgreSceneImporter.Node)e.Node.Tag;
            switch (this.getNodeType(tag))
            {
            case OgreSceneImporter.NodeType.PART:
            {
                itemDialog = new ItemDialog("Parts", this.nav.ou.gameData, itemType.BUILDING_PART, false, "", itemType.NULL_ITEM);
                break;
            }

            case OgreSceneImporter.NodeType.LIGHT:
            {
                itemDialog = new ItemDialog("Lights", this.nav.ou.gameData, itemType.LIGHT, false, "", itemType.NULL_ITEM);
                break;
            }

            case OgreSceneImporter.NodeType.EFFECT:
            {
                itemDialog = new ItemDialog("Effects", this.nav.ou.gameData, itemType.EFFECT, false, "", itemType.NULL_ITEM);
                break;
            }

            case OgreSceneImporter.NodeType.NODE:
            {
                itemDialog = new ItemDialog("Nodes", this.nav.ou.gameData, itemType.BUILDING, false, "is node=true", itemType.NULL_ITEM);
                break;
            }

            default:
            {
                return;
            }
            }
            if (itemDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                tag.target  = itemDialog.Items[0];
                e.Node.Text = tag.ToString();
            }
        }
Beispiel #7
0
        private void bCopyNodes_Click(object sender, EventArgs e)
        {
            itemType   item       = this.Item.type;
            string     str        = "";
            ItemDialog itemDialog = new ItemDialog("选择要从中复制节点的对象", this.nav.ou.gameData, item, true, str, itemType.NULL_ITEM);

            if (itemDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                foreach (GameData.Item item1 in itemDialog.Items)
                {
                    this.Item.clearInstances();
                    foreach (KeyValuePair <string, GameData.Instance> keyValuePair in item1.instanceData())
                    {
                        this.Item.addInstance(keyValuePair.Key, keyValuePair.Value);
                    }
                    this.nav.HasChanges = true;
                }
                this.nav.refreshState(this.Item);
                this.nav.HasChanges = true;
            }
            base.Close();
        }
        private void copyData_Click(object sender, EventArgs e)
        {
            string     str        = "";
            ItemDialog itemDialog = new ItemDialog("选择要从中复制的对象", this.nav.ou.gameData, this.Item.type, false, str, itemType.NULL_ITEM);

            if (itemDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.Item.clearInstances();
                foreach (GameData.Item item in itemDialog.Items)
                {
                    foreach (string str1 in item.referenceLists())
                    {
                        foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in item.referenceData(str1, false))
                        {
                            int?nullable  = null;
                            int?nullable1 = nullable;
                            nullable = null;
                            int?nullable2 = nullable;
                            nullable = null;
                            this.Item.addReference(str1, keyValuePair.Key, nullable1, nullable2, nullable);
                            this.Item.setReferenceValue(str1, keyValuePair.Key, keyValuePair.Value);
                        }
                    }
                    this.Item.resolveReferences(this.nav.ou.gameData);
                    foreach (KeyValuePair <string, object> value in item)
                    {
                        this.Item[value.Key] = value.Value;
                    }
                    this.nav.HasChanges = true;
                }
                this.nav.refreshState(this.Item);
                this.nav.HasChanges = true;
                this.refreshData();
                this.refreshReferenceList();
            }
        }