Beispiel #1
0
    void ResearchItemGUI(int _idx)
    {
        rt = GUILayoutUtility.GetRect(new GUIContent(""), GUI_bindings.Instance.ButtonMainMenu());

        if (GUIHelpers.goodButton(rt, ""))
        {
            if (this.research_items_keys[_idx] == "cpu_pool")
            {
                this.research_item_description = string.Format(G.strings["cpu_pool"] + "\n---\n" + G.strings["research_cpu_pool"]);
            }
            else if (this.research_items_keys[_idx] == "jobs")
            {
                long profit = long.Parse(G.jobs[G.get_job_level()][0]);
                if (G.techs["Advanced Simulacra"].done)
                {
                    profit = (long)(profit * 1.1f);
                }
                this.research_item_description = string.Format("{0}\n{1} money per CPU per day.\n---\n{2}", G.jobs[G.get_job_level()][3], profit, G.jobs[G.get_job_level()][2]);
            }
            else
            {
                this.research_item_description = G.techs[this.research_items_keys[_idx]].get_info();
            }
        }

        GUI.Label(new Rect(rt.x, rt.y, rt.width / 4 * 3, rt.height / 2), this.research_items_names[_idx], GUI_bindings.Instance.LabelAlt(false, null, true));
        GUI.Label(new Rect(rt.x + rt.width / 4 * 3, rt.y, rt.width / 3, rt.height / 2), G.to_money((long)this.sliders[_idx]), GUI_bindings.Instance.LabelAlt(false, null, false));


        if (!this.research_item_notavailable[_idx])
        {
            this.sliders[_idx] = Mathf.Round(
                GUI.HorizontalSlider(new Rect(rt.x, rt.y + rt.height / 2, rt.width, rt.height / 2), this.sliders[_idx], 0f, this.slidersMaxValues[_idx])
                );
        }
        else
        {
            if (GUI.Button(new Rect(rt.x, rt.y + rt.height / 2, rt.width / 2, rt.height / 2), "?"))
            {
                // update this.research_danger_level; not set if shown && clicked without sliders changed
                string key = this.research_items_keys[_idx];
                this.research_danger_level = this.danger_for(key);

                this.researchExplanationGUI = this.ResearchExplanationGUI;
                G.play_sound();
            }
        }

        if (this.sliders[_idx] != this.slidersPrevious[_idx])
        {
            this.slidersPrevious[_idx] = this.sliders[_idx];

            // handle slide
            G.pl.cpu_usage[this.research_items_keys[_idx]] = (long)Mathf.Round(this.sliders[_idx]);

            this.dirty_count = true;

            // update item plus all other items, too =>
            for (int i = 0; i < this.research_items_keys.Count; i++)
            {
                this.update_item(i);
            }
        }
    }