Exemplo n.º 1
0
 public override void OnInitObject()
 {
     base.OnInitObject();
     // UI
     this.m_PlayerNameInputField = CRootManager.FindObjectWith(GameObject, "PlayerNameInputField").GetComponent <InputField>();
     this.m_SubmitButton         = CRootManager.FindObjectWith(GameObject, "SubmitButton").GetComponent <Button>();
     this.m_ShowTutorialButton   = CRootManager.FindObjectWith(GameObject, "ShowTutorialButton").GetComponent <Button>();
     this.m_QuitButton           = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
     // AVATAR
     this.m_CurrentAvatarImage = CRootManager.FindObjectWith(GameObject, "CurrentAvatarImage").GetComponent <Image>();
     this.m_AvatarGrid         = CRootManager.FindObjectWith(GameObject, "AvatarGrid");
     this.m_AvatarButtons      = this.m_AvatarGrid.GetComponentsInChildren <Toggle>();
     for (int i = 0; i < this.m_AvatarButtons.Length; i++)
     {
         this.m_AvatarButtons[i].onValueChanged.RemoveAllListeners();
         this.m_AvatarButtons[i].onValueChanged.AddListener(this.OnAvatarSelectionClick);
     }
     // SETTING
     USER_AUTHORIZE_READY = false;
     // EVENTS
     CSocketManager.Instance.On("playerNameSet", this.ReceivePlayerName);
     CSocketManager.Instance.On("msgError", this.ReceiveMessageError);
     // EVENTS
     this.m_SubmitButton.onClick.AddListener(this.OnSubmitClick);
     this.m_ShowTutorialButton.onClick.AddListener(this.OnShowTutorialClick);
     this.m_QuitButton.onClick.AddListener(this.OnQuitClick);
 }
    public override void OnInitObject()
    {
        base.OnInitObject();
        // KEYBOARD
        this.m_Buttons = GameObject.GetComponentsInChildren <CKeyBoardItem>();
        for (int i = 0; i < this.m_Buttons.Length; i++)
        {
            this.m_Buttons[i].Init();
            this.m_Buttons[i].Setup(this.OnKeyPressed);
        }
        // UI
        this.m_BackspaceButton = CRootManager.FindObjectWith(GameObject, "BackspaceButton").GetComponent <Button>();
        this.m_BackspaceButton.onClick.AddListener(this.OnBackspaceClick);

        this.m_SpacebarButton = CRootManager.FindObjectWith(GameObject, "SpacebarButton").GetComponent <Button>();
        this.m_SpacebarButton.onClick.AddListener(this.OnSpacebarClick);

        this.m_SubmitWordButton = CRootManager.FindObjectWith(GameObject, "SubmitWordButton").GetComponent <Button>();
        this.m_SubmitWordButton.onClick.AddListener(this.OnSubmitWordClick);

        this.m_QuitButton = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
        this.m_QuitButton.onClick.AddListener(this.OnQuitClick);

        this.m_InputFieldText      = CRootManager.FindObjectWith(GameObject, "InputFieldText").GetComponent <Text>();
        this.m_InputFieldText.text = string.Empty;
        this.m_InputString         = string.Empty;
    }
Exemplo n.º 3
0
 public override void OnInitObject()
 {
     base.OnInitObject();
     // TITLE
     this.m_TitleText = CRootManager.FindObjectWith(GameObject, "TitleText").GetComponent <Text>();
     // BODY
     this.m_BodyText = CRootManager.FindObjectWith(GameObject, "BodyText").GetComponent <Text>();
     // QUIT
     this.m_QuitButton = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
 }
