示例#1
0
 public void refresh(GameData.Item dialogLine)
 {
     if (dialogLine == null)
     {
         this.listView1conditions.Enabled = false;
         this.listView1conditions.Items.Clear();
         this.addCondition.Enabled    = false;
         this.removeCondition.Enabled = false;
         this.CurrentLine             = null;
         return;
     }
     this.listView1conditions.Enabled = true;
     this.addCondition.Enabled        = dialogLine.getState() != GameData.State.LOCKED;
     this.removeCondition.Enabled     = dialogLine.getState() != GameData.State.LOCKED;
     if (this.possibleConditions.Items.Count == 0)
     {
         foreach (DialogConditionEnum value in Enum.GetValues(typeof(DialogConditionEnum)))
         {
             if (value == DialogConditionEnum.DC_NONE)
             {
                 continue;
             }
             this.possibleConditions.Items.Add(value);
         }
     }
     if (this.whoBox.Items.Count == 0)
     {
         foreach (TalkerEnum talkerEnum in Enum.GetValues(typeof(TalkerEnum)))
         {
             this.whoBox.Items.Add(talkerEnum);
         }
     }
     if (this.whoBox.SelectedIndex < 0)
     {
         this.whoBox.SelectedIndex = 0;
     }
     this.listView1conditions.Items.Clear();
     if (dialogLine == null)
     {
         return;
     }
     foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in dialogLine.referenceData("conditions", false))
     {
         GameData.Item item = this.nav.ou.gameData.getItem(keyValuePair.Key);
         item.idata.ContainsKey("condition name");
         if (item.sdata.ContainsKey("compare by"))
         {
             item["compare by"] = this.methodToInt(item.sdata["compare by"]);
         }
         DialogConditionEnum dialogConditionEnum = (DialogConditionEnum)item.idata["condition name"];
         int num = keyValuePair.Value.v0;
         if (!item.idata.ContainsKey("who"))
         {
             item.idata["who"] = 0;
         }
         ListView.ListViewItemCollection items = this.listView1conditions.Items;
         TalkerEnum   item1        = (TalkerEnum)item.idata["who"];
         ListViewItem listViewItem = items.Add(item1.ToString());
         listViewItem.SubItems.Add(dialogConditionEnum.ToString());
         listViewItem.SubItems.Add(this.methodToString(item.idata["compare by"]));
         listViewItem.SubItems.Add(num.ToString());
         if (item.sdata.ContainsKey("stringvar"))
         {
             string str = item.sdata["stringvar"];
         }
         if (dialogConditionEnum == DialogConditionEnum.DC_HAS_TAG)
         {
             ListViewItem.ListViewSubItemCollection subItems = listViewItem.SubItems;
             CharacterPerceptionTags_LongTerm       characterPerceptionTagsLongTerm = (CharacterPerceptionTags_LongTerm)item.idata["tag"];
             subItems.Add(characterPerceptionTagsLongTerm.ToString());
         }
         if (dialogConditionEnum < DialogConditionEnum.DC_PERSONALITY_TAG)
         {
             continue;
         }
         ListViewItem.ListViewSubItemCollection listViewSubItemCollections = listViewItem.SubItems;
         PersonalityTags personalityTag = (PersonalityTags)item.idata["tag"];
         listViewSubItemCollections.Add(personalityTag.ToString());
     }
     this.CurrentLine = dialogLine;
 }
