public bool SetIdol(int index, IdolData idol, bool isWorkLesson, out string rejectReason) { if (index < Capacity && index >= 0) { if (idol.CheckRestriction(Restriction) == false) { rejectReason = "해당 아이돌은 조건에 맞지 않습니다."; return(false); } if (isWorkLesson) { idol.IsWorkLessonPicked = true; } IdolIndices[index] = idol.Index; if (!PersonaDic.ContainsKey(idol.Personality)) { PersonaDic.Add(idol.Personality, 0); } PersonaDic[idol.Personality]++; Count++; rejectReason = ""; return(true); } else { rejectReason = "슬롯이 다 찼습니다."; return(false); } }
public static IdolData[] Generate(int amount) { var namedata = CSVReader.Read("Data/Idol/IdolNameTable"); var datalist = new List <IdolData>(); for (int i = 0; i < amount; i++) { var data = new IdolData() { FirstName = (string)namedata[UnityEngine.Random.Range(0, namedata.Count)]["first"], LastName = (string)namedata[UnityEngine.Random.Range(0, namedata.Count)]["last"], // ImageKey Cost = 1, Vocal = 1, Dance = 1, Visual = 1, Variety = 1, Honor = 0, Fan = 0, Personality = (IdolPersonality)UnityEngine.Random.Range(1, 8) }; for (int j = 4; j < 17; j++) { bool distributed = false; do { int dice = UnityEngine.Random.Range(0, 4); if (dice == 0 && data.Vocal < 7) { data.Vocal++; distributed = true; } else if (dice == 1 && data.Dance < 7) { data.Dance++; distributed = true; } else if (dice == 2 && data.Visual < 7) { data.Visual++; distributed = true; } else if (dice == 3 && data.Variety < 7) { data.Variety++; distributed = true; } } while (!distributed); } datalist.Add(data); } return(datalist.ToArray()); }
public void SetIdol(int index, IdolData idol) { if (index < Capacity && index >= 0) { IdolIndices[index] = idol.Index; if (!PersonaDic.ContainsKey(idol.Personality)) { PersonaDic.Add(idol.Personality, 0); } PersonaDic[idol.Personality]++; Count++; } }
public void SetIdol(IdolData data) { LinkedIdol = data; CostText.text = data.Cost.ToString(); NameText.text = data.Name; IdolImage.sprite = Resources.Load <Sprite>(data.ImageKey); VocalSlider.value = data.Vocal; VocalText.text = data.Vocal.ToString(); DanceSlider.value = data.Dance; DanceText.text = data.Dance.ToString(); VisualSlider.value = data.Visual; VisualText.text = data.Visual.ToString(); VarietySlider.value = data.Variety; VarietyText.text = data.Variety.ToString(); HonorText.text = data.Honor.ToString(); FanText.text = data.Fan.ToString(); // Personality }
public static IdolData[] Generate(int amount) { var namedata = CSVReader.Read("Data/Idol/IdolNameTable"); var datalist = new List <IdolData>(); for (int i = 0; i < amount; i++) { var data = new IdolData() { FirstName = (string)namedata[UnityEngine.Random.Range(0, namedata.Count)]["first"], LastName = (string)namedata[UnityEngine.Random.Range(0, namedata.Count)]["last"], ImageKey = $"Images/Idol/chr{UnityEngine.Random.Range(0, IMAGE_COUNT)}", Vocal = 1, Dance = 1, Visual = 1, Variety = 1, Honor = 0, Fan = 0, }; int rnd = UnityEngine.Random.Range(1, 36); int sum = 0; for (int j = 1; j < 12; j++) { if (sum < rnd && rnd <= sum + PersonaPercentageTable[j]) { data.Personality = (IdolPersonality)j; break; } else { sum += PersonaPercentageTable[j]; } } for (int j = 4; j < 17; j++) { bool distributed = false; do { int dice = UnityEngine.Random.Range(0, 4); if (dice == 0 && data.Vocal < 7) { data.Vocal++; distributed = true; } else if (dice == 1 && data.Dance < 7) { data.Dance++; distributed = true; } else if (dice == 2 && data.Visual < 7) { data.Visual++; distributed = true; } else if (dice == 3 && data.Variety < 7) { data.Variety++; distributed = true; } } while (!distributed); } datalist.Add(data); } return(datalist.ToArray()); }