Beispiel #1
0
    protected virtual IEnumerator HandleOnOrientationDevice(DeviceOrientation orientation)
    {
        // LOCK
        yield return(BOARD_LOCK);

        // DEVICE TO SCREEN
        Screen.orientation = CGameSetting.DeviceToScreenOrientation(orientation);
        // LOGIC
        var heighOffset  = 50f;
        var maximumCards = 23;

        // CALCULATE HEIGH OFFSET
        if (orientation == DeviceOrientation.LandscapeLeft ||
            orientation == DeviceOrientation.LandscapeRight)
        {
            heighOffset  = LANDSCAPE_SPACING;
            maximumCards = LANDSCAPE_MAXIMUM_CARD;
        }
        else if (orientation == DeviceOrientation.Portrait ||
                 orientation == DeviceOrientation.PortraitUpsideDown)
        {
            heighOffset  = PORTRAIT_SPACING;
            maximumCards = PORTRAIT_MAXIMUM_CARD;
        }
        // UPDATE
        for (int i = 0; i < this.m_Columns.Length; i++)
        {
            this.m_Columns[i].heighOffset  = heighOffset;
            this.m_Columns[i].maximumCards = maximumCards;
            this.m_Columns[i].RepositionAllCardsNonCallback();
            // this.m_Columns[i].ReconnectAllCards();
        }
    }
    private void LoadConfig(string config)
    {
        this.m_Shop = JSON.Load(config).Make <CShop>();
        var shopItems = this.m_Shop.shopItems;

        for (int i = 0; i < shopItems.Length; i++)
        {
            if (i >= this.m_OpenShop.Count)
            {
                var roomInstantiate = GameObject.Instantiate(this.m_ShopItemPrefab);
                roomInstantiate.transform.SetParent(this.m_ShopContent.transform);
                roomInstantiate.transform.localPosition = Vector3.zero;
                roomInstantiate.transform.localRotation = Quaternion.identity;
                roomInstantiate.transform.localScale    = Vector3.one;
                this.m_OpenShop.Add(roomInstantiate);
            }
            var item   = shopItems[i];
            var sprite = CGameSetting.GetSprite(item.displaySprite);
            if (item.type == CShopItem.EShopType.FRAME)
            {
                this.m_OpenShop[i].Setup(i, sprite, item.value == CGameSetting.USER_FRAME, item.price, this.OnItemClick);
            }
            else if (item.type == CShopItem.EShopType.AVATAR)
            {
                this.m_OpenShop[i].Setup(i, sprite, item.value == CGameSetting.USER_AVATAR, item.price, this.OnItemClick);
            }
            else
            {
                this.m_OpenShop[i].Setup(i, sprite, item.isUsing, item.price, this.OnItemClick);
            }
        }
    }
Beispiel #3
0
 public override void OnStartObject()
 {
     base.OnStartObject();
     // PLAYER NAME
     this.m_PlayerNameInputField.text = CGameSetting.USER_NAME;
     // UI
     this.m_SubmitButton.interactable         = true;
     this.m_PlayerNameInputField.interactable = true;
     this.m_ShowTutorialButton.interactable   = true;
     this.EnableGridAvatars(true);
     // PLAYER AVATAR
     if (CGameSetting.USER_AVATAR < this.m_AvatarButtons.Length)
     {
         this.m_AvatarButtons[CGameSetting.USER_AVATAR].isOn = true;
     }
     else
     {
         for (int i = 0; i < this.m_AvatarButtons.Length; i++)
         {
             this.m_AvatarButtons[i].isOn = false;
         }
     }
     this.m_CurrentAvatarImage.sprite = CGameSetting.GetAvatarSprite(CGameSetting.USER_AVATAR);
     // SETTING
     USER_AUTHORIZE_READY = false;
 }
