Ejemplo n.º 1
0
 private void CB_PortraitStyle_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CB_Character.SelectedIndex >= 0)
     {
         cbItem curitem = CB_Character.Items[CB_Character.SelectedIndex] as cbItem;
         CB_Character.DataSource = Characters[CB_PortraitStyle.SelectedIndex];
         bool found = false;
         for (int i = 0; i < CB_Character.Items.Count; i++)
         {
             if ((CB_Character.Items[i] as cbItem).Text == curitem.Text)
             {
                 CB_Character.SelectedIndex = i;
                 found = true;
             }
         }
         if (!found)
         {
             CB_Character.SelectedIndex = 0;
         }
     }
     else
     {
         CB_Character.DataSource    = Characters[CB_PortraitStyle.SelectedIndex];
         CB_Character.SelectedIndex = 0;
     }
     foreach (Control ctrl in Emotion_Spec)
     {
         ctrl.Enabled = (CB_PortraitStyle.Items[CB_PortraitStyle.SelectedIndex] as string) != "Critical";
     }
     if (!loaded)
     {
         return;
     }
     UpdateImage();
 }
Ejemplo n.º 2
0
 /**
  * Updates the portrait upon changes to portrait style of the current character.
  * @param sender Object that calls the change in character portrait style.
  * @param e Holds information regarding the changes.
  */
 private void CB_PortraitStyle_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CB_Character.SelectedIndex >= 0)                                           // if the index number of the character is valid (positive number)
     {
         cbItem curitem = CB_Character.Items[CB_Character.SelectedIndex] as cbItem; // get items of the character
         CB_Character.DataSource = Characters[CB_PortraitStyle.SelectedIndex];      // set the character's portrait style
         bool found = false;                                                        // indicates whether or not the item was found
         for (int i = 0; i < CB_Character.Items.Count; i++)                         // for each item in the character
         {
             if ((CB_Character.Items[i] as cbItem).Text == curitem.Text)            // if the item is the one at the selected index
             {
                 CB_Character.SelectedIndex = i;                                    // set the selected index of the character to the index of the item
                 found = true;                                                      // set indicator to indicate that the item was found
             }
         }
         if (!found)                         // if item wasn't found
         {
             CB_Character.SelectedIndex = 0; // set the selected index to 0 (by default)
         }
     }
     else                                                                                                 // if item was found
     {
         CB_Character.DataSource    = Characters[CB_PortraitStyle.SelectedIndex];                         // reset the character's portrait style to the index just found
         CB_Character.SelectedIndex = 0;                                                                  // reset the selected index to 0 (by default)
     }
     foreach (Control ctrl in Emotion_Spec)                                                               // for each emotion
     {
         ctrl.Enabled = (CB_PortraitStyle.Items[CB_PortraitStyle.SelectedIndex] as string) != "Critical"; // set emotion to true if the portrait style is not "Critical"
     }
     if (!loaded)                                                                                         // if portrait generation is not completed
     {
         return;                                                                                          // exit the function
     }
     UpdateImage();                                                                                       // if portrait generation is completed, update the dialogue image
 }
Ejemplo n.º 3
0
        public PortraitGenerator(List <string> RL, Dictionary <string, string> N, Dictionary <string, byte[]> FD)
        {
            InitializeComponent();

            Emotion_Spec = new Control[] { LBL_Emotions, CB_Emotion, CHK_Blush, CHK_SweatDrop };
            Corrin_Spec  = new Control[] { LBL_CharType, CB_Corrin, LBL_Eyes, CB_Eyes, LBL_HairStyle, CB_HairStyle, LBL_FacialFeature, CB_FacialFeature, LBL_Accessory, CB_Accessory };

            ResourceList = RL;
            Names        = N;
            FaceData     = FD;

            DefaultHairs = new Dictionary <string, int>();
            string[] HCs = Resources.HCs.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string HC in HCs)
            {
                var H = HC.Split(new[] { '\t' });
                DefaultHairs[H[0]] = int.Parse(H[1], NumberStyles.AllowHexSpecifier);
            }
            CB_HairColor.Items.Add("Custom");
            CB_HairColor.Items.AddRange(DefaultHairs.Keys.Select(s => s).ToArray());

            CB_PortraitStyle.Items.AddRange(new[] { "Standard", "Closeup", "Critical" });

            for (int i = 0; i < Characters.Length; i++)
            {
                Characters[i] = new List <cbItem>();
                foreach (string Resource in ResourceList)
                {
                    if (Resource.Contains("_" + Prefixes[i] + "_"))
                    {
                        string Character = Resource.Substring(0, Resource.IndexOf("_" + Prefixes[i] + "_"));
                        cbItem ncbi      = new cbItem
                        {
                            Value = Character,
                            Text  = Names.ContainsKey(Character) ? Names[Character] : Character
                        };
                        if (!ncbi.Text.Contains("マイユニ") && ncbi.Text != "Kana")
                        {
                            if (Characters[i].All(cbi => cbi.Text != ncbi.Text) && Characters[i].All(cbi => cbi.Value != ncbi.Value))
                            {
                                Characters[i].Add(ncbi);
                            }
                        }
                    }
                }
                Characters[i].Add(new cbItem {
                    Text = "Corrin", Value = "username"
                });
                Characters[i].Add(new cbItem {
                    Text = "Kana (M)", Value = "カンナ男"
                });
                Characters[i].Add(new cbItem {
                    Text = "Kana (F)", Value = "カンナ女"
                });
                Characters[i] = Characters[i].OrderBy(cbi => cbi.Text).ToList();
            }
            CB_Character.DisplayMember = "Text";
            CB_Character.ValueMember   = "Value";

            CB_Corrin.Items.AddRange(new[] { "Male 1", "Male 2", "Female 1", "Female 2" });
            CB_Eyes.Items.AddRange(new[] { "Style A", "Style B", "Style C", "Style D", "Style E", "Style F", "Style G" });
            CB_HairStyle.Items.AddRange(Enumerable.Range(0, 12).Select(i => i.ToString("00")).ToArray());
            CB_FacialFeature.Items.AddRange(new[] { "None", "Scratches", "Vertical Scratches", "Horizontal Scratches", "Tattoo 1", "Tattoo 2", "Tattoo 3", "Eye Mole", "Mouth Mole", "Plaster 1", "Plaster 2", "White Eyepatch", "Black Eyepatch" });
            CB_Accessory.Items.AddRange(new[] { "None", "Silver Piece", "Butterfly", "Black Ribbon", "White Ribbon", "White Rose" });

            CB_PortraitStyle.SelectedIndex = 2;

            CB_Character.SelectedIndex = CB_HairColor.SelectedIndex = CB_Corrin.SelectedIndex = CB_Eyes.SelectedIndex = CB_HairStyle.SelectedIndex = CB_FacialFeature.SelectedIndex = CB_Accessory.SelectedIndex = 0;
            CB_Accessory.Enabled       = LBL_Accessory.Enabled = CB_Corrin.SelectedIndex > 1;

            loaded = true;
            UpdateImage();
        }