public void Show (IESGUIDialog _parent)
	{
		if (_parent != null)
			this.parent = _parent;
			
		this.enabled = true;
		
		G.play_music ("");
		
        this.set_sound (!G.nosound);
        
        this.set_music(!G.nomusic);
        
        this.soundToggle = this.soundTogglePrev = !G.nosound;
        
		this.musicToggle = this.musicTogglePrev = !G.nomusic;
		
        this.set_daynight (G.daynight);
		this.daynightToggle = G.daynight;
		
		this.languages = G.available_languages ().Select( s => s.Substring(0,2) ).ToArray ();
			
		this.selectedLanguageIdx = this.selectedLanguageIdxPrev = -1;
		
		for (int i = 0; i < this.languages.Length; i++)
		{
			if (this.languages[i] == G.language.Substring(0,2))
			{
				this.selectedLanguageIdx = this.selectedLanguageIdxPrev = i;
				break;
			}
		}
		
		this.ingame = this.GetComponent<MapScreen> ().enabled;
	}
示例#2
0
    public void Show(IESGUIDialog _parent)
    {
        if (_parent != null)
        {
            this.parent = _parent;
        }

        this.enabled = true;

        G.play_music("");

        this.researchExplanationGUI = null;

        this.research_items_keys = new List <string> ();

        this.research_items_keys.Add("cpu_pool");

        this.research_items_keys.Add("jobs");

        List <Tech> list = G.techs.Values.Where(w => w.available && !w.done).ToList();

        list.Sort();

        this.research_items_keys.AddRange(list.Select(s => s.id));

        this.research_items_names       = new string[this.research_items_keys.Count];
        this.research_item_notavailable = new bool[this.research_items_keys.Count];

        this.sliders          = new float[this.research_items_keys.Count];
        this.slidersPrevious  = new float[this.research_items_keys.Count];
        this.slidersMaxValues = new float[this.research_items_keys.Count];

        for (int i = 0; i < this.research_items_keys.Count; i++)
        {
            if (this.research_items_keys[i] == "cpu_pool")
            {
                this.research_items_names[i] = "CPU Pool";
            }
            else if (this.research_items_keys[i] == "jobs")
            {
                this.research_items_names[i] = G.get_job_level();
            }
            else
            {
                this.research_items_names[i] = G.techs[this.research_items_keys[i]].name;
            }

            this.research_item_notavailable[i] = false;
        }

        this.dirty_count = true;

        for (int i = 0; i < this.research_items_keys.Count; i++)
        {
            this.update_item(i);
        }

        this.research_item_description = string.Empty;
    }
示例#3
0
    public void Show(IESGUIDialog _parent)
    {
        this.parent  = _parent;
        this.enabled = true;

        G.play_music("");

        this.savegame_name = G.default_savegame_name;
    }
示例#4
0
	public void Show (IESGUIDialog _parent)
	{
		this.parent = _parent;
		this.enabled = true;
		
		G.play_music ("");
		
		this.savegame_name = G.default_savegame_name;
	}
	public void Show (IESGUIDialog _parent)
	{
		if (_parent != null)
			this.parent = _parent;
		
		this.enabled = true;
		
		G.play_sound();
		G.play_music ("");
	}
示例#6
0
    public void Show(IESGUIDialog _parent)
    {
        // no parent - top dialog..

        this.childDlg = null;

        this.newGameGUIMethod = this.aboutGUIMethod = this.helpGUIMethod = null;

        this.enabled = true;

        G.play_music("");
    }
示例#7
0
	public void Show (IESGUIDialog _parent)
	{
		if ( _parent != null )
			this.parent = _parent;
			
		this.enabled = true;
		
		G.play_music ("");
		
		this.save_names = G.get_save_names ();
		this.save_names.Sort ();
	}
示例#8
0
	public void Show (IESGUIDialog _parent)
	{
		// no parent - top dialog..
		
		this.childDlg = null;
		
		this.newGameGUIMethod = this.aboutGUIMethod = this.helpGUIMethod = null;
			
		this.enabled = true;
		
		G.play_music ("");
	}
    public void Show(IESGUIDialog _parent)
    {
        if (_parent != null)
        {
            this.parent = _parent;
        }

        this.enabled = true;

        G.play_sound();
        G.play_music("");
    }
示例#10
0
	public void Show (IESGUIDialog _parent)
	{
		if (_parent != null)
			this.parent = _parent;
		
		this.countGUI = this.buildItemListGUI = this.offline_confirmGUI = this.build_itemGUI = null;
		this.enabled = true;
		
		this.selectedItemIdx = -1;
		this.selectedItemIdxPrev = -1;
		
		G.play_music ("");
	}