Beispiel #4
0
 public virtual void Setup(int rank, int avatarIndex, string playerName, int score)
 {
     this.m_StarImage.SetActive(rank == 0);
     this.m_AvatarImage.sprite  = CGameSetting.GetAvatarSprite(avatarIndex);
     this.m_PlayerNameText.text = playerName;
     this.m_ScoreText.text      = string.Format("+{0}", score);
 }
 private void OnSubmitData()
 {
     // SET PLAYER NAME
     if (CSetingUserScenePanel.USER_AUTHORIZE_READY)
     {
         CGameSetting.UpdatePlayerData(CGameSetting.USER_NAME, CGameSetting.USER_AVATAR, CGameSetting.USER_FRAME);
     }
 }
 public override void OnStartObject()
 {
     base.OnStartObject();
     // UPDATE SHOP
     this.OnUpdateShop();
     // ADMOB
     this.m_AdmobButton.interactable = CGameSetting.IsTimerToAd(CGameSetting.DELAY_TO_AD);
     // SCROLLRECT
     this.m_ShopScrollRect.verticalNormalizedPosition = 1;
 }
    private void OnWordInputClick()
    {
        var keyboard = CRootManager.Instance.ShowPopup("KeyBoardPopup") as CKeyBoardPopup;

        keyboard.Setup(this.m_CurrentPrefix, (value) => {
            this.m_WordInputString    = value;
            this.m_WordInputText.text = CGameSetting.GetDisplayWord(value);
            keyboard.OnBackPress();
        });
        CSoundManager.Instance.Play("sfx_click");
    }
 private void OnHandleRewardAddGold()
 {
     CGameSetting.USER_GOLD         += CGameSetting.GOLD_VIDEO_REWARD;
     CAdmobManager.OnVideoAdsReward -= this.OnHandleRewardAddGold;
     // ADMOB
     this.m_AdmobButton.interactable = CGameSetting.IsTimerToAd(CGameSetting.DELAY_TO_AD);
     // EVENT
     if (this.OnUpdateValue != null)
     {
         this.OnUpdateValue();
     }
 }
Beispiel #9
0
    public virtual void Setup(int frame, int avatar, string word)
    {
        // BG
        var bgPath = CGameSetting.BACKGROUND_PATHS[frame % CGameSetting.BACKGROUND_PATHS.Length];

        this.m_BackgroundImage.sprite = CGameSetting.GetSprite(bgPath);
        // UI
        this.m_AvatarImage.sprite = CGameSetting.GetAvatarSprite(avatar);
        this.m_WordText.text      = word;
        // ANIMATOR
        this.m_Animator.SetTrigger("IsShowUp");
    }
Beispiel #10
0
 private void OnAvatarSelectionClick(bool value)
 {
     CSoundManager.Instance.Play("sfx_click");
     for (int i = 0; i < this.m_AvatarButtons.Length; i++)
     {
         if (this.m_AvatarButtons[i].isOn)
         {
             this.m_CurrentAvatarImage.sprite = CGameSetting.GetAvatarSprite(i);
             CGameSetting.USER_AVATAR         = i;
             break;
         }
     }
 }
 private void OnAdmobClick()
 {
     CAdmobManager.OnVideoAdsReward -= this.OnHandleRewardAddGold;
     if (CGameSetting.IsTimerToAd(CGameSetting.DELAY_TO_AD))
     {
         CAdmobManager.OnVideoAdsReward += this.OnHandleRewardAddGold;
         CAdmobManager.ShowRewardedVideo();
         CGameSetting.ResetTimerToAd();
         this.m_AdmobButton.interactable = false;
     }
     CSoundManager.Instance.Play("sfx_click");
     // ADS SHOWING.
     CGameSetting.IS_ADS_SHOW_ON_SCREEN = true;
 }
    private void OnReceiveSuggestWord(SocketIO.SocketIOEvent ev)
    {
        // WORD SUGGEST
        var wordSuggest = ev.data.GetField("wordSuggest").ToString().Replace("\"", string.Empty);

        this.m_WordInputText.text = CGameSetting.GetDisplayWord(wordSuggest);
        this.m_WordInputString    = wordSuggest;
        CRootManager.Instance.BackTo("MainGamePanel");
        // GOLD COST
        var goldCost = int.Parse(ev.data.GetField("goldCost").ToString());

        CGameSetting.USER_GOLD -= goldCost;
        // GOLD
        this.m_GoldDisplayText.text       = CGameSetting.USER_GOLD.ToString();
        this.m_SuggestButton.interactable = true;
    }
 public override void OnInitObject()
 {
     base.OnInitObject();
     // INIT SOCKET
     CSocketManager.Instance.Init();
     CPlayerManager.GetInstance();
     // ADMOB
     CAdmobManager.Init();
     CAdmobManager.InitBanner();
     CAdmobManager.InitRewardedVideo();
     CAdmobManager.LoadBanner();
     CAdmobManager.LoadRewardedVideo();
     if (CGameSetting.HasTimeToAd() == false)
     {
         CGameSetting.ResetTimerToAd();
     }
     // EVENTS
     CSocketManager.Instance.On("welcome", this.OnReceiveWelcome);
 }
Beispiel #14
0
 public virtual void Setup(int avatarIndex)
 {
     this.m_AvatarImage.sprite = CGameSetting.GetAvatarSprite(avatarIndex);
 }
 public override void OnStartObject()
 {
     base.OnStartObject();
     // ADMOB
     this.m_AdmobButton.interactable = CGameSetting.IsTimerToAd(CGameSetting.DELAY_TO_AD);
 }