示例#2
0
        private void ShowLine(DialogTranslation.LineData line)
        {
            TalkerEnum item;

            PropertyGrid.PropertyGrid.Item item1;
            int num;

            this.currentLine = line;
            if (!line.data.idata.ContainsKey("speaker"))
            {
                this.lbSpeaker.Text = "-";
            }
            else
            {
                Label str = this.lbSpeaker;
                item     = (TalkerEnum)line.data.idata["speaker"];
                str.Text = item.ToString();
            }
            if (!line.data.idata.ContainsKey("target is type"))
            {
                this.lbTarget.Text = "-";
            }
            else
            {
                Label             label             = this.lbTarget;
                CharacterTypeEnum characterTypeEnum = (CharacterTypeEnum)line.data.idata["target is type"];
                label.Text = characterTypeEnum.ToString();
            }
            this.lvConditions.Items.Clear();
            foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair in line.data.referenceData("conditions", false))
            {
                GameData.Item item2 = this.gameData.getItem(keyValuePair.Key);
                if (item2.sdata.ContainsKey("compare by"))
                {
                    string        str1  = item2.sdata["compare by"];
                    GameData.Item item3 = item2;
                    if (str1 == "==")
                    {
                        num = 0;
                    }
                    else
                    {
                        num = (str1 == "<" ? 1 : 2);
                    }
                    item3["compare by"] = num;
                }
                DialogConditionEnum dialogConditionEnum = (DialogConditionEnum)item2.idata["condition name"];
                int value = keyValuePair.Value.v0;
                if (!item2.idata.ContainsKey("who"))
                {
                    item2.idata["who"] = 0;
                }
                string[] strArrays = new string[] { "==", "<", ">" };
                ListView.ListViewItemCollection items = this.lvConditions.Items;
                item = (TalkerEnum)item2.idata["who"];
                ListViewItem listViewItem = items.Add(item.ToString());
                listViewItem.SubItems.Add(dialogConditionEnum.ToString());
                listViewItem.SubItems.Add(strArrays[item2.idata["compare by"]]);
                listViewItem.SubItems.Add(value.ToString());
                if (dialogConditionEnum == DialogConditionEnum.DC_HAS_TAG)
                {
                    ListViewItem.ListViewSubItemCollection subItems = listViewItem.SubItems;
                    CharacterPerceptionTags_LongTerm       characterPerceptionTagsLongTerm = (CharacterPerceptionTags_LongTerm)item2.idata["tag"];
                    subItems.Add(characterPerceptionTagsLongTerm.ToString());
                }
                if (dialogConditionEnum < DialogConditionEnum.DC_PERSONALITY_TAG)
                {
                    continue;
                }
                ListViewItem.ListViewSubItemCollection listViewSubItemCollections = listViewItem.SubItems;
                PersonalityTags personalityTag = (PersonalityTags)item2.idata["tag"];
                listViewSubItemCollections.Add(personalityTag.ToString());
            }
            this.lvEffects.Items.Clear();
            foreach (KeyValuePair <string, GameData.TripleInt> keyValuePair1 in line.data.referenceData("effects", false))
            {
                GameData.Item item4 = this.gameData.getItem(keyValuePair1.Key);
                if (item4 == null || item4.getState() == GameData.State.REMOVED)
                {
                    this.lvEffects.Items.Add("Error - invalid reference").ForeColor = Color.Red;
                }
                else if (!item4.sdata.ContainsKey("action name"))
                {
                    DialogActionEnum dialogActionEnum = (DialogActionEnum)item4.idata["action name"];
                    this.lvEffects.Items.Add(dialogActionEnum.ToString()).SubItems.Add(keyValuePair1.Value.v0.ToString());
                }
                else
                {
                    this.lvEffects.Items.Add(item4.sdata["action name"]).SubItems.Add(keyValuePair1.Value.v0.ToString());
                }
            }
            this.referenceList1.refresh(line.data);
            this.grid.clear();
            ExtendedTranslationText extendedTranslationText = new ExtendedTranslationText();

            if ((!line.data.ContainsKey("interjection") ? false : line.data.bdata["interjection"]))
            {
                return;
            }
            foreach (TranslationManager.TranslationDialogueLine.Line line1 in line.dialogueLine.Lines)
            {
                if (!line1.IsUser)
                {
                    item1 = this.grid.addItem(line1.Key, "Translation", line1.Translation, string.Empty, new Color?(this.stateColors[(int)line1.State]), true);
                    this.grid.addItem(line1.Key, "Original", line1.Original, string.Empty, new Color?(this.stateColors[0]), false).Data = line1;
                }
                else
                {
                    item1 = this.grid.addItem("Text", line1.Key, line1.Translation, string.Empty, new Color?(this.stateColors[(int)line1.State]), true);
                }
                item1.Data     = line1;
                item1.Property = extendedTranslationText;
            }
        }