예제 #1
0
        private void newWordSwap_Click(object sender, EventArgs e)
        {
            baseForm mdiParent = base.MdiParent as baseForm;

            GameData.Item item = mdiParent.nav.ou.gameData.createItem(itemType.WORD_SWAPS);
            TranslationManager.TranslationDialogue translationDialogue = new TranslationManager.TranslationDialogue(item);
            TranslationManager.EnabledWordSwaps.Add(translationDialogue);
            this.listItems.Items.Add(translationDialogue);
            mdiParent.nav.showItemProperties(item);
        }
예제 #2
0
        private void deleteWordSwap_Click(object sender, EventArgs e)
        {
            baseForm mdiParent = base.MdiParent as baseForm;

            TranslationManager.TranslationDialogue selectedItem = this.listItems.SelectedItem as TranslationManager.TranslationDialogue;
            mdiParent.nav.ou.gameData.deleteItem(selectedItem.Item);
            TranslationManager.EnabledWordSwaps.Remove(selectedItem);
            this.listItems.Items.Remove(selectedItem);
            this.RefreshList();
        }
예제 #3
0
 private void contextMenu_Opening(object sender, CancelEventArgs e)
 {
     if ((itemType)this.treeCategories.SelectedNode.Tag != itemType.WORD_SWAPS)
     {
         this.deleteWordSwap.Visible      = false;
         this.newWordSwap.Visible         = false;
         this.toolStripSeparator1.Visible = false;
         return;
     }
     this.toolStripSeparator1.Visible = true;
     this.deleteWordSwap.Visible      = true;
     this.newWordSwap.Visible         = true;
     TranslationManager.TranslationDialogue selectedItem = this.listItems.SelectedItem as TranslationManager.TranslationDialogue;
     this.deleteWordSwap.Enabled = (selectedItem == null ? false : selectedItem.Item.getState() == GameData.State.OWNED);
 }
예제 #4
0
 public DialogTranslation(NavigationTranslation nt, navigation nav, TranslationManager.TranslationDialogue item)
 {
     this.InitializeComponent();
     this.nav                    = nav;
     this.navTranslation         = nt;
     this.gameData               = nav.ou.gameData;
     this.dialogueItem           = item.Item;
     this.item                   = item;
     this.txtDialogName.Text     = this.dialogueItem.Name;
     this.txtDialogName.ReadOnly = item.Item.getState() != GameData.State.OWNED;
     this.referenceList1.Exclusions.Add("lines");
     this.referenceList1.Exclusions.Add("conditions");
     this.referenceList1.Exclusions.Add("effects");
     this.referenceList1.setup(null, nav);
     this.createConversationTree(this.dialogueItem, this.tvDialog.Nodes);
 }
예제 #5
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();
        }
예제 #6
0
 private void listItems_DoubleClick(object sender, EventArgs e)
 {
     TranslationManager.TranslationDialogue selectedItem = this.listItems.SelectedItem as TranslationManager.TranslationDialogue;
     if (selectedItem != null)
     {
         baseForm mdiParent = base.MdiParent as baseForm;
         if (selectedItem.Item.getState() == GameData.State.OWNED)
         {
             mdiParent.nav.showItemProperties(selectedItem.Item);
             return;
         }
         DialogTranslation dialogTranslation = new DialogTranslation(this, mdiParent.nav, selectedItem)
         {
             MdiParent = base.MdiParent
         };
         if (this.contentFilter != null)
         {
             dialogTranslation.findLine(this.contentFilter);
         }
         dialogTranslation.Show();
     }
 }
예제 #7
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;
            }
        }