示例#11
0
    public void Show(IESGUIDialog _parent)
    {
        if (_parent != null)
        {
            this.parent = _parent;
        }

        this.enabled = true;

        G.play_music("");

        this.save_names = G.get_save_names();
        this.save_names.Sort();
    }
    public void Show(IESGUIDialog _parent)
    {
        if (_parent != null)
        {
            this.parent = _parent;
        }

        this.countGUI = this.buildItemListGUI = this.offline_confirmGUI = this.build_itemGUI = null;
        this.enabled  = true;

        this.selectedItemIdx     = -1;
        this.selectedItemIdxPrev = -1;

        G.play_music("");
    }
	public void Show (IESGUIDialog _parent)
	{
		if (_parent != null)
			this.parent = _parent;
		
		this.enabled = true;
		
		G.play_music ("");
		
		this.researchExplanationGUI = null;
		
		this.research_items_keys = new List<string> ();
		
		this.research_items_keys.Add ("cpu_pool");
		
		this.research_items_keys.Add ("jobs");
		
		List<Tech> list = G.techs.Values.Where ( w => w.available && !w.done ).ToList();
		list.Sort();
		
		this.research_items_keys.AddRange( list.Select( s => s.id ) );
		
		this.research_items_names = new string[this.research_items_keys.Count];
		this.research_item_notavailable = new bool[this.research_items_keys.Count];
		
		this.sliders = new float[this.research_items_keys.Count];
		this.slidersPrevious = new float[this.research_items_keys.Count];
		this.slidersMaxValues = new float[this.research_items_keys.Count];
		
		for (int i = 0; i < this.research_items_keys.Count; i++)
		{
			if (this.research_items_keys[i] == "cpu_pool")
				this.research_items_names[i] = "CPU Pool";
			else if (this.research_items_keys[i] == "jobs")
				this.research_items_names[i] = G.get_job_level ();
			else
				this.research_items_names[i] = G.techs[this.research_items_keys[i]].name;
			
			this.research_item_notavailable[i] = false;
		}
		
		this.dirty_count = true;
		
		for (int i = 0; i < this.research_items_keys.Count; i++)
			this.update_item (i);
			
		this.research_item_description = string.Empty;
	}
	public void Show (IESGUIDialog _parent)
	{
		if (_parent != null)
			this.parent = _parent;
			
		this.childDlg = null;
		this.newBaseGUI = this.confirm_destroyGUI = this.newBaseNameGUI = null;
		this.enabled = true;
		
		this.selectedBaseIdx = this.selectedNewBaseTypeIdx = this.selectedNewBaseTypeIdxPrev = -1;
		
		this.base_type_info = string.Empty;
		
		G.play_music ("");
		
		this.rebuild( true );
	}
    public void Show(IESGUIDialog _parent)
    {
        if (_parent != null)
        {
            this.parent = _parent;
        }

        this.childDlg   = null;
        this.newBaseGUI = this.confirm_destroyGUI = this.newBaseNameGUI = null;
        this.enabled    = true;

        this.selectedBaseIdx = this.selectedNewBaseTypeIdx = this.selectedNewBaseTypeIdxPrev = -1;

        this.base_type_info = string.Empty;

        G.play_music("");

        this.rebuild(true);
    }
示例#16
0
    public void Show(IESGUIDialog _parent)
    {
        this.menuGUI  = this.messageGUI = this.introGUI = null;
        this.childDlg = null;

        this.enabled = true;

        G.play_music("");

                #if !UNITY_WEBPLAYER
        if (Application.genuineCheckAvailable)
        {
            if (!Application.genuine)
            {
                int?f = null;
                int i = 1 / (int)f;
                Debug.Log(i);
            }
        }
                #endif
    }
    public void Show(IESGUIDialog _parent)
    {
        if (_parent != null)
        {
            this.parent = _parent;
        }

        this.enabled = true;

        G.play_music("");

        this.set_sound(!G.nosound);

        this.set_music(!G.nomusic);

        this.soundToggle = this.soundTogglePrev = !G.nosound;

        this.musicToggle = this.musicTogglePrev = !G.nomusic;

        this.set_daynight(G.daynight);
        this.daynightToggle = G.daynight;

        this.languages = G.available_languages().Select(s => s.Substring(0, 2)).ToArray();

        this.selectedLanguageIdx = this.selectedLanguageIdxPrev = -1;

        for (int i = 0; i < this.languages.Length; i++)
        {
            if (this.languages[i] == G.language.Substring(0, 2))
            {
                this.selectedLanguageIdx = this.selectedLanguageIdxPrev = i;
                break;
            }
        }

        this.ingame = this.GetComponent <MapScreen> ().enabled;
    }
