Exemplo 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();
 }
Exemplo n.º 2
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 };
            Kamui_Spec = new Control[] { LBL_CharType, CB_Kamui, LBL_Eyes, CB_Eyes, LBL_HairStyle, CB_HairStyle };

            this.ResourceList = RL;
            this.Names = N;
            this.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], System.Globalization.NumberStyles.AllowHexSpecifier);
            }
            CB_HairColor.Items.Add("Custom");
            CB_HairColor.Items.AddRange(DefaultHairs.Keys.Select(s => s as string).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();
                        ncbi.Value = Character;
                        if (Names.ContainsKey(Character))
                            ncbi.Text = Names[Character];
                        else
                            ncbi.Text = Character;
                        if (!ncbi.Text.Contains("マイユニ") && ncbi.Text != "Kanna")
                        {
                            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 = "Kamui", Value = "username" });
                Characters[i].Add(new cbItem { Text = "Kanna (M)", Value = "カンナ男" });
                Characters[i].Add(new cbItem { Text = "Kanna (F)", Value = "カンナ女" });
                Characters[i] = Characters[i].OrderBy(cbi => cbi.Text).ToList();
            }
            CB_Character.DisplayMember = "Text";
            CB_Character.ValueMember = "Value";

            CB_Kamui.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_PortraitStyle.SelectedIndex = 2;

            CB_Character.SelectedIndex = CB_HairColor.SelectedIndex = CB_Kamui.SelectedIndex = CB_Eyes.SelectedIndex = CB_HairStyle.SelectedIndex = 0;

            loaded = true;
            UpdateImage();
        }
Exemplo 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 };
            Kamui_Spec   = new Control[] { LBL_CharType, CB_Kamui, 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 != "Kanna")
                        {
                            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 = "Kamui", Value = "username"
                });
                Characters[i].Add(new cbItem {
                    Text = "Kanna (M)", Value = "カンナ男"
                });
                Characters[i].Add(new cbItem {
                    Text = "Kanna (F)", Value = "カンナ女"
                });
                Characters[i] = Characters[i].OrderBy(cbi => cbi.Text).ToList();
            }
            CB_Character.DisplayMember = "Text";
            CB_Character.ValueMember   = "Value";

            CB_Kamui.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_Kamui.SelectedIndex = CB_Eyes.SelectedIndex = CB_HairStyle.SelectedIndex = CB_FacialFeature.SelectedIndex = CB_Accessory.SelectedIndex = 0;
            CB_Accessory.Enabled       = LBL_Accessory.Enabled = CB_Kamui.SelectedIndex > 1;

            loaded = true;
            UpdateImage();
        }