public void Populate()
 {
     foreach (var adviceData in DB.Instance.lawyerAdvices.items)
     {
         AdviceSpoiler s = Instantiate(lawyerAdviceControlPfb, contentRoot);
         s.adviceState = new AdviceState()
         {
             id    = adviceData.id,
             found = true
         };
         s.onSwitchOnOff += OnSpoilerSwitch;
         s.Init();
         s.SetCaption(adviceData.caption);
         s.SetSpoilerText(adviceData.text);
         advices.Add(s);
     }
 }
Пример #2
0
        public void Populate()
        {
            Dictionary <CompanionData.ItemID, int> adviceCountByCompanion = new Dictionary <CompanionData.ItemID, int>();

            foreach (var adviceState in Inventory.Instance.worldState.Value.unicornAdvicesState.unicornAdviceStates)
            {
                AdviceSpoiler s = Instantiate(adviceControlPfb, contentRoot);
                s.adviceState = adviceState;
                s.Init();
                s.onSwitchOnOff += OnSpoilerSwitch;
                int    adviceCount    = adviceCountByCompanion.Get(adviceState.data.companionId);
                var    cs             = Inventory.Instance.worldState.Value.GetCompanion(adviceState.data.companionId);
                string spoilerCaption = $"{cs.Data.name}. Совет {adviceCount}";
                adviceCountByCompanion[adviceState.data.companionId] = adviceCount + 1;
                s.SetCaption(spoilerCaption);
                s.SetSpoilerText(adviceState.data.text);
                advices.Add(s);
            }
        }