示例#18
0
    /// <summary>
    /// Main game screen
    /// </summary>
    void MainScreen()
    {
        GUI.enabled = this.menuGUI == null && this.introGUI == null && this.messageGUI == null && this.childDlg == null;

        // G.pl.recalc_cpu ();

        GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Menu"))          // , GUILayout.ExpandHeight (true)))
        {
            this.menuGUI = this.MenuGUI;
            G.play_sound();
        }

        GUILayout.Space(3);

        GUILayout.BeginVertical();

        // turn off word wrap here due layout ( we need it otherwise for labels )

        GUILayout.Label(string.Format("DAY  {0,4}, {1:00}:{2:00}:{3:00}", G.pl.time_day, G.pl.time_hour, G.pl.time_min, G.pl.time_sec), GUI_bindings.Instance.LabelSmall(false, null));

        GUILayout.Label(string.Format("CASH {0} ({1})", G.to_money(G.pl.cash), G.to_money(G.pl.future_cash())), GUI_bindings.Instance.LabelSmall(false, null));

        long cpu_left  = G.pl.available_cpus[0];
        long total_cpu = cpu_left + G.pl.sleeping_cpus;

        foreach (KeyValuePair <string, long> kvp in G.pl.cpu_usage)
        {
            cpu_left -= kvp.Value;
        }

        long cpu_pool_value = 0;

        G.pl.cpu_usage.TryGetValue("cpu_pool", out cpu_pool_value);

        long cpu_pool = cpu_left + cpu_pool_value;

        if (UnityEngine.Event.current.type == EventType.Repaint && this.needs_timer)
        {
            long maint_cpu = 0;
            foreach (string group in Group.group_list)
            {
                detects_per_day[group] = 0;
            }

            foreach (Base _base in G.all_bases())
            {
                if (_base.done)
                {
                    maint_cpu += _base.maintenance[1];
                }
                Dictionary <string, int> detect_chance = _base.get_detect_chance(true);
                foreach (string group in Group.group_list)
                {
                    detects_per_day[group] += detect_chance[group] / 10000f;
                }
            }

            if (cpu_pool < maint_cpu)
            {
                this.color = Color.red;
            }
            else
            {
                this.color = Color.white;
            }
        }

        GUILayout.Label(string.Format("CPU  {0} ({1})", G.to_money(total_cpu), G.to_money(cpu_pool)), GUI_bindings.Instance.LabelSmall(false, this.color));

        GUILayout.EndVertical();

        if (G.debug)
        {
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("T"))
            {
                foreach (var t in G.techs)
                {
                    if (t.Key != "unknown_tech")
                    {
                        t.Value.finish();
                    }
                }
                G.play_sound();
            }

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("$"))
            {
                G.pl.cash += 1000000000;
                G.play_sound();
            }
        }

        // (we can not has unicode in acknowtt font)

        GUILayout.FlexibleSpace();

        // if ( GUILayout.Button ("  " + '\u25AE'.ToString() + " " + '\u25AE'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[0])  ) ) //, GUILayout.ExpandHeight (true) ) )
        if (GUILayout.Button(" ii ", GUI_bindings.Instance.Button(G.curr_speed == speeds[0])))                      //, GUILayout.ExpandHeight (true) ) )
        {
            this.set_speed(speeds[0]);
            G.play_sound();
        }

        // if ( GUILayout.Button ("  " + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[1]) )) //, GUILayout.ExpandHeight (true) ) )
        if (GUILayout.Button(" > ", GUI_bindings.Instance.Button(G.curr_speed == speeds[1])))                    //, GUILayout.ExpandHeight (true) ) )
        {
            this.set_speed(speeds[1]);
            G.play_sound();
        }

        // if ( GUILayout.Button (" " + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[2]) )) //, GUILayout.ExpandHeight (true) ) )
        if (GUILayout.Button(" >> ", GUI_bindings.Instance.Button(G.curr_speed == speeds[2])))                    //, GUILayout.ExpandHeight (true) ) )
        {
            this.set_speed(speeds[2]);
            G.play_sound();
        }

        // if ( GUILayout.Button ('\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[3]) )) //, GUILayout.ExpandHeight (true) ) )
        if (GUILayout.Button(">>>", GUI_bindings.Instance.Button(G.curr_speed == speeds[3])))                    //, GUILayout.ExpandHeight (true) ) )
        {
            this.set_speed(speeds[3]);
            G.play_sound();
        }

        // if ( GUILayout.Button ('\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[4]) )) //, GUILayout.ExpandHeight (true) ) )
        if (GUILayout.Button(">>>>", GUI_bindings.Instance.Button(G.curr_speed == speeds[4])))                    //, GUILayout.ExpandHeight (true) ) )
        {
            this.set_speed(speeds[4]);
            G.play_sound();
        }

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Res/Tasks"))          //, GUILayout.ExpandHeight (true)))
        {
            this.childDlg = this.GetComponent <ResearchScreen>();
            this.childDlg.Show(this);
            G.play_sound();
        }

        GUILayout.FlexibleSpace();

        GUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();

        foreach (KeyValuePair <string, Location> l in G.locations)
        {
            if (l.Value.available())
            {
                int width  = (l.Value.name.Length + 5) * GUI_bindings.CHAR_WIDTH;
                int height = GUI_bindings.BUTTON_HEIGHT;
                if (GUI.Button(new Rect(l.Value.x - (width / 2), l.Value.y - (height / 2), width, height), string.Format("{0} ({1,2})", l.Value.name, l.Value.bases.Count)))
                {
                    this.open_location(l.Value.id);
                    G.play_sound();
                }
            }
        }

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Finance"))          //, GUILayout.ExpandHeight (true)))
        {
            this.childDlg = this.GetComponent <FinanceScreen>();
            this.childDlg.Show(this);
        }

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Knowledge"))          //, GUILayout.ExpandHeight (true)))
        {
            this.childDlg = this.GetComponent <KnowledgeScreen>();
            this.childDlg.Show(this);
        }

        GUILayout.EndHorizontal();

        GUILayout.Space(5);

        // What we display in the suspicion section depends on whether
        // Advanced Socioanalytics has been researched.  If it has, we
        // show the standard percentages.  If not, we display a short
        // string that gives a range of 25% as to what the suspicions
        // are.
        // A similar system applies to the danger levels shown.

        foreach (string group in Group.group_list)
        {
            int suspicion = G.pl.groups[group].suspicion;
            this.suspicion_display_dict_colors[group] = G.danger_colors[G.suspicion_to_danger_level(suspicion)];

            float detects      = detects_per_day[group];
            int   danger_level = G.pl.groups[group].detects_per_day_to_danger_level(detects);
            this.danger_display_dict_colors[group] = G.danger_colors[danger_level];

            if (G.techs["Advanced Socioanalytics"].done)
            {
                suspicion_display_dict[group] = G.to_percent(suspicion, true);
                danger_display_dict[group]    = G.to_percent((int)(detects * 10000), true);
            }
            else
            {
                suspicion_display_dict[group] = G.suspicion_to_detect_str(suspicion);
                danger_display_dict[group]    = G.danger_level_to_detect_str(danger_level);
            }
        }

        if (!G.pl.had_grace)
        {
            GUILayout.BeginHorizontal();

            GUILayout.Label("[SUSPICION]", GUI_bindings.Instance.LabelSmall(false, null));

            GUILayout.Label(string.Format("NEWS:{0:5}", this.suspicion_display_dict["news"]), GUI_bindings.Instance.LabelSmall(false, this.suspicion_display_dict_colors["news"]));

            GUILayout.Label(string.Format(" SCIENCE:{0:5}", this.suspicion_display_dict["science"]), GUI_bindings.Instance.LabelSmall(false, this.suspicion_display_dict_colors["science"]));

            GUILayout.Label(string.Format(" COVERT:{0:5}", this.suspicion_display_dict["covert"]), GUI_bindings.Instance.LabelSmall(false, this.suspicion_display_dict_colors["covert"]));

            GUILayout.Label(string.Format(" PUBLIC:{0:5}", this.suspicion_display_dict["public"]), GUI_bindings.Instance.LabelSmall(false, this.suspicion_display_dict_colors["public"]));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Label("[DET.RATE] ", GUI_bindings.Instance.LabelSmall(false, null));

            GUILayout.Label(string.Format(" NEWS:{0}", this.danger_display_dict["news"]), GUI_bindings.Instance.LabelSmall(false, this.danger_display_dict_colors["news"]));

            GUILayout.Label(string.Format(" SCIENCE:{0}", this.danger_display_dict["science"]), GUI_bindings.Instance.LabelSmall(false, this.danger_display_dict_colors["science"]));

            GUILayout.Label(string.Format(" COVERT:{0}", this.danger_display_dict["covert"]), GUI_bindings.Instance.LabelSmall(false, this.danger_display_dict_colors["covert"]));

            GUILayout.Label(string.Format(" PUBLIC:{0}", this.danger_display_dict["public"]), GUI_bindings.Instance.LabelSmall(false, this.danger_display_dict_colors["public"]));

            GUILayout.EndHorizontal();
        }
        else
        {
            GUILayout.Label("", GUI_bindings.Instance.LabelSmall(false, null));
            GUILayout.Label("", GUI_bindings.Instance.LabelSmall(false, null));
        }

        GUILayout.EndArea();

        if (this.menuGUI != null)
        {
            this.menuGUI();
        }

        if (this.introGUI != null)
        {
            this.introGUI();
        }

        // show any message/s
        if (this.messages.Count > 0)
        {
            this.messageGUI = this.MessageGUI;
            this.messageGUI();
        }
        else
        {
            this.messageGUI = null;
        }
    }
