public void LoadFromPlayerPrefs()
 {
     todayWorkerEntries = new List <WorkerEntry>();
     for (int i = 0; i < PlayerPrefs.GetInt("todayWorkerNums"); i++)
     {
         string      name            = PlayerPrefs.GetString("todayWorkerName_" + i);
         int         base_price      = PlayerPrefs.GetInt("todayWorkerBasePrice_" + i);
         int         tier            = PlayerPrefs.GetInt("todayWorkerTier_" + i);
         string      colorStr        = PlayerPrefs.GetString("todayWorkerColorStr_" + i);
         int         spriteNum       = PlayerPrefs.GetInt("todayWorkerSpriteNum_" + i);
         string      proficiency0    = PlayerPrefs.GetString("todayWorkerProficiency0_" + i);
         string      proficiency1    = PlayerPrefs.GetString("todayWorkerProficiency1_" + i);
         int         proficiencStat0 = PlayerPrefs.GetInt("todayWorkerProficiencyStat0_" + i);
         int         proficiencStat1 = PlayerPrefs.GetInt("todayWorkerProficiencyStat1_" + i);
         WorkerEntry entry           = new WorkerEntry(name, base_price, tier, colorStr, spriteNum,
                                                       new List <string> {
             proficiency0, proficiency1
         }, new List <int> {
             proficiencStat0, proficiencStat1
         });
         todayWorkerEntries.Add(entry);
     }
 }
    public List <WorkerEntry> GenerateWorkerEntries(int max_slots, int level)
    {
        List <WorkerEntry> employees = new List <WorkerEntry>();
        // totaly there are 5 stations ranged from 0 to 4, each number indicated the working ability at the related station
        int num = UnityEngine.Random.Range(3, max_slots + 1);

        for (int e = 0; e < num; e++)
        {
            string        name             = names[UnityEngine.Random.Range(0, names.Count)] + " " + names[UnityEngine.Random.Range(0, names.Count)];
            int           luckyNum         = UnityEngine.Random.Range(1, 151 - 5 * level);
            string        proficiency0     = "";
            string        proficiency1     = "";
            int           proficiencStat0  = 1;
            int           proficiencStat1  = 0;
            List <string> workstationNames = new List <string>(workstationShopMasterController.var_name_to_item_entry.Keys);
            if (luckyNum < level) // rarest
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = 3;
                if (true)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];
                    proficiencStat1 = 3;
                }
            }
            else if (luckyNum < level * 3)// very rare
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = 3;
                if (luckyNum % 2 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = UnityEngine.Random.Range(2, 4);
                }
            }
            else if (luckyNum < level * 5)// quite rare
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = 3;
                if (luckyNum % 2 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = UnityEngine.Random.Range(1, 4);
                }
            }
            else if (luckyNum < level * 7)// rare
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = UnityEngine.Random.Range(2, 4);
                if (luckyNum % 2 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = UnityEngine.Random.Range(1, 3);
                }
            }
            else if (luckyNum < level * 10)// common (50%) at level 5, ~7.5% at level 1
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = UnityEngine.Random.Range(2, 4);
                if (luckyNum % 2 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = UnityEngine.Random.Range(1, 3);
                }
            }
            else if (luckyNum < level * 15)// ~75% at level 5, ~10% at level 1
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = UnityEngine.Random.Range(2, 4);
                if (luckyNum % 3 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = UnityEngine.Random.Range(1, 3);
                }
            }
            else if (luckyNum < level * 20)// 100% at level 5, ~15% at level 1
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = UnityEngine.Random.Range(2, 4);
                if (luckyNum % 3 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = UnityEngine.Random.Range(1, 3);
                }
            }
            else if (luckyNum < level * 30)// ~20% at level 1, ~40% at level 2
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = UnityEngine.Random.Range(1, 4);
                if (luckyNum % 3 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = 1;
                }
            }
            else
            {
                int workstation_index = UnityEngine.Random.Range(0, workstationNames.Count);
                proficiency0    = workstationNames[workstation_index];
                proficiencStat0 = UnityEngine.Random.Range(1, 3);
                if (luckyNum % 3 == 0)
                {
                    proficiency1    = workstationNames[(workstation_index + UnityEngine.Random.Range(1, workstationNames.Count)) % workstationNames.Count];;
                    proficiencStat1 = 1;
                }
            }
            int    tier       = proficiencStat0 + proficiencStat1 - 1;
            int    base_price = (tier + 1) * 500 + UnityEngine.Random.Range(-300, 300);
            string colorStr   = colors[UnityEngine.Random.Range(0, colors.Count)];
            int    spriteNum  = UnityEngine.Random.Range(0, init_sprites.Length);

            WorkerEntry entry = new WorkerEntry(name, base_price, tier, colorStr, spriteNum,
                                                new List <string> {
                proficiency0, proficiency1
            }, new List <int> {
                proficiencStat0, proficiencStat1
            });
            employees.Add(entry);
        }
        return(employees);
    }