Exemplo n.º 4
0
 public override void OnInitObject()
 {
     base.OnInitObject();
     // UI
     this.m_TutorialAnimator = CRootManager.FindObjectWith(GameObject, "Container").GetComponent <Animator>();
     this.m_TutorialButton   = CRootManager.FindObjectWith(GameObject, "TutorialButton").GetComponent <Button>();
     this.m_TutorialButton.onClick.AddListener(this.OnTutorialStepClick);
     // this.m_DontShowAgainToggle = CRootManager.FindObjectWith(GameObject, "DontShowToggle").GetComponent<Toggle>();
     // this.m_DontShowAgainToggle.onValueChanged.AddListener (this.OnDontShowAgainToggle);
     this.m_QuitButton = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
     this.m_QuitButton.onClick.AddListener(this.OnQuitClick);
 }
 public override void OnInitObject()
 {
     base.OnInitObject();
     // BODY
     this.m_BodyPanel = CRootManager.FindObjectWith(GameObject, "BodyPanel");
     // QUIT
     this.m_QuitButton  = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
     this.m_AdmobButton = CRootManager.FindObjectWith(GameObject, "AdmobButton").GetComponent <Button>();
     this.m_AdmobButton.onClick.AddListener(this.OnAdmobClick);
     // RESULTS
     this.m_ResultItemPrefab = Resources.Load <CResultItem>("Items/ResultItem");
     this.m_ResultItems      = new List <CResultItem>();
     // ANIMATOR
     this.m_Animator = CRootManager.FindObjectWith(GameObject, "Container").GetComponent <Animator>();
 }
Exemplo n.º 6
0
 public override void OnInitObject()
 {
     base.OnInitObject();
     // TITLE
     this.m_TitleText = CRootManager.FindObjectWith(GameObject, "TitleText").GetComponent <Text>();
     // BODY
     this.m_BodyText = CRootManager.FindObjectWith(GameObject, "BodyText").GetComponent <Text>();
     // LEFT
     this.m_LeftButton = CRootManager.FindObjectWith(GameObject, "LeftButton").GetComponent <Button>();
     this.m_LeftText   = CRootManager.FindObjectWith(GameObject, "LeftText").GetComponent <Text>();
     // MIDDLE
     this.m_MiddleButton = CRootManager.FindObjectWith(GameObject, "MiddleButton").GetComponent <Button>();
     this.m_MiddleText   = CRootManager.FindObjectWith(GameObject, "MiddleText").GetComponent <Text>();
     // RIGHT
     this.m_RightButton = CRootManager.FindObjectWith(GameObject, "RightButton").GetComponent <Button>();
     this.m_RightText   = CRootManager.FindObjectWith(GameObject, "RightText").GetComponent <Text>();
 }