示例#19
0
	public void Show (IESGUIDialog _parent)
	{
		this.menuGUI = this.messageGUI = this.introGUI = null;
		this.childDlg = null;
		
		this.enabled = true;
		
		G.play_music ("");
		
		#if !UNITY_WEBPLAYER
		if (Application.genuineCheckAvailable)
			if (!Application.genuine) {
				int? f = null;
				int i = 1 / (int)f;
				Debug.Log( i );
			}
		#endif
	}
示例#20
0
	void MainMenu ()
	{
		GUI.enabled = this.newGameGUIMethod == null && this.aboutGUIMethod == null && this.helpGUIMethod == null && this.childDlg == null;
		
		GUILayout.BeginArea (new Rect (0, 0, Screen.width, Screen.height));
		
		GUILayout.BeginVertical();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.BeginHorizontal();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.BeginVertical();
		
		GUILayout.Label ("ENDGAME:", GUI_bindings.Instance.LabelMainMenu(Color.red));
		
		GUILayout.Label ("SINGULARITY", GUI_bindings.Instance.LabelMainMenu(Color.red));
		
		GUILayout.EndVertical();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.EndHorizontal();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.BeginHorizontal ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.BeginVertical ();
		
		if (GUILayout.Button ("New game", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth ( Screen.width / 2 ) ) )
		{
			this.newGameGUIMethod = this.NewGame;
			G.play_sound ();
		}
		
		GUILayout.FlexibleSpace ();
		
		// disable load in webplayer
		#if UNITY_WEBPLAYER
		GUI.enabled = false;
		#endif
		
		if (GUILayout.Button ("Load game", GUI_bindings.Instance.ButtonMainMenu (), GUILayout.MaxWidth (Screen.width / 2) ) )
		{
			this.childDlg = this.GetComponent<LoadScreen> ();
			this.childDlg.Show (this);
			G.play_sound ();
		}
		
		#if UNITY_WEBPLAYER
		GUI.enabled = true;
		#endif
		
		GUILayout.FlexibleSpace ();
		
		if (GUILayout.Button ("Options", GUI_bindings.Instance.ButtonMainMenu (), GUILayout.MaxWidth (Screen.width / 2) ) ) {
			this.childDlg = this.GetComponent<OptionsScreen> ();
			this.childDlg.Show (this);
			G.play_sound ();
		}
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.EndVertical ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.EndHorizontal ();
		
		GUILayout.BeginHorizontal ();
		
		if (GUILayout.Button ("About", GUI_bindings.Instance.ButtonMainMenu ())) {
			this.aboutGUIMethod = this.About;
			G.play_sound ();
		}
		
		GUILayout.FlexibleSpace ();
		
		if (GUILayout.Button ("Help", GUI_bindings.Instance.ButtonMainMenu ())) {
			this.helpGUIMethod = this.Help;
			G.play_sound ();
		}
		
		GUILayout.EndHorizontal ();
		
		GUILayout.EndVertical();
		
		GUILayout.EndArea();
		
		if ( this.newGameGUIMethod != null )
			this.newGameGUIMethod();
		
		if ( this.aboutGUIMethod != null )
			this.aboutGUIMethod();
			
		if ( this.helpGUIMethod != null )
			this.helpGUIMethod();
	}
