예제 #1
0
 protected override void ShowScrollViewElements(int marginTop, GUIStyle labelStyle)
 {
     if (TrainingUi.scrollBarsToZero)
     {
         base.SetScrollbarPosition(Vector2.zero);
         TrainingUi.scrollBarsToZero = false;
     }
     if (this.updateTime == 60)
     {
         this.totalPhysicalGain = new CDouble();
     }
     using (List <Training> .Enumerator enumerator = App.State.AllTrainings.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             Training training = enumerator.Current;
             labelStyle.fontSize = GuiBase.FontSize(16);
             double percent = 0.0;
             if (training.CapCount > 1)
             {
                 percent = training.getPercent();
             }
             GuiBase.CreateProgressBar(marginTop, percent, training.Name, training.Description, GuiBase.progressBg, GuiBase.progressFgBlue);
             GUI.Label(new Rect(GuiBase.Width(230f), GuiBase.Height((float)marginTop), GuiBase.Width(110f), GuiBase.Height(30f)), string.Empty + training.LevelText);
             GUI.Label(new Rect(GuiBase.Width(330f), GuiBase.Height((float)marginTop), GuiBase.Width(100f), GuiBase.Height(30f)), string.Empty + training.ShadowCloneCount);
             if (training.IsAvailable)
             {
                 if (this.updateTime == 60 && training.ShadowCloneCount > 0)
                 {
                     int num = training.ShadowCloneCount.ToInt();
                     if (training.CapCount < num)
                     {
                         num = training.CapCount;
                     }
                     this.totalPhysicalGain += training.PowerGainInSec(num);
                 }
                 if (GUI.Button(new Rect(GuiBase.Width(450f), GuiBase.Height((float)marginTop), GuiBase.Width(40f), GuiBase.Height(30f)), "+"))
                 {
                     int value = App.State.GameSettings.ClonesToAddCount;
                     if (Event.current.button == 1)
                     {
                         value = 28;
                     }
                     training.AddCloneCount(value);
                     if (App.State.GameSettings.SyncTrainingSkill)
                     {
                         Skill skill = App.State.AllSkills.FirstOrDefault((Skill x) => x.TypeEnum == (Skill.SkillType)training.TypeEnum);
                         if (skill != null && skill.IsAvailable)
                         {
                             skill.AddCloneCount(value);
                         }
                     }
                 }
                 if (GUI.Button(new Rect(GuiBase.Width(500f), GuiBase.Height((float)marginTop), GuiBase.Width(40f), GuiBase.Height(30f)), "-"))
                 {
                     training.RemoveCloneCount(App.State.GameSettings.ClonesToAddCount);
                     if (App.State.GameSettings.SyncTrainingSkill)
                     {
                         Skill skill2 = App.State.AllSkills.FirstOrDefault((Skill x) => x.TypeEnum == (Skill.SkillType)training.TypeEnum);
                         if (skill2 != null && skill2.IsAvailable)
                         {
                             skill2.RemoveCloneCount(App.State.GameSettings.ClonesToAddCount);
                         }
                     }
                 }
                 if (GUI.Button(new Rect(GuiBase.Width(550f), GuiBase.Height((float)marginTop), GuiBase.Width(50f), GuiBase.Height(30f)), "CAP"))
                 {
                     Skill skill3 = null;
                     if (App.State.GameSettings.SyncTrainingSkill)
                     {
                         skill3 = App.State.AllSkills.FirstOrDefault((Skill x) => x.TypeEnum == (Skill.SkillType)training.TypeEnum);
                     }
                     training.RemoveCloneCount(9999999);
                     if (skill3 != null && skill3.IsAvailable)
                     {
                         skill3.RemoveCloneCount(9999999);
                     }
                     int num2 = App.State.Clones.IdleClones();
                     if (skill3 != null && skill3.IsAvailable)
                     {
                         num2 /= 2;
                     }
                     if (num2 > 0)
                     {
                         int num3 = training.DurationInMS(1) / 30 + 1;
                         int i    = num3;
                         int num4 = 2;
                         while (i > num2)
                         {
                             i = num3 / num4 + 1;
                             num4++;
                             if (num4 > App.State.Clones.MaxShadowClones)
                             {
                                 return;
                             }
                         }
                         training.AddCloneCount(i);
                         if (skill3 != null && skill3.IsAvailable)
                         {
                             skill3.AddCloneCount(i);
                         }
                     }
                 }
             }
             marginTop += 35;
         }
     }
     if (this.updateTime == 60)
     {
         this.updateTime = 0;
     }
     this.updateTime++;
 }