예제 #1
0
    private void Start()
    {
        GEventManager.StartListening(GEventManager.ON_PLAYER_TAKE_DAMAGE, updateDisplay);
        GEventManager.StartListening(GEventManager.ON_PLAYER_HEAL_DAMAGE, updateDisplay);

        updateDisplay();
    }
예제 #2
0
        protected override void Start()
        {
            Cursor.visible    = true;
            Cursor.lockState  = CursorLockMode.None;
            m_friendsListItem = new List <FriendsListItem>();
            GEventManager.StartListening(GFriendsManager.ON_FRIENDS_LIST_UPDATED, OnRefreshFriendsList);
            GEventManager.StartListening(GEventManager.ON_INVITED_FRIEND, OnInvitedFriend);
            GEventManager.StartListening(GEventManager.ON_REFUSED_INVITE_FRIEND, OnRefusedInviteFriend);
            GEventManager.StartListening(GEventManager.ON_RTT_ENABLED, OnEnableRTTSuccess);
            GEventManager.StartListening(GEventManager.ON_PLAYER_DATA_UPDATED, OnUpdateStats);

            m_statsPanelContentLeft  = GameObject.Find("StatsPanel").transform.FindDeepChild("ContentLeft").gameObject;
            m_statsPanelContentRight = GameObject.Find("StatsPanel").transform.FindDeepChild("ContentRight").gameObject;
            m_joinFriendsPanel       = GameObject.Find("JoinFriendsPanel");
            m_statText  = GameObject.Find("StatText");
            m_statValue = GameObject.Find("StatValue");

            ChatInputField.onEndEdit.AddListener(delegate { OnEndEditHelper(); });

            BombersNetworkManager.Instance.ConnectRTT();

            GameObject playerName = GameObject.Find("PlayerName");

            m_inputField = playerName.GetComponent <InputField>();
            m_inputField.characterLimit = MAX_CHARACTERS_NAME;
            m_inputField.text           = GPlayerMgr.Instance.PlayerData.PlayerName;
            m_inputField.interactable   = false;
            PlayerRankIcon.UpdateIcon(GPlayerMgr.Instance.PlayerData.PlayerRank);
            BrainCloudStats.Instance.ReadStatistics();

            BaseNetworkBehavior.MSG_ENCODED   = GConfigManager.GetIntValue("MSGENCODING");
            BaseNetworkBehavior.SEND_INTERVAL = GConfigManager.GetFloatValue("SEND_INTERVAL");
            _stateInfo = new StateInfo(STATE_NAME, this);
            base.Start();

            // should we push the connect screen
            if (!GCore.Wrapper.Client.Initialized)
            {
                GStateManager.Instance.PushSubState(ConnectingSubState.STATE_NAME);
            }

#if STEAMWORKS_ENABLED
            QuitButton.SetActive(true);
            StoreButtonTop.SetActive(false);
            StoreButtonBottom.SetActive(true);
#else
            QuitButton.SetActive(false);
            StoreButtonTop.SetActive(true);
            StoreButtonBottom.SetActive(false);
#endif

#if UNITY_WEBGL
            LeftButtonGroup.SetActive(false);
#endif

            GPlayerMgr.Instance.GetXpData();
        }
예제 #3
0
        protected override void Start()
        {
            m_initialized = false;

            m_teamGreenListItem = new List <FriendsListItem>();
            m_teamRedListItem   = new List <FriendsListItem>();
            m_teamGreenItems    = new List <PlayerData>();
            m_teamRedItems      = new List <PlayerData>();

            m_currentMemberCount = 0;
            m_gameName           = transform.FindDeepChild("GameName").transform.Find("Text").GetComponent <Text>();
            m_waitingForPlayers  = transform.FindDeepChild("Waiting...").GetComponent <Text>();
            m_gameQuitButton     = transform.FindDeepChild("ButtonQuitGame").gameObject;
            m_gameStartButton    = transform.FindDeepChild("ButtonStartGame").gameObject;
            m_chatGroupLobby     = transform.FindDeepChild("ChatGroupLocal").gameObject;
            m_chatGroupGlobal    = transform.FindDeepChild("ChatGroupGlobal").gameObject;

            m_optionsAndGameGroup = transform.FindDeepChild("OptionsAndGameGroup").gameObject;
            m_gameButtons         = transform.FindDeepChild("GameButtons").gameObject;
            m_panelLeft           = transform.FindDeepChild("PanelLeft").GetComponent <Canvas>();

            m_titleField             = transform.FindDeepChild("Title Field").gameObject;
            m_editButton             = m_titleField.transform.Find("EditButton").gameObject;
            m_lobbyGameOptionsHost   = m_optionsAndGameGroup.transform.Find("lobbyGameOptionsHost").gameObject;
            m_lobbyGameOptionsTester = m_optionsAndGameGroup.transform.Find("lobbyGameOptionsTester").gameObject;
            m_protocolDropdown       = m_lobbyGameOptionsTester.transform.Find("dropdownButton1").GetComponent <Dropdown>();
            m_compressionDropdown    = m_lobbyGameOptionsTester.transform.Find("dropdownButton2").GetComponent <Dropdown>();

            SetupLobbyDisplaySettings();
            SetupTesterSettings();

            m_changeTeamButton = transform.FindDeepChild("ButtonChangeTeam").gameObject;

            GameObject tabGlobal = transform.FindDeepChild("TabGlobal").gameObject;
            GameObject tabLocal  = transform.FindDeepChild("TabLocal").gameObject;

            m_lobbyChatNotification  = tabLocal.transform.FindDeepChild("notificationBadge").gameObject;
            m_globalChatNotification = tabGlobal.transform.FindDeepChild("notificationBadge").gameObject;

            LocalChatInputField.onEndEdit.AddListener(delegate { OnEndEditHelperLocal(); });
            GlobalChatInputField.onEndEdit.AddListener(delegate { OnEndEditHelperGlobal(); });

            GEventManager.StartListening("NEW_GLOBAL_CHAT", onNewGlobalChat);
            GEventManager.StartListening("NEW_LOBBY_CHAT", onNewLobbyChat);

            GPlayerMgr.Instance.UpdateActivity(GPlayerMgr.LOCATION_LOBBY, GPlayerMgr.STATUS_IDLE, BombersNetworkManager.LobbyInfo.LobbyId, BombersNetworkManager.LobbyInfo.LobbyType);
            m_initialized = true;

            _stateInfo = new StateInfo(STATE_NAME, this);
            base.Start();

            populateGlobalChatWithExistingMessages();

            // start with lobby chat
            DisplayGlobalChat(false);
        }
        protected override void Start()
        {
            _stateInfo = new StateInfo(STATE_NAME, this);
            base.Start();
            GEventManager.StartListening(GFriendsManager.ON_FRIENDS_LIST_UPDATED, OnRefreshFriendsList);
            GEventManager.StartListening(GBomberRTTConfigManager.ON_SEARCH_RESULTS_UPDATED, OnRefreshSearchResults);

            GCore.Wrapper.RTTService.RegisterRTTPresenceCallback(OnPresenceCallback);
#if UNITY_WEBGL || UNITY_STANDALONE
            searchInputField.onEndEdit.AddListener(delegate { OnEndEditHelper(); });
#endif
        }
예제 #5
0
        private void onConnectComplete()
        {
            // check the attached identities
#if !STEAMWORKS_ENABLED
            if (GPlayerMgr.Instance.IsEmailAttached())
            {
                GCore.Instance.ProcessRetryQueue();
                onCompleteConnectingSubState();
            }
            else
#endif
            {
                GStateManager.Instance.EnableLoadingSpinner(true);
                GEventManager.StartListening(GEventManager.ON_IDENTITIES_UPDATED, onIdentitiesUpdated);
            }
        }
예제 #6
0
    private void createBGM()
    {
        m_MusicMixer = Resources.Load("Audio/AudioMixer_Music") as AudioMixer;
        m_SFXMixer   = Resources.Load("Audio/AudioMixer_SFX") as AudioMixer;
        m_VoiceMixer = Resources.Load("Audio/AudioMixer_Voice") as AudioMixer;
        updateVolume();
        GEventManager.StartListening(GEventManager.ON_VOLUME_CHANGED, updateVolume);

        GameObject obj = new GameObject("BGM");

        DontDestroyOnLoad(obj);

        m_BGM                       = obj.AddComponent <AudioSource>();
        m_BGM.playOnAwake           = false;
        m_BGM.outputAudioMixerGroup = m_MusicMixer.FindMatchingGroups("Master")[0];
        m_BGM.loop                  = true;
        m_BGM.spatialBlend          = 0.0f;
    }