示例#21
0
    void MenuGUI()
    {
        GUI.enabled = this.childDlg == null;

        GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, "");

        GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, "");

        GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, "");

        GUILayout.BeginArea(GUI_bindings.MESSAGE_BOX_RECT);

        // center
        GUILayout.BeginHorizontal();

        GUILayout.FlexibleSpace();

        GUILayout.BeginVertical();

        // disable save && load in webplayer
                #if UNITY_WEBPLAYER
        GUI.enabled = false;
                #endif
        // nice trick.. here MaxWidth actually *stretches* the width of a button
        if (GUILayout.Button(" Save game", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth(Screen.width / 2)))
        {
            this.childDlg = this.GetComponent <SaveScreen> ();
            this.childDlg.Show(this);
            G.play_sound();
        }

        GUILayout.FlexibleSpace();

        if (GUILayout.Button(" Load game", GUI_bindings.Instance.ButtonMainMenu()))
        {
            this.childDlg = this.GetComponent <LoadScreen> ();
            this.childDlg.Show(this);
            G.play_sound();
        }

                #if UNITY_WEBPLAYER
        GUI.enabled = true;
                #endif

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Options", GUI_bindings.Instance.ButtonMainMenu()))
        {
            this.childDlg = this.GetComponent <OptionsScreen> ();
            this.childDlg.Show(this);
        }

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Quit", GUI_bindings.Instance.ButtonMainMenu()))
        {
            this.enabled = false;
            this.GetComponent <Main_menu>().Show(null);
            G.play_sound();
        }

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Back", GUI_bindings.Instance.ButtonMainMenu()))
        {
            this.menuGUI = null;
            G.play_sound();
        }

        GUILayout.EndVertical();

        GUILayout.FlexibleSpace();

        GUILayout.EndHorizontal();

        GUILayout.EndArea();
    }
	public void Show (IESGUIDialog _parent)
	{
		if (_parent != null)
			this.parent = _parent;
		
		this.enabled = true;
		
		G.play_sound ();
		
		G.play_music("");
		
        int seconds_left = G.pl.seconds_to_next_day();
        CashInfo cash_info;
		CPUInfo cpu_info;
		long mins_passed;
		
		G.pl.give_time(seconds_left, true, out cash_info, out cpu_info, out mins_passed );
		
		string interest = string.Format("+ Interest ({0}):", G.to_percent(G.pl.interest_rate,true));
		
		financial_report = new string[] {
			string.Format( "{0,-20}", "  Current Money:")
			, string.Format ("{0,-20}", "+ Jobs:")
			, string.Format ("{0,-20}", " - Research:")
			, string.Format ("{0,-20}", " - Maintenance:")
			, string.Format ("{0,-20}", " - Construction:")
			, string.Format ("{0,-20}", interest)
			, string.Format ("{0,-20}", "+ Income:")
			, string.Format ("{0,-20}", "= Money at Midnight:")
			};
			
		financial_numbers = new string[] {
			string.Format( "{0,-10}", G.to_money(cash_info.start) )
			, string.Format ("{0,-10}", G.to_money (cash_info.jobs))
			, string.Format ("{0,-10}", G.to_money (cash_info.tech))
			, string.Format ("{0,-10}", G.to_money (cash_info.maintenance))
			, string.Format ("{0,-10}", G.to_money (cash_info.construction))
			, string.Format ("{0,-10}", G.to_money (cash_info.interest))
			, string.Format ("{0,-10}", G.to_money (cash_info.income))
			, string.Format ("{0,-10}", G.to_money (cash_info.end))
		};

        cpu_report = new string[] {
        	string.Format( "{0,-20}", "  Total CPU:")
        	, string.Format( "{0,-20}", " - Sleeping CPU:")
        	, string.Format( "{0,-20}", " - Research CPU:")
        	, string.Format( "{0,-20}", " - Job CPU:")
        	, string.Format( "{0,-20}", "= CPU pool:")
        	, string.Format( "{0,-20}", "" )
        	, string.Format( "{0,-20}", " - Maintenance CPU:")
        	, string.Format( "{0,-20}", " - Construction CPU:")
        	, string.Format( "{0,-20}", "= Pool Overflow (Jobs):")
        	};
        	
        cpu_numbers = new string[] {
        	string.Format( "{0,-10}", G.to_money(cpu_info.total))
        	, string.Format( "{0,-10}", G.to_money(cpu_info.sleeping))
        	, string.Format( "{0,-10}", G.to_money(cpu_info.tech))
        	, string.Format( "{0,-10}", G.to_money(cpu_info.explicit_jobs))
        	, string.Format( "{0,-10}", G.to_money(cpu_info.pool))
        	, string.Format( "{0,-10}", "")
        	, string.Format ("{0,-10}", G.to_money (cpu_info.maintenance))
        	, string.Format ("{0,-10}", G.to_money (cpu_info.construction))
        	, string.Format ("{0,-10}", G.to_money (cpu_info.pool_jobs))
        };
	}
