Example #1
0
        private void listItems_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            TranslationManager.TranslationDialogue item = this.listItems.Items[e.Index] as TranslationManager.TranslationDialogue;
            Color controlText = SystemColors.ControlText;

            switch (item.State)
            {
            case TranslationManager.DialogueTranslationState.NULL:
            {
                controlText = Color.Red;
                break;
            }

            case TranslationManager.DialogueTranslationState.NEW:
            {
                controlText = Color.Blue;
                break;
            }

            case TranslationManager.DialogueTranslationState.ORIGINAL_MODIFIED:
            {
                controlText = Color.DarkOrange;
                break;
            }

            case TranslationManager.DialogueTranslationState.OK:
            {
                controlText = SystemColors.ControlText;
                break;
            }
            }
            if (item.Item.getState() == GameData.State.OWNED)
            {
                controlText = Color.DarkGreen;
            }
            TextRenderer.DrawText(e.Graphics, item.ToString(), e.Font, e.Bounds, controlText, TextFormatFlags.Default);
            e.DrawFocusRectangle();
        }
Example #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;
            }
        }