Ejemplo n.º 1
0
 private static void AddEventToButton(GameLevelDetail item, Button objButton)
 {
     objButton.onClick.AddListener(() =>
     {
         MenuSoundManager.Instance.PlayMenuClick();
         UIStateManager.Manager.SwapToLeaderboardPage();
     });
 }
    void OnGetGameLevelDetail(string errorString, GameLevelDetail result, params object[] userParam)
    {
        if (result != null && result.Active)
        {
            LeaderboardDetail leaderboardDetail = userParam[0] as LeaderboardDetail;

            UIStateManager.Manager.SwapToKeyValidationPage(null, null, leaderboardDetail, KeyValiationStatesBack.UserTournament);
        }
    }
Ejemplo n.º 3
0
    void OnGetGameLevelDetails(string errorString, GameLevelDetail[] result, params object[] userParam)
    {
        if (string.IsNullOrEmpty(errorString) && result != null)
        {
            int index = 0;

            foreach (GameLevelDetail item in result)
            {
                if (index < ItemPerPages)
                {
                    GameObject obj = GameObject.Instantiate(UIStateManager.Manager.ListItemTemplate_LeaderboardTiles);
                    obj.transform.SetParent(ListerPanel.transform, false);

                    obj.name = item.Id;
                    Button objButton = obj.GetComponent<Button>();
                    Text objText = objButton.GetComponentInChildren<Text>();
                    objText.fontSize = ButtonFontSize;
                    objText.text = string.Format("Joining Point = {0}",
                            item.JoiningPoint == 0 ? "0" : item.JoiningPoint.ToString());
                    AddEventToButton(item, objButton);
                }
                index++;
            }

            if (m_PageNo > 1)
            {
                BackwardButton.interactable = true;
            }

            if (result.Length == ItemPerPages + 1)
            {
                ForwardButton.interactable = true;
            }
        }
        else
        {
            m_PageNo = 1;
        }
        UIStateManager.Manager.SetLoading(false);
    }