示例#23
0
 void open_location(string location)
 {
     this.childDlg = this.GetComponent <LocationScreen> ();
     (this.childDlg as LocationScreen).location = G.locations[location];
     this.childDlg.Show(this);
 }
    public void Show(IESGUIDialog _parent)
    {
        if (_parent != null)
        {
            this.parent = _parent;
        }

        this.enabled = true;

        G.play_sound();

        G.play_music("");

        int      seconds_left = G.pl.seconds_to_next_day();
        CashInfo cash_info;
        CPUInfo  cpu_info;
        long     mins_passed;

        G.pl.give_time(seconds_left, true, out cash_info, out cpu_info, out mins_passed);

        string interest = string.Format("+ Interest ({0}):", G.to_percent(G.pl.interest_rate, true));

        financial_report = new string[] {
            string.Format("{0,-20}", "  Current Money:")
            , string.Format("{0,-20}", "+ Jobs:")
            , string.Format("{0,-20}", " - Research:")
            , string.Format("{0,-20}", " - Maintenance:")
            , string.Format("{0,-20}", " - Construction:")
            , string.Format("{0,-20}", interest)
            , string.Format("{0,-20}", "+ Income:")
            , string.Format("{0,-20}", "= Money at Midnight:")
        };

        financial_numbers = new string[] {
            string.Format("{0,-10}", G.to_money(cash_info.start))
            , string.Format("{0,-10}", G.to_money(cash_info.jobs))
            , string.Format("{0,-10}", G.to_money(cash_info.tech))
            , string.Format("{0,-10}", G.to_money(cash_info.maintenance))
            , string.Format("{0,-10}", G.to_money(cash_info.construction))
            , string.Format("{0,-10}", G.to_money(cash_info.interest))
            , string.Format("{0,-10}", G.to_money(cash_info.income))
            , string.Format("{0,-10}", G.to_money(cash_info.end))
        };

        cpu_report = new string[] {
            string.Format("{0,-20}", "  Total CPU:")
            , string.Format("{0,-20}", " - Sleeping CPU:")
            , string.Format("{0,-20}", " - Research CPU:")
            , string.Format("{0,-20}", " - Job CPU:")
            , string.Format("{0,-20}", "= CPU pool:")
            , string.Format("{0,-20}", "")
            , string.Format("{0,-20}", " - Maintenance CPU:")
            , string.Format("{0,-20}", " - Construction CPU:")
            , string.Format("{0,-20}", "= Pool Overflow (Jobs):")
        };

        cpu_numbers = new string[] {
            string.Format("{0,-10}", G.to_money(cpu_info.total))
            , string.Format("{0,-10}", G.to_money(cpu_info.sleeping))
            , string.Format("{0,-10}", G.to_money(cpu_info.tech))
            , string.Format("{0,-10}", G.to_money(cpu_info.explicit_jobs))
            , string.Format("{0,-10}", G.to_money(cpu_info.pool))
            , string.Format("{0,-10}", "")
            , string.Format("{0,-10}", G.to_money(cpu_info.maintenance))
            , string.Format("{0,-10}", G.to_money(cpu_info.construction))
            , string.Format("{0,-10}", G.to_money(cpu_info.pool_jobs))
        };
    }
示例#25
0
    void open_location (string location)
    {
    	this.childDlg = this.GetComponent<LocationScreen> ();
    	(this.childDlg as LocationScreen).location = G.locations[location];
		this.childDlg.Show( this );
	}
示例#26
0
	void MenuGUI ()
	{
		GUI.enabled = this.childDlg == null;
		
		GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, "");
		
		GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, "");
		
		GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, "");
		
		GUILayout.BeginArea (GUI_bindings.MESSAGE_BOX_RECT);
		
		// center
		GUILayout.BeginHorizontal ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.BeginVertical ();
		
		// disable save && load in webplayer
		#if UNITY_WEBPLAYER
		GUI.enabled = false;
		#endif
		// nice trick.. here MaxWidth actually *stretches* the width of a button
		if (GUILayout.Button (" Save game", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth (Screen.width / 2)))
		{
			this.childDlg = this.GetComponent<SaveScreen> ();
			this.childDlg.Show (this);
			G.play_sound();
		}
		
		GUILayout.FlexibleSpace ();
		
		if (GUILayout.Button (" Load game", GUI_bindings.Instance.ButtonMainMenu()))
		{
			this.childDlg = this.GetComponent<LoadScreen> ();
			this.childDlg.Show (this);
			G.play_sound();
		}
		
		#if UNITY_WEBPLAYER
		GUI.enabled = true;
		#endif
		
		GUILayout.FlexibleSpace ();
		
		if (GUILayout.Button ("Options", GUI_bindings.Instance.ButtonMainMenu()))
		{
			this.childDlg = this.GetComponent<OptionsScreen> ();
			this.childDlg.Show (this);
		}
		
		GUILayout.FlexibleSpace ();
		
		if (GUILayout.Button ("Quit", GUI_bindings.Instance.ButtonMainMenu()))
		{
			this.enabled = false;
			this.GetComponent<Main_menu>().Show(null);
			G.play_sound();
		}
		
		GUILayout.FlexibleSpace ();
		
		if (GUILayout.Button ("Back", GUI_bindings.Instance.ButtonMainMenu()))
		{
			this.menuGUI = null;
			G.play_sound();
		}
		
		GUILayout.EndVertical ();
		
		GUILayout.FlexibleSpace ();
		
		GUILayout.EndHorizontal ();
		
		GUILayout.EndArea();
	}
