// Just an ease of use function for pausing the game in a way that updates the UI
            private static void PauseGame()
            {
                GameStateSim.Pause();
                Panel_TopBar topBar = GameUI.m_Instance.m_TopBar;

                Time.timeScale     = 0f;
                topBar.m_PausedSim = true;
                topBar.m_PauseSimButton.gameObject.SetActive(false);
                topBar.m_UnPauseSimButton.gameObject.SetActive(true);
                AudioMixerManager.PauseSimulationSFX();
                InterfaceAudio.Play("ui_simulation_pause");
            }
Example #2
0
    void Start()
    {
        interfaceAudio = GetComponent <InterfaceAudio>();

        EventTrigger.Entry entry = new EventTrigger.Entry
        {
            eventID = EventTriggerType.PointerEnter
        };
        entry.callback.AddListener(delegate { interfaceAudio.PlayAudioClip(0); });


        worldNames = worldsInfo.worldNames;


        levels = Resources.LoadAll <LevelInfo>("Levels");

        for (int i = 0; i < worldNames.Count; i++)// Create the worlds
        {
            worlds.Add(Instantiate(levelsObject, worldsParent).transform);
            names.Add(Instantiate(nameObject, nameParent).GetComponent <Text>());
            names[i].text = worldNames[i];
        }

        for (int i = 0; i < levels.Length; i++)// Add the levels the the worlds
        {
            int world;
            if (levels[i].world > worlds.Count - 1)
            {
                world = worlds.Count - 1;
            }
            else
            {
                world = levels[i].world;
            }
            Instantiate(levelObject, worlds[world]).GetComponent <LevelButton>().
            Initialize(levels[i].levelName,
                       levels[i].thumbnail,
                       levels[(i > 1) ? i - 1 : 0].score,
                       levels[i].score,
                       colors[0],
                       this,
                       interfaceAudio,
                       entry);
        }

        lastIndexWithScore = GetLast();

        if (playText != null)
        {
            playText.text = (lastIndexWithScore > 0) ? "Continue" : "Play";// Set play button text
        }
        scrollContent.sizeDelta = new Vector2(scrollContent.rect.width, (worlds.Count * 100) * 1.3f);
    }
Example #3
0
        public void Update()
        {
            if (bungeeKeyBind.Value.IsDown() && shouldRun())
            {
                if (Budget.m_BungieRopeBudget == 0)
                {
                    InterfaceAudio.PlayErrorBeep();
                    return;
                }
                GameUI.m_Instance.m_Materials.OnMaterial(BridgeMaterialType.BUNGINE_ROPE);
            }

            if (enableQueued && startupComplete)
            {
                enableUI();
            }
            if (disableQueued && startupComplete)
            {
                disableUI();
            }
        }
Example #4
0
 public void Initialize(string newName, Sprite image, int previousScore, int score, Color color, LevelSelect levelSelect, InterfaceAudio interfaceAudio, EventTrigger.Entry entry)
 {
     previous = previousScore;
     SetScore(score, color);
     levelName.text   = newName;
     thumbnail.sprite = image;
     button.onClick.AddListener(delegate { levelSelect.LoadScene(newName); });
     //button.onClick.AddListener(delegate { interfaceAudio.PlayAudioClip(1); });
     if (button.IsInteractable())
     {
         eventTrigger = GetComponent <EventTrigger>();
         eventTrigger.triggers.Add(entry);
     }
 }