Ejemplo n.º 4
0
    GameLevelDetail ToGameLevelDetail(XmlNode node, ref string errorString)
    {
        try
        {
            GameLevelDetail gameLevel = null;
            if (node != null && !string.IsNullOrEmpty(node.InnerXml))
            {
                gameLevel = new GameLevelDetail();
                gameLevel.Id = node["Id"].InnerText;
                gameLevel.Name = node["Name"].InnerText;
                gameLevel.Comment = node["Comment"].InnerText;

                long longVal = -1;
                if (long.TryParse(node["JoiningPoint"].InnerText, out longVal))
                {
                    gameLevel.JoiningPoint = longVal;
                }

                gameLevel.GameId = node["GameId"].InnerText;
                gameLevel.ParentLevelId = node["ParentLevelId"].InnerText;

                bool boolVal = false;
                if (bool.TryParse(node["Active"].InnerText, out boolVal))
                {
                    gameLevel.Active = boolVal;
                }
                boolVal = false;
                if (bool.TryParse(node["IsUserTournamentAllowed"].InnerText, out boolVal))
                {
                    gameLevel.IsUserTournamentAllowed = boolVal;
                }

                gameLevel.Extras = node["Extras"].InnerText;
                gameLevel.Reference = node["Reference"].InnerText;

                return gameLevel;
            }
        }
        catch (Exception ex)
        {
            errorString = ex.Message;
        }
        return null;
    }
    void OnGetGameLevelDetail(string errorString, GameLevelDetail result, params object[] userParam)
    {
        if (result != null && result.Active)
        {
            LeaderboardDetail leaderboardDetail = userParam[0] as LeaderboardDetail;
            LeaderboardDetail = leaderboardDetail;

            string key = KeyField.text.Trim();
            entryKey = key;
            string BannerFilePath = Path.Combine(Application.persistentDataPath, leaderboardDetail.Id + "_Banner.png");
            filePath = BannerFilePath;

            if (File.Exists(BannerFilePath))
            {
                UIStateManager.Manager.SwapToGame(LeaderboardDetail, true, entryKey);
            }

            if (leaderboardDetail.IsSponsored)
            {
                StartCoroutine(SetInterstitial(leaderboardDetail));
            }
        }
        else
        {
            Message.text = "Invalid key entered!";
        }
    }
 // Use this for initialization
 void Start()
 {
     CurrentLevel = null;
     RefreshDuration();
     Refresh(false);
     JumboButton.SetActive(false);
     StartCoroutine(UIStateManager.GameAPI.GetGameDetails(UIStateManager.Manager.GetGameID(), OnGetGameDetails));
 }
 void SetPickedItem(GameLevelDetail item)
 {
     CurrentLevel = item;
     Text objText = DropDownButton_LevelType.GetComponentInChildren<Text>();
     GetDropDownItemName(item, objText);
 }
    void OnGetGameLevelDetails(string errorString, GameLevelDetail[] result, params object[] userParam)
    {
        bool createDropDownItems = (bool)userParam[0];
        for (int i = 0, childCount = DropdownPanel_LevelTypeChild.transform.childCount; i < childCount; i++)
        {
            GameObject childObject = DropdownPanel_LevelTypeChild.transform.GetChild(i).gameObject;
            GameObject.Destroy(childObject);
        }
        if (string.IsNullOrEmpty(errorString) && result != null)
        {
            if (result.Length > 0)
            {
                SetPickedItem(result[0]);
            }

            if (createDropDownItems)
            {
                DropdownPanel_LevelTypeObject.SetActive(true);
                DropdownPanel_LevelTypeChild.SetActive(true);
                DropdownPanel_LevelType_Duplicate.SetActive(true);
                //DropdownPanel_LevelTypeObject.GetComponent<Image>().color = _color;
                foreach (GameLevelDetail item in result)
                {
                    GameObject obj = GameObject.Instantiate(UIStateManager.Manager.ListItemsTemplate_Buttons);
                    obj.transform.SetParent(DropdownPanel_LevelTypeChild.transform, false);
                    obj.name = item.Id;
                    Button objButton = obj.GetComponent<Button>();
                    Text objText = objButton.GetComponentInChildren<Text>();
                    objText.fontSize = 25;
                    GetDropDownItemName(item, objText);
                    AddEventToButton(item, objButton);
                }
            }
        }
        UIStateManager.Manager.SetLoading(false);
    }
 private void AddEventToButton(GameLevelDetail item, Button objButton)
 {
     objButton.onClick.AddListener(() =>
     {
         MenuSoundManager.Instance.PlayMenuClick();
         SetPickedItem(item);
         DropdownPanel_LevelTypeObject.SetActive(false);
         DropdownPanel_LevelTypeChild.SetActive(false);
         DropdownPanel_LevelType_Duplicate.SetActive(false);
     });
 }
 private static void GetDropDownItemName(GameLevelDetail item, Text objText)
 {
     objText.text = string.Format("Joining Point = {0}",
             item.JoiningPoint == 0 ? "0" : item.JoiningPoint.ToString());
 }
Ejemplo n.º 11
0
 public string GetLeaderboardData(GameLevelDetail detail, LeaderboardDetail leaderboardDetail)
 {
     if (!string.IsNullOrEmpty(leaderboardDetail.Extras))
     {
         return SplitExtras(leaderboardDetail.Extras);
     }
     return SplitExtras(detail.Extras);
 }
Ejemplo n.º 12
0
 public void SwapToSubLevelPage(GameLevelDetail levelDetail)
 {
     SubLevelsScript.Level = levelDetail;
     SwapToPage(SubLevelPage);
 }
Ejemplo n.º 13
0
 public void SwapToPostCreateLeaderboardPage(LeaderboardDetail leaderboardDetail, GameLevelDetail levelDetail)
 {
     PostCreateLeaderboardScript.LeaderboardDetail = leaderboardDetail;
     PostCreateLeaderboardScript.LevelDetail = levelDetail;
     SwapToPage(PostCreateLeaderboardPage);
 }
Ejemplo n.º 14
0
 public void SwapToKeyValidationPage(
 GameLevelDetail grandParentLevelDetail,
 GameLevelDetail parentLevelDetail,
 LeaderboardDetail leaderboardDetail,
 KeyValiationStatesBack backType)
 {
     KeyValidationScript.BackType = backType;
     KeyValidationScript.GrandParentLevelDetail = grandParentLevelDetail;
     KeyValidationScript.ParentLevelDetail = parentLevelDetail;
     KeyValidationScript.LeaderboardDetail = leaderboardDetail;
     SwapToPage(KeyValidationPage);
 }