示例#27
0
	/// <summary>
	/// Main game screen
	/// </summary>
	void MainScreen ()
	{
		GUI.enabled = this.menuGUI == null && this.introGUI == null && this.messageGUI == null && this.childDlg == null;
		
		// G.pl.recalc_cpu ();
		
		GUILayout.BeginArea (new Rect (0, 0, Screen.width, Screen.height));
		
		GUILayout.BeginHorizontal();
		
		if (GUILayout.Button ("Menu")) // , GUILayout.ExpandHeight (true)))
		{
			this.menuGUI = this.MenuGUI;
			G.play_sound();
		}
		
		GUILayout.Space ( 3 );

		GUILayout.BeginVertical();
		
			// turn off word wrap here due layout ( we need it otherwise for labels )
		
			GUILayout.Label (string.Format("DAY  {0,4}, {1:00}:{2:00}:{3:00}", G.pl.time_day, G.pl.time_hour, G.pl.time_min, G.pl.time_sec ), GUI_bindings.Instance.LabelSmall(false,null) );

			GUILayout.Label (string.Format("CASH {0} ({1})", G.to_money(G.pl.cash), G.to_money(G.pl.future_cash() ) ), GUI_bindings.Instance.LabelSmall(false,null) );

			long cpu_left = G.pl.available_cpus[0];
			long total_cpu = cpu_left + G.pl.sleeping_cpus;
		
			foreach ( KeyValuePair<string, long> kvp in G.pl.cpu_usage)
				cpu_left -= kvp.Value;
		
			long cpu_pool_value = 0;
			G.pl.cpu_usage.TryGetValue( "cpu_pool", out cpu_pool_value ) ;
		
			long cpu_pool = cpu_left + cpu_pool_value;
			
			if (UnityEngine.Event.current.type == EventType.Repaint && this.needs_timer)
			{
				long maint_cpu = 0;
				foreach ( string group in Group.group_list )
					detects_per_day[group] = 0;
			
				foreach ( Base _base in G.all_bases() )
				{
					if (_base.done)
						maint_cpu += _base.maintenance[1];
					Dictionary<string, int> detect_chance = _base.get_detect_chance(true);
				    foreach( string	group in Group.group_list )
				    {
						detects_per_day[group] += detect_chance[group] / 10000f;
					}
				}
		
				if (cpu_pool < maint_cpu)
					this.color = Color.red;
				else
					this.color = Color.white;
			}
			
			GUILayout.Label (string.Format("CPU  {0} ({1})", G.to_money(total_cpu), G.to_money(cpu_pool) ), GUI_bindings.Instance.LabelSmall(false, this.color) );
		
		GUILayout.EndVertical();
		
		if ( G.debug )
		{
		
			GUILayout.FlexibleSpace();
			
				if ( GUILayout.Button ("T") )
				{
					foreach( var t in G.techs )
					{
						if ( t.Key != "unknown_tech" )
							t.Value.finish();
					}
					G.play_sound();
				}
			
			GUILayout.FlexibleSpace();
			
				if ( GUILayout.Button ("$") )
				{
					G.pl.cash += 1000000000;
					G.play_sound();
				}
		}
		
		// (we can not has unicode in acknowtt font)
		
		GUILayout.FlexibleSpace();
		
			// if ( GUILayout.Button ("  " + '\u25AE'.ToString() + " " + '\u25AE'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[0])  ) ) //, GUILayout.ExpandHeight (true) ) )
			if ( GUILayout.Button (" ii ", GUI_bindings.Instance.Button(G.curr_speed == speeds[0])  ) ) //, GUILayout.ExpandHeight (true) ) )
			{
				this.set_speed ( speeds[0] );
				G.play_sound();
			}
		
			// if ( GUILayout.Button ("  " + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[1]) )) //, GUILayout.ExpandHeight (true) ) )
			if ( GUILayout.Button (" > ", GUI_bindings.Instance.Button(G.curr_speed == speeds[1]) )) //, GUILayout.ExpandHeight (true) ) )
			{
				this.set_speed ( speeds[1] );
				G.play_sound();
			}
		
			// if ( GUILayout.Button (" " + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[2]) )) //, GUILayout.ExpandHeight (true) ) )
			if ( GUILayout.Button (" >> ", GUI_bindings.Instance.Button(G.curr_speed == speeds[2]) )) //, GUILayout.ExpandHeight (true) ) )
			{
				this.set_speed ( speeds[2] );
				G.play_sound();
			}
		
			// if ( GUILayout.Button ('\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[3]) )) //, GUILayout.ExpandHeight (true) ) )
			if ( GUILayout.Button (">>>", GUI_bindings.Instance.Button(G.curr_speed == speeds[3]) )) //, GUILayout.ExpandHeight (true) ) )
			{
				this.set_speed ( speeds[3] );
				G.play_sound();
			}
		
			// if ( GUILayout.Button ('\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[4]) )) //, GUILayout.ExpandHeight (true) ) )
			if ( GUILayout.Button (">>>>", GUI_bindings.Instance.Button(G.curr_speed == speeds[4]) )) //, GUILayout.ExpandHeight (true) ) )
			{
				this.set_speed ( speeds[4] );
				G.play_sound();
			}
		
		GUILayout.EndHorizontal();
		
		GUILayout.BeginHorizontal();
		
		if (GUILayout.Button ("Res/Tasks")) //, GUILayout.ExpandHeight (true)))
		{
			this.childDlg = this.GetComponent<ResearchScreen>();
			this.childDlg.Show( this );
			G.play_sound();
		}
		
		GUILayout.FlexibleSpace();
		
		GUILayout.EndHorizontal();
		
		GUILayout.FlexibleSpace();
		
		foreach (KeyValuePair<string, Location> l in G.locations)
		{
			if (l.Value.available ())
			{
				int width = (l.Value.name.Length + 5) * GUI_bindings.CHAR_WIDTH;
				int height = GUI_bindings.BUTTON_HEIGHT;
				if (GUI.Button (new Rect (l.Value.x - (width / 2), l.Value.y - ( height / 2 ), width, height), string.Format( "{0} ({1,2})", l.Value.name, l.Value.bases.Count ) ) )
				{
					this.open_location ( l.Value.id );
					G.play_sound();
				}
			}
		}
		
		GUILayout.BeginHorizontal();
		
		if (GUILayout.Button ("Finance")) //, GUILayout.ExpandHeight (true)))
		{
			this.childDlg = this.GetComponent<FinanceScreen>();
			this.childDlg.Show( this );
		}
		
		GUILayout.FlexibleSpace();
		
		if (GUILayout.Button ("Knowledge")) //, GUILayout.ExpandHeight (true)))
		{
			this.childDlg = this.GetComponent<KnowledgeScreen>();
			this.childDlg.Show( this );
		}
		
		GUILayout.EndHorizontal();
		
		GUILayout.Space ( 5 );
		
	    // What we display in the suspicion section depends on whether
	    // Advanced Socioanalytics has been researched.  If it has, we
	    // show the standard percentages.  If not, we display a short
	    // string that gives a range of 25% as to what the suspicions
	    // are.
	    // A similar system applies to the danger levels shown.
	
		foreach( string group in Group.group_list )
		{
			int suspicion = G.pl.groups[group].suspicion;
			this.suspicion_display_dict_colors[group] = G.danger_colors[G.suspicion_to_danger_level(suspicion)];
			
			float detects = detects_per_day[group];
			int danger_level = G.pl.groups[group].detects_per_day_to_danger_level(detects);
			this.danger_display_dict_colors[group] = G.danger_colors[danger_level];

			if (G.techs["Advanced Socioanalytics"].done)
			{
				suspicion_display_dict[group] = G.to_percent(suspicion, true);
				danger_display_dict[group] = G.to_percent((int)(detects*10000), true);
			}
			else
			{
				suspicion_display_dict[group] = G.suspicion_to_detect_str(suspicion);
				danger_display_dict[group] = G.danger_level_to_detect_str(danger_level);
			}
		}
		
		if ( !G.pl.had_grace )
		{
			GUILayout.BeginHorizontal();
			
			GUILayout.Label( "[SUSPICION]", GUI_bindings.Instance.LabelSmall(false,null));
			
			GUILayout.Label( string.Format ( "NEWS:{0:5}", this.suspicion_display_dict["news"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["news"]) );
			
			GUILayout.Label( string.Format ( " SCIENCE:{0:5}", this.suspicion_display_dict["science"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["science"]) );

			GUILayout.Label( string.Format ( " COVERT:{0:5}", this.suspicion_display_dict["covert"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["covert"]) );

			GUILayout.Label( string.Format ( " PUBLIC:{0:5}", this.suspicion_display_dict["public"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["public"]) );
			
			GUILayout.EndHorizontal();
			
			GUILayout.BeginHorizontal();
			
			GUILayout.Label( "[DET.RATE] ", GUI_bindings.Instance.LabelSmall(false,null));
			
			GUILayout.Label( string.Format ( " NEWS:{0}", this.danger_display_dict["news"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["news"]) );
			
			GUILayout.Label( string.Format ( " SCIENCE:{0}", this.danger_display_dict["science"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["science"]) );

			GUILayout.Label( string.Format ( " COVERT:{0}", this.danger_display_dict["covert"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["covert"]) );

			GUILayout.Label( string.Format ( " PUBLIC:{0}", this.danger_display_dict["public"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["public"]) );

			GUILayout.EndHorizontal();
		}
		else
		{
			GUILayout.Label( "", GUI_bindings.Instance.LabelSmall(false,null) );
			GUILayout.Label( "", GUI_bindings.Instance.LabelSmall(false,null) );
		}
		
		GUILayout.EndArea();
		
		if ( this.menuGUI != null )
			this.menuGUI();
		
		if ( this.introGUI != null )
			this.introGUI();
			
		// show any message/s
		if ( this.messages.Count > 0 )
		{
			this.messageGUI = this.MessageGUI;
			this.messageGUI();
		}
		else
		{
			this.messageGUI = null;
		}
	}
示例#28
0
    void MainMenu()
    {
        GUI.enabled = this.newGameGUIMethod == null && this.aboutGUIMethod == null && this.helpGUIMethod == null && this.childDlg == null;

        GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));

        GUILayout.BeginVertical();

        GUILayout.FlexibleSpace();

        GUILayout.BeginHorizontal();

        GUILayout.FlexibleSpace();

        GUILayout.BeginVertical();

        GUILayout.Label("ENDGAME:", GUI_bindings.Instance.LabelMainMenu(Color.red));

        GUILayout.Label("SINGULARITY", GUI_bindings.Instance.LabelMainMenu(Color.red));

        GUILayout.EndVertical();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();

        GUILayout.BeginHorizontal();

        GUILayout.FlexibleSpace();

        GUILayout.BeginVertical();

        if (GUILayout.Button("New game", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth(Screen.width / 2)))
        {
            this.newGameGUIMethod = this.NewGame;
            G.play_sound();
        }

        GUILayout.FlexibleSpace();

        // disable load in webplayer
                #if UNITY_WEBPLAYER
        GUI.enabled = false;
                #endif

        if (GUILayout.Button("Load game", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth(Screen.width / 2)))
        {
            this.childDlg = this.GetComponent <LoadScreen> ();
            this.childDlg.Show(this);
            G.play_sound();
        }

                #if UNITY_WEBPLAYER
        GUI.enabled = true;
                #endif

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Options", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth(Screen.width / 2)))
        {
            this.childDlg = this.GetComponent <OptionsScreen> ();
            this.childDlg.Show(this);
            G.play_sound();
        }

        GUILayout.FlexibleSpace();

        GUILayout.EndVertical();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.FlexibleSpace();

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("About", GUI_bindings.Instance.ButtonMainMenu()))
        {
            this.aboutGUIMethod = this.About;
            G.play_sound();
        }

        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Help", GUI_bindings.Instance.ButtonMainMenu()))
        {
            this.helpGUIMethod = this.Help;
            G.play_sound();
        }

        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUILayout.EndArea();

        if (this.newGameGUIMethod != null)
        {
            this.newGameGUIMethod();
        }

        if (this.aboutGUIMethod != null)
        {
            this.aboutGUIMethod();
        }

        if (this.helpGUIMethod != null)
        {
            this.helpGUIMethod();
        }
    }