Example #5
0
        private void MultiplayerWindow(int id)
        {
            try {
                scrollPosition = GUILayout.BeginScrollView(scrollPosition);
                // top info / credits
                GUILayout.BeginHorizontal(GUI.skin.box);
                {
                    GUILayout.Label("Mod created by Conqu3red.", GUILayout.ExpandWidth(false));
                }
                GUILayout.EndHorizontal();

                // connection
                Vertical(() =>
                {
                    Horizontal(() => {
                        GUILayout.FlexibleSpace();
                        DrawHeader("Connection");
                        GUILayout.FlexibleSpace();
                    });
                    Horizontal(() =>
                    {
                        GUILayout.Label("Server IP:");
                        GUIValues.ip = GUILayout.TextField(GUIValues.ip, GUILayout.Width(inputWidth));
                    });
                    Horizontal(() =>
                    {
                        GUILayout.Label("Server Port:");
                        GUIValues.port = GUILayout.TextField(GUIValues.port, GUILayout.Width(inputWidth));
                    });
                    Horizontal(() =>
                    {
                        GUILayout.Label("Session Name:");
                        GUIValues.sessionName = GUILayout.TextField(GUIValues.sessionName, GUILayout.Width(inputWidth));
                    });
                    Horizontal(() =>
                    {
                        GUILayout.Label("(optional) Session Password:"******"(optional) Session Invite:");
                        GUIValues.invite = GUILayout.PasswordField(GUIValues.invite, '*', GUILayout.Width(inputWidth));
                    });

                    /*Horizontal(() => {
                     *  GUIValues.secureConnection = GUILayout.Toggle(GUIValues.secureConnection, "Connect using TLS/SSL");
                     * });*/
                    if (clientConnecting)
                    {
                        GUILayout.Button("Connecting...");
                    }
                    else if (!clientEnabled)
                    {
                        if (GUILayout.Button("Connect"))
                        {
                            InterfaceAudio.Play("ui_menu_select");
                            Connect();
                        }
                    }
                    else
                    {
                        if (GUILayout.Button(communication.isOwner ? "Disconnect (Closes Session)" : "Disconnect"))
                        {
                            InterfaceAudio.Play("ui_menu_select");
                            Disconnect();
                        }
                    }
                    if (GUIValues.ConnectionResponse != "")
                    {
                        GUILayout.Label(GUIValues.ConnectionResponse);
                    }
                }, GUI.skin.box);

                if (clientEnabled && communication.isOwner)
                {
                    Vertical(() =>
                    {
                        Horizontal(() => {
                            GUILayout.FlexibleSpace();
                            DrawHeader("Host Options");
                            GUILayout.FlexibleSpace();
                        });
                        // set password
                        Horizontal(() => {
                            GUIValues.changingPassword = GUILayout.PasswordField(GUIValues.changingPassword, '*', GUILayout.Width(inputWidth));
                            if (GUILayout.Button("Set password"))
                            {
                                InterfaceAudio.Play("ui_menu_select");
                                setPassword();
                            }
                        });
                        Horizontal(() => {
                            GUIValues.userCap = GUILayout.TextField(GUIValues.userCap, GUILayout.Width(inputWidth));
                            if (GUILayout.Button("Set user cap"))
                            {
                                InterfaceAudio.Play("ui_menu_select");
                                setUserCap();
                            }
                        });
                        if (serverInfo != null)
                        {
                            Horizontal(() => {
                                GUILayout.Label("Lobby Mode:");
                                var lobby_mode_selected = new GUIStyle(GUI.skin.button);
                                lobby_mode_selected.normal.textColor = Color.green;
                                lobby_mode_selected.hover.textColor  = Color.green;
                                var modes = Enum.GetValues(typeof(LobbyMode));
                                foreach (LobbyMode mode in modes)
                                {
                                    if (
                                        GUILayout.Button(mode.ToString().ToLower(),
                                                         serverInfo.lobbyMode == mode ? lobby_mode_selected : GUI.skin.button,
                                                         GUILayout.Width(150f)
                                                         )
                                        )
                                    {
                                        InterfaceAudio.Play("ui_menu_select");
                                        serverInfo.lobbyMode = mode;
                                        setLobbyMode(mode);
                                    }
                                }
                            });
                        }

                        Horizontal(() => {
                            GUIValues.acceptingConnections = GUILayout.Toggle(GUIValues.acceptingConnections, "Accepting Connections");
                            if (GUIValues.acceptingConnections != GUIValues._acceptingConnectionsPrevFrame)
                            {
                                InterfaceAudio.Play("ui_settings_toggle");
                                setAcceptConnections();
                            }
                            GUIValues._acceptingConnectionsPrevFrame = GUIValues.acceptingConnections;
                        });
                        if (serverInfo != null && serverInfo.lobbyMode == LobbyMode.INVITE_ONLY)
                        {
                            // create invites
                            Horizontal(() => {
                                GUILayout.Label("number of allowed invite uses:");
                                GUIValues.inviteUses = GUILayout.TextField(GUIValues.inviteUses, GUILayout.Width(inputWidth));
                            });
                            if (GUILayout.Button("Create invite"))
                            {
                                InterfaceAudio.Play("ui_menu_select");
                                CreateInvite();
                            }
                            // revoke invite/clear invites (backend implementation needed)
                            if (GUIValues.InviteResponse != "")
                            {
                                Horizontal(() => {
                                    GUILayout.TextField(GUIValues.InviteResponse, GUILayout.ExpandWidth(true));
                                    if (GUILayout.Button("Close"))
                                    {
                                        GUIValues.InviteResponse = "";
                                    }
                                });
                            }
                        }


                        // sync with all users
                        if (GUILayout.Button("Sync layout with all connected users"))
                        {
                            InterfaceAudio.Play("ui_menu_select");
                            syncLayout();
                        }
                        if (serverInfo != null && serverInfo.playerNames.Length > 0)
                        {
                            // Kick user
                            Horizontal(() => {
                                GUILayout.Label("(optional) Kick reason:");
                                GUIValues.kickUserReason = GUILayout.TextField(GUIValues.kickUserReason, GUILayout.Width(inputWidth));
                            });
                            foreach (string playerName in serverInfo.playerNames)
                            {
                                Horizontal(() => {
                                    GUILayout.Label(playerName, GUILayout.Width(inputWidth));
                                    if (GUILayout.Button("Kick"))
                                    {
                                        InterfaceAudio.Play("ui_menu_select");
                                        KickUser(playerName);
                                    }
                                });
                            }
                            if (GUIValues.kickResponse != "")
                            {
                                GUILayout.Label(GUIValues.kickResponse);
                            }
                        }


                        // set lobby mode
                    }, GUI.skin.box);
                }
                else if (clientEnabled)
                {
                    Vertical(() =>
                    {
                        Horizontal(() => {
                            GUILayout.FlexibleSpace();
                            DrawHeader("Client Options");
                            GUILayout.FlexibleSpace();
                        });
                        // sync layout
                        if (GUILayout.Button("Request layout sync from host"))
                        {
                            InterfaceAudio.Play("ui_menu_select");
                            syncLayout();
                        }
                    }, GUI.skin.box);
                }
                if (clientEnabled && serverInfo != null)
                {
                    Vertical(() =>
                    {
                        Horizontal(() => {
                            GUILayout.FlexibleSpace();
                            DrawHeader("Connection Details");
                            GUILayout.FlexibleSpace();
                        });
                        GUILayout.Label($"Session Lobby Mode: {serverInfo.lobbyMode}");
                        GUILayout.Label($"Connected Users: {serverInfo.userCount}/{serverInfo.userCap}");
                        GUILayout.Label($"Accepting New Connections: {serverInfo.acceptingConnections}");
                        GUILayout.Label($"Session frozen: {serverInfo.isFrozen}");

                        //if (GUILayout.Button("Refresh")) ConnectionInfo();
                    }, GUI.skin.box);
                }


                GUILayout.EndScrollView();
            }
            catch (ArgumentException ex) {
                instance.Logger.LogError(ex.Message);
            }
        }