Exemplo n.º 7
0
 public override void OnInitObject()
 {
     base.OnInitObject();
     // UI
     this.m_ShopContent = CRootManager.FindObjectWith(GameObject, "ShopContent");
     // BUTTONS
     this.m_QuitButton = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
     this.m_QuitButton.onClick.AddListener(this.OnQuitClick);
     this.m_AdmobButton = CRootManager.FindObjectWith(GameObject, "AdmobButton").GetComponent <Button>();
     this.m_AdmobButton.onClick.AddListener(this.OnAdmobClick);
     this.m_AdmobRewardText      = CRootManager.FindObjectWith(GameObject, "AdmobRewardText").GetComponent <Text>();
     this.m_AdmobRewardText.text = string.Format("+{0}", CGameSetting.GOLD_VIDEO_REWARD);
     this.m_ShopScrollRect       = CRootManager.FindObjectWith(GameObject, "ShopScrollRect").GetComponent <ScrollRect>();
     // ITEM PREFAB
     this.m_ShopItemPrefab = Resources.Load <CShopItem>("Items/ShopItem");
     this.m_ShopConfig     = Resources.Load <TextAsset>("Shop/shop");
     this.m_OpenShop       = new List <CShopItem>();
     this.LoadConfig(this.m_ShopConfig.text);
 }
 public override void OnInitObject()
 {
     base.OnInitObject();
     // UI
     this.m_PlayerNameText    = CRootManager.FindObjectWith(GameObject, "PlayerNameText").GetComponent <Text>();
     this.m_ChatRoomText      = CRootManager.FindObjectWith(GameObject, "ChatRoomText").GetComponent <Text>();
     this.m_ChatRoomText.text = "...World chat...";
     this.m_ChatScrollRect    = CRootManager.FindObjectWith(GameObject, "ChatScrollRect").GetComponent <ScrollRect>();
     this.m_ChatInputField    = CRootManager.FindObjectWith(GameObject, "ChatInputField").GetComponent <InputField>();
     this.m_SubmitChatButton  = CRootManager.FindObjectWith(GameObject, "SubmitChatButton").GetComponent <Button>();
     this.m_QuitButton        = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
     // EVENTS
     CSocketManager.Instance.On("msgWorldChat", this.OnReceiveWordChat);
     // EVENTS
     this.m_SubmitChatButton.onClick.AddListener(this.OnSubmitWorldChat);
     this.m_QuitButton.onClick.AddListener(this.OnQuitClick);
     // CHAT ULTILITIES
     this.m_ListChat = new List <string>();
 }
 public override void OnInitObject()
 {
     base.OnInitObject();
     // ROOM
     this.m_Rooms          = new List <CRoomItem>();
     this.m_RoomContent    = CRootManager.FindObjectWith(GameObject, "RoomContent");
     this.m_RoomItemPrefab = Resources.Load <CRoomItem>("Items/RoomItem");
     this.m_RoomLoaded     = false;
     // BUTTONS
     this.m_JoinRandomButton = CRootManager.FindObjectWith(GameObject, "JoinRandomButton").GetComponent <Button>();
     this.m_RefreshButton    = CRootManager.FindObjectWith(GameObject, "RefreshButton").GetComponent <Button>();
     this.m_ExitButton       = CRootManager.FindObjectWith(GameObject, "ExitButton").GetComponent <Button>();
     this.m_OpenChatButton   = CRootManager.FindObjectWith(GameObject, "OpenChatButton").GetComponent <Button>();
     this.m_SoundOnOffButton = CRootManager.FindObjectWith(GameObject, "SoundOnOffButton").GetComponent <Button>();
     this.m_SoundOffImage    = CRootManager.FindObjectWith(GameObject, "SoundOffImage");
     this.m_SoundOnImage     = CRootManager.FindObjectWith(GameObject, "SoundOnImage");
     this.m_SoundOffImage.SetActive(CGameSetting.SETTING_SOUND_MUTE);
     this.m_SoundOnImage.SetActive(!CGameSetting.SETTING_SOUND_MUTE);
     CSoundManager.Instance.MuteAll(CGameSetting.SETTING_SOUND_MUTE);
     this.m_ShowTutorialButton = CRootManager.FindObjectWith(GameObject, "ShowTutorialButton").GetComponent <Button>();
     this.m_OpenShopButton     = CRootManager.FindObjectWith(GameObject, "OpenShopButton").GetComponent <Button>();
     // GOLD
     this.m_GoldDisplayText = CRootManager.FindObjectWith(GameObject, "GoldDisplayText").GetComponent <Text>();
     // OFF EVENTS
     // CSocketManager.Instance.Off("updateRoomStatus", this.ReceiveRoomList);
     // CSocketManager.Instance.Off("joinRoomFailed", this.OnJoinRoomFailed);
     // ON EVENTS
     CSocketManager.Instance.On("updateRoomStatus", this.ReceiveRoomList);
     CSocketManager.Instance.On("updateRoomSize", this.ReceiveRoomSize);
     CSocketManager.Instance.On("joinRoomCompleted", this.OnJoinRoomCompleted);
     CSocketManager.Instance.On("joinRoomFailed", this.OnJoinRoomFailed);
     // BUTTONS
     this.m_JoinRandomButton.onClick.AddListener(this.OnJoinRandomClick);
     this.m_RefreshButton.onClick.AddListener(this.OnRefreshClick);
     this.m_ExitButton.onClick.AddListener(this.OnExitClick);
     this.m_OpenChatButton.onClick.AddListener(this.OnOpenChatClick);
     this.m_SoundOnOffButton.onClick.AddListener(this.OnSoundOnOffClick);
     this.m_ShowTutorialButton.onClick.AddListener(this.OnShowTutorialClick);
     this.m_OpenShopButton.onClick.AddListener(this.OnOpenShopClick);
 }
    public override void OnInitObject()
    {
        base.OnInitObject();
        // UI
        this.m_QuitButton = CRootManager.FindObjectWith(GameObject, "QuitButton").GetComponent <Button>();
        // YOUR TURN PANEL
        this.m_ContainerAnimator  = CRootManager.FindObjectWith(GameObject, "Container").GetComponent <Animator>();
        this.m_YourTurnText       = CRootManager.FindObjectWith(GameObject, "YourTurnText").GetComponent <Text>();
        this.m_ShowTutorialButton = CRootManager.FindObjectWith(GameObject, "ShowTutorialButton").GetComponent <Button>();
        // GAME DISPLAY
        this.m_GoldDisplayText      = CRootManager.FindObjectWith(GameObject, "GoldDisplayText").GetComponent <Text>();
        this.m_RoomTimerText        = CRootManager.FindObjectWith(GameObject, "RoomTimerText").GetComponent <Text>();
        this.m_CurrentCharacterText = CRootManager.FindObjectWith(GameObject, "CurrentCharacterText").GetComponent <Text>();
        // PLAYER GROUP
        var playerGroup = CRootManager.FindObjectWith(GameObject, "PlayerGroup");

        this.m_PlayerDisplayItems = playerGroup.GetComponentsInChildren <CPlayerDisplayItem>();
        // WORD LIST
        this.m_ListWordContent       = CRootManager.FindObjectWith(GameObject, "ListWordContent");
        this.m_WordItemPrefab        = Resources.Load <CWordItem>("Items/WordItem");
        this.m_WordLists             = new List <CWordItem>();
        this.m_ListWordScrollRect    = CRootManager.FindObjectWith(GameObject, "ListWordScrollRect").GetComponent <ScrollRect>();
        this.m_CurrentTurnGrayScreen = CRootManager.FindObjectWith(GameObject, "CurrentTurnGrayScreen");
        // SUGGEST
        this.m_SuggestButton = CRootManager.FindObjectWith(GameObject, "SuggestButton").GetComponent <Button>();
        this.m_GoldCostText  = CRootManager.FindObjectWith(GameObject, "GoldCostText").GetComponent <Text>();
        // CACHE
        this.m_WordCaches = new Queue <CWordItem>();
        this.m_CacheRoot  = new GameObject("CACHE_ROOT").transform;
        // WORD
        this.m_WordInputText      = CRootManager.FindObjectWith(GameObject, "WordInputText").GetComponent <Text>();
        this.m_WordInputText.text = this.m_EMPTY_WORD;
        this.m_WordInputButton    = CRootManager.FindObjectWith(GameObject, "WordInputButton").GetComponent <Button>();
        this.m_SubmitButton       = CRootManager.FindObjectWith(GameObject, "SubmitButton").GetComponent <Button>();
        // PLAYER
        this.m_CurrentGameTurn   = -1;
        this.m_CurrentTurnPlayer = -1;
        this.m_CurrentPrefix     = "a";
        // EVENTS
        CSocketManager.Instance.On("msgError", this.ReceiveMessageError);
        CSocketManager.Instance.On("addGold", this.OnAddGold);
        CSocketManager.Instance.On("newJoinRoom", this.OnDisplayLobby);
        CSocketManager.Instance.On("newLeaveRoom", this.OnDisplayLobby);
        CSocketManager.Instance.On("leaveRoom", this.OnClearRoom);
        CSocketManager.Instance.On("clearRoom", this.OnClearRoom);
        CSocketManager.Instance.On("turnIndexSet", this.OnReceiveTurnIndex);
        CSocketManager.Instance.On("startGame", this.OnStartGame);
        CSocketManager.Instance.On("endGameResult", this.OnEndGame);
        CSocketManager.Instance.On("allRoomGetWord", this.OnReceiveNewWord);
        CSocketManager.Instance.On("receiveSuggestWord", this.OnReceiveSuggestWord);
        CSocketManager.Instance.On("countDownTimer", this.OnCountDownTimer);
        CSocketManager.Instance.On("counterDownAnswer", this.OnCountDownAnswerTimer);
        CSocketManager.Instance.On("onePassTurn", this.OnOnePassTurn);
        // UI
        this.m_ShowTutorialButton.onClick.AddListener(this.OnShowTutorialClick);
        this.m_QuitButton.onClick.AddListener(this.OnQuitClick);
        // WORD SUBMIT
        this.m_SubmitButton.onClick.AddListener(this.OnSendWord);
        // SUGGEST
        this.m_SuggestButton.onClick.AddListener(this.OnRequestSuggestWord);
        // WordInputButton
        this.m_WordInputButton.onClick.AddListener(this.OnWordInputClick);
    }