Inheritance: LoopBaseItem
Example #1
0
    private void InitCoinRanks()
    {
        foreach (var rank in all_coin_ranks)
        {
            rank.gameObject.SetActive(false);
        }

        List <AllData_YesterdayRankData_Rank> allGoldRankInfo = Save.data.allData.lucky_ranking.gold_rank;
        int allRankCount = allGoldRankInfo.Count;
        int rankIndex    = 0;

        for (int i = 0; i < allRankCount; i++)
        {
            if (rankIndex > all_coin_ranks.Count - 1)
            {
                RankItem newRankItem = Instantiate(single_coin_rank, single_coin_rank.transform.parent).GetComponent <RankItem>();
                all_coin_ranks.Add(newRankItem);
            }
            AllData_YesterdayRankData_Rank rankInfo = allGoldRankInfo[i];
            all_coin_ranks[i].gameObject.SetActive(true);
            all_coin_ranks[i].Init(rankInfo.user_title, rankInfo.user_id, rankInfo.user_num, rankInfo.user_token);
            rankIndex++;
        }
        AllData_YesterdayRankData_Rank selfRankInfo = Save.data.allData.lucky_ranking.self_gold_info;

        self_coin_rank.Init(selfRankInfo.user_title, selfRankInfo.user_id, selfRankInfo.user_num, selfRankInfo.user_token);
    }
Example #2
0
 private void ClearResources()
 {
     if (this.ladderBannerBgPic != null && this.ladderBannerBgPic.mainTexture != null)
     {
         this.ladderBannerBgPic.mainTexture = null;
     }
     if (this.magicBannerBgPic != null && this.magicBannerBgPic.mainTexture != null)
     {
         this.magicBannerBgPic.mainTexture = null;
     }
     if (this.magicBannerTexture != null && this.magicBannerTexture.mainTexture != null)
     {
         this.magicBannerTexture.mainTexture = null;
     }
     if (this._rankItem != null)
     {
         this._rankItem.ClearResources();
         this._rankItem = null;
     }
     if (this.LadderList != null)
     {
         this.ClearRankItemResources(this.LadderList.transform);
     }
     if (this.MagicList != null)
     {
         this.ClearRankItemResources(this.MagicList.transform);
     }
 }
Example #3
0
    IEnumerator Init()
    {
        yield return(new WaitForSeconds(0.1f));

        Debug.Log("2222");


        GameManager.Instance.playerDatas.Add(this);

        GameObject rankItem_go = Instantiate(RankPanel._Instance.res_RankItem, RankPanel._Instance.rankItemParent);

        rankItem = rankItem_go.GetComponent <RankItem>();
        if (rankItem == null)
        {
            rankItem = rankItem_go.AddComponent <RankItem>();
        }
        rankItem.target   = this.gameObject;
        rankItem.name_str = this.PlayerName;
        //Debug.Log("this.PlayerName:" + this.PlayerName);
        RankPanel._Instance.rankItemList.Add(rankItem);

        int index = GameManager.Instance.GetIndex(this);

        if (index != -1)
        {
            Init(index);
        }
        yield return(0);
    }
Example #4
0
    private List<RankItem> GetAllRankList()
    {
        List<RankItem> rankitemList = new List<RankItem>();
        //TODO hardcode here 我们需要从本地取得分数信息
        RankItem item1 = new RankItem();
        item1.date = "2015-11-3"; item1.score = 90000;
        rankitemList.Add(item1);

        RankItem item2 = new RankItem();
        item2.date = "2115-11-3"; item1.score = 8000;
        rankitemList.Add(item2);

        RankItem item3 = new RankItem();
        item3.date = "2115-11-11"; item3.score = 90770;
        rankitemList.Add(item3);

        RankItem item4 = new RankItem();
        item4.date = "2115-11-3"; item4.score = 90000;
        rankitemList.Add(item4);

        RankItem item5 = new RankItem();
        item5.date = "2115-11-3"; item5.score = 90000;
        rankitemList.Add(item5);

        return rankitemList;
    }
Example #5
0
    public void init(GameObject go)
    {
        Utils.clearList(this._rankList);

        if (FightMain.instance.selection.mapData.isRadish)
        {
            this._itemCount = 1;
            go.GetComponent <RectTransform>().anchoredPosition = new Vector2(-10, -100);
        }
        else
        {
            this._itemCount = 6;
            go.GetComponent <RectTransform>().anchoredPosition = new Vector2(-10, -5);
        }

        for (int i = 0, len = this._itemCount; i < len; i++)
        {
            RankItem item = new RankItem();
            item.init(go, i);

            if (i == len - 1)
            {
                item.go.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, (i) * -26 - 2);
            }
            else
            {
                item.go.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, (i) * -26);
            }

            this._rankList.Add(item);
        }

        FightMain.instance.selection.addListener(EventConstant.LOGIC_COMPLETE, onFrameHandler);
    }
Example #6
0
    IEnumerator SendGet(string _url, string action)
    {
        //Debug.Log ("Send Rank Request");
        WWW getData = new WWW(_url);

        yield return(getData);

        if (getData.error != null)
        {
            Debug.Log(getData.error);
        }
        else
        {
            if (action == "/rank")
            {
                allRank = getData.text;
            }
            else
            {
                addScoreResult = getData.text;
            }
            Debug.Log(allRank);
            RankItem RankData = JsonUtility.FromJson <RankItem>(allRank);
            for (int i = 0; i < 10; i++)
            {
                if (RankData.inforlist[i].Username == "")
                {
                    break;
                }
                Name[i].text  = RankData.inforlist[i].Username;
                Score[i].text = RankData.inforlist[i].Score.ToString();
            }
        }
    }
Example #7
0
        private void SaveWeapon(BasePlayer player, int rank, int ammo = 1)
        {
            RankItem weaponEntry = new RankItem();
            Item     item        = player.GetActiveItem();

            if (item != null)
            {
                if (item.info.category.ToString() == "Weapon")
                {
                    BaseProjectile weapon = item.GetHeldEntity() as BaseProjectile;
                    if (weapon != null)
                    {
                        if (weapon.primaryMagazine != null)
                        {
                            List <string> mods = new List <string>();
                            if (item.contents != null)
                            {
                                foreach (var mod in item.contents.itemList)
                                {
                                    if (mod.info.itemid != 0)
                                    {
                                        mods.Add(mod.info.shortname);
                                    }
                                }
                            }
                            if (mods != null)
                            {
                                weaponEntry.contents = mods.ToArray();
                            }

                            weaponEntry.ammoType = weapon.primaryMagazine.ammoType.shortname;
                            weaponEntry.ammo     = ammo;
                        }
                    }

                    weaponEntry.amount    = item.amount;
                    weaponEntry.container = "belt";
                    weaponEntry.name      = item.info.displayName.english;
                    weaponEntry.shortname = item.info.shortname;
                    weaponEntry.skin      = item.skin;

                    if (rank > configData.Weapons.Count)
                    {
                        rank = configData.Weapons.Count + 1;
                    }
                    if (!configData.Weapons.ContainsKey(rank))
                    {
                        configData.Weapons.Add(rank, weaponEntry);
                    }
                    else
                    {
                        configData.Weapons[rank] = weaponEntry;
                    }
                    SaveConfig(configData);
                    SendReply(player, string.Format("You have successfully added <color=orange>{0}</color> as the weapon for Rank <color=orange>{1}</color>", weaponEntry.name, rank));
                    return;
                }
            }
            SendReply(player, "<color=orange>Unable to save item.</color> You must put a weapon in your hands");
        }
Example #8
0
    public void SetRank()
    {
        try
        {
            RankItem myRankData = BackEndServerManager.instance.myRankData;
            myRankRow.nickNameTxt.text = myRankData.nickname;
            myRankRow.scoreTxt.text    = myRankData.score;
            myRankRow.rankTxt.text     = myRankData.rank;
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }
        finally
        {
            List <RankItem> rankTop10DataList = BackEndServerManager.instance.rankTop10DataList;
            for (int i = 0; i < rankTop10DataList.Count; i++)
            {
                top10RankRows[i].nickNameTxt.text = rankTop10DataList[i].nickname;
                top10RankRows[i].scoreTxt.text    = rankTop10DataList[i].score;
                top10RankRows[i].rankTxt.text     = rankTop10DataList[i].rank;

                top10RankRows[i].rankTxt.GetComponentInParent <Image>().color = int.Parse(rankTop10DataList[i].rank) < 4 ? (Color)topRankcolor : (Color)normalRankcolor;
                if (i == rankTop10DataList.Count - 1)
                {
                    TopN.text = "Top " + rankTop10DataList[i].rank;
                }
            }
        }
    }
Example #9
0
    // 접속한 게이머 랭킹 가져오기 (UUID지정)
    public void GetMyRank()
    {
        Backend.Rank.GetMyRank(rankUuid, myRankBro =>
        {
            if (myRankBro.IsSuccess())
            {
                JsonData rankData = myRankBro.GetReturnValuetoJSON()["rows"];
                if (rankData[0] != null)
                {
                    myRankData = new RankItem
                    {
                        nickname = rankData[0].Keys.Contains("nickname") ? rankData[0]["nickname"]["S"].ToString() : dash,
                        rank     = rankData[0].Keys.Contains("rank") ? rankData[0]["rank"]["N"].ToString() : dash,
                        score    = rankData[0].Keys.Contains("score") ? rankData[0]["score"]["N"].ToString() : dash
                    };
                }
                else
                {
                    myRankData = EmptyRank;
                }
            }
            else
            {
                myRankData = EmptyRank;
                Debug.Log("유저 랭킹 불러오기 실패 - " + myRankBro);
                // ShowMessage("유저 랭킹 불러오기 실패");
            }

            // 랭킹 ui
            DispatcherAction(BackEndUIManager.instance.ShowRankUI);
        });
    }
Example #10
0
 void ItemObjectReset()
 {
     Debug.Log("生成对象数目:" + rankItemList.Count);
     for (int i = 0; i < rankItemList.Count; i++)
     {
         RankItem temp = rankItemList[i];
         Object.Destroy(temp.gameObject);
     }
     rankItemList.Clear();
 }
Example #11
0
 /// <summary>
 /// 创建Item
 /// </summary>
 private void CreateItem(List <RankData> dataList)
 {
     for (int i = 0; i < dataList.Count; i++)
     {
         RankItem item = Instantiate(prefab, content);
         item._node = this;
         item.Init(dataList[i]);
         itemList.Add(item);
     }
 }
Example #12
0
        private void EconomyWindow_Load(object sender, EventArgs e)
        {
            RankItem rankItem = Economy.Ranks;

            numericUpDownTitle.Value  = Economy.Title.Price;
            numericUpDownColor.Value  = Economy.Color.Price;
            numericUpDownTcolor.Value = Economy.TitleColor.Price;
            checkBoxEco.Checked       = Economy.Enabled;
            checkBoxTitle.Checked     = Economy.Title.Enabled;
            checkBoxColor.Checked     = Economy.Color.Enabled;
            checkBoxTcolor.Checked    = Economy.TitleColor.Enabled;
            checkBoxRank.Checked      = rankItem.Enabled;
            checkBoxLevel.Checked     = Economy.Levels.Enabled;

            //load all ranks in combobox
            List <string> groupList = new List <string>();

            foreach (Group group in Group.GroupList)
            {
                if (group.Permission > LevelPermission.Guest && group.Permission < LevelPermission.Nobody)
                {
                    groupList.Add(group.name);
                }
            }
            comboBoxRank.DataSource   = groupList;
            comboBoxRank.SelectedItem = rankItem.MaxRank;

            UpdateRanks();
            UpdateLevels();

            //initialize enables
            groupBoxTitle.Enabled       = checkBoxEco.Checked;
            groupBoxColor.Enabled       = checkBoxEco.Checked;
            groupBoxTcolor.Enabled      = checkBoxEco.Checked;
            groupBoxRank.Enabled        = checkBoxEco.Checked;
            groupBoxLevel.Enabled       = checkBoxEco.Checked;
            labelPriceTitle.Enabled     = checkBoxTitle.Checked;
            labelPriceColor.Enabled     = checkBoxColor.Checked;
            labelPriceTcolor.Enabled    = checkBoxTcolor.Checked;
            numericUpDownTitle.Enabled  = checkBoxTitle.Checked;
            numericUpDownColor.Enabled  = checkBoxColor.Checked;
            numericUpDownTcolor.Enabled = checkBoxTcolor.Checked;
            labelMaxrank.Enabled        = checkBoxRank.Checked;
            comboBoxRank.Enabled        = checkBoxRank.Checked;
            listBoxRank.Enabled         = checkBoxRank.Checked;
            labelPriceRank.Enabled      = checkBoxRank.Checked;
            numericUpDownRank.Enabled   = checkBoxRank.Checked;
            dataGridView1.Enabled       = checkBoxLevel.Checked;
            buttonAdd.Enabled           = checkBoxLevel.Checked;
            CheckLevelEnables();

            SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
            this.Font = SystemFonts.IconTitleFont;
        }
Example #13
0
    protected override void OnStart()
    {
        base.OnStart();

        parent   = Find("Scroll View/Viewport/Content").gameObject;
        rankItem = Find("RankItem").GetComponent <RankItem>();
        closeBtn = Find("CloseBtn").GetComponent <Button>();

        UIEventListener.Get(closeBtn.gameObject).onClick = OnClick;

        InfomationInit(20);
    }
        public void PostRanks(string team, int score)
        {
            RankItem rank = new RankItem(team, score);

            rank.sign = Utility.SHA256(salt + team + score, Encoding.UTF8);

            string jsonData = JsonUtility.ToJson(rank);

            requestManager.Post(endPointURL, jsonData, (result) => {
                Debug.Log("Result: " + result);
            });
        }
Example #15
0
 public override void Updata(object data)
 {
     if (data == null)
     {
         return;
     }
     base.Updata(data);
     rankData = data as RankItem;
     if (isAwake)
     {
         UpdateView();
     }
 }
Example #16
0
        private void UpdateRanks() {
            RankItem rankItem = Economy.Ranks;
            rankItem.UpdatePrices();

            List<string> ranklist = new List<string>();
            foreach (RankItem.Rank rank in rankItem.RanksList) {
                ranklist.Add(rank.group.name);
                if (rank.group.name == rankItem.MaxRank) break;
            }
            listBoxRank.DataSource = ranklist;
            listBoxRank.SelectedItem = comboBoxRank.SelectedItem;
            numericUpDownRank.Value = rankItem.FindRank(comboBoxRank.SelectedItem.ToString()).price;
        }
Example #17
0
    void RequestMyLeaderboardFinish(string param)
    {
        loading.SetActive(false);

        KTPlayLeaderboard.KTLeaderboardCallbackParams leaderParams = new KTPlayLeaderboard.KTLeaderboardCallbackParams(param);
        switch (leaderParams.leaderboardEventResult)
        {
        case KTPlayLeaderboard.KTLeaderboardCallbackParams.KTLeaderboardEvent.KTPlayLeaderboardEventFriendsLeaderboard:
        {
        }
        break;

        case KTPlayLeaderboard.KTLeaderboardCallbackParams.KTLeaderboardEvent.KTPlayLeaderboardEventGlobalLeaderboard:
        {
            RecycleAllMyRankItem();

            ArrayList users = leaderParams.globalLeaderboardPaginator.items;

            Debug.Log("RequestMyLeaderboardFinish rank item count : " + users.Count.ToString());

            int index = 0;
            foreach (KTUser user in users)
            {
                RankItem rankItem = GetRankItem(myRankTable.gameObject);
                rankItem.name = string.Format("RankItem{0}", index);
                rankItem.Data = new RankData(user.nickname, (int)user.rank, user.score);

                bool isPlayer = (user.userId.Equals(KTAccountManager.CurrentAccount().userId));
                rankItem.IsPlayer = isPlayer;
                myRankItems.Add(rankItem);
                index++;
            }
            myRankTable.repositionNow = true;
        }
        break;

        case KTPlayLeaderboard.KTLeaderboardCallbackParams.KTLeaderboardEvent.KTPlayLeaderboardEventReportScore:
        {
            Debug.Log("KTPlayParams.KTPlayLeaderboardEventReportScore");
            Debug.Log("[reportScore requestInfo] leaderboardId = " + leaderParams.leaderboardId + " score = " + leaderParams.score);
        }
        break;

        case KTPlayLeaderboard.KTLeaderboardCallbackParams.KTLeaderboardEvent.OnKTError:
        {
            KTError error = (KTError)leaderParams.playError;
            Debug.Log("KTPlayParams.OnKTPlayError:" + "   code:" + error.code + "    description:" + error.description);
        }
        break;
        }
    }
Example #18
0
    //-------------------------一些接口--------------------------------------------------------
    public RankItem createRankItem(int rank, string name, string score)
    {
        RankItem rankItem = Instantiate(_rankItemPrefab, new Vector3(0, 0, 0), Quaternion.identity);

        rankItem.transform.SetParent(_rankRoot.transform);

        rankItem.transform.localPosition = new Vector3(0, -(rank - 1) * 66, 0);

        rankItem.updateRankItem(rank, name, score);

        rankItem.transform.localScale = rankItem.transform.localScale * CommonUtil.Util.getScreenScale();

        return(rankItem);
    }
Example #19
0
    // 랭킹 불러오기 (UUID지정)
    private void GetRankTop10ByUuid()
    {
        // 랭킹 불러오기
        RankItem item;
        int      rankCount = 10;

        Backend.Rank.GetRankByUuid(rankUuid, rankCount, rankListBro =>
        {
            if (rankListBro.IsSuccess())
            {
                // 내 랭킹 가져오기
                GetMyRank();

                // lastUpdatedRankTime 업데이트
                DateTime now = DateTime.Now;
                foreach (int date in updatingRankTime)
                {
                    if (now.Hour < date || (now.Hour == date && now.Minute < 0))
                    {
                        break;
                    }
                    lastUpdatedRankTime = date;
                }

                // rank 저장
                JsonData rankData = rankListBro.GetReturnValuetoJSON()["rows"];
                rankTop10DataList.Clear();
                for (int i = 0; i < rankCount; i++)
                {
                    if (rankData[i] != null)
                    {
                        item = new RankItem
                        {
                            nickname = rankData[i].Keys.Contains("nickname") ? rankData[i]["nickname"]["S"].ToString() : dash,
                            rank     = rankData[i].Keys.Contains("rank") ? rankData[i]["rank"]["N"].ToString() : dash,
                            score    = rankData[i].Keys.Contains("score") ? rankData[i]["score"]["N"].ToString() : dash
                        };
                        rankTop10DataList.Add(item);
                    }
                }
            }
            else
            {
                ShowMessage("[X]랭킹 불러오기 실패");
                Debug.Log("랭킹 불러오기 실패 - " + rankListBro.ToString());
            }
        });
    }
Example #20
0
    private void OnScroeChanged(int newValue)
    {
        Scroe = newValue;

        for (int i = 0; i < RankPanel._Instance.rankItemList.Count; i++)
        {
            if (this.gameObject == RankPanel._Instance.rankItemList[i].target)
            {
                RankItem rankItem = RankPanel._Instance.rankItemList[i];
                rankItem.score_int = Scroe;
            }
        }


        Debug.Log("玩家" + PlayerNum + "Score=" + Scroe);
    }
Example #21
0
 //[Command]
 void CmdCreateRankItem()
 {
     for (int i = 0; i < GameManager.Instance.playerDatas.Count; i++)
     {
         GameObject rankItem_go = Instantiate(res_RankItem, rankItemParent);
         RankItem   rankItem    = rankItem_go.GetComponent <RankItem>();
         if (rankItem == null)
         {
             rankItem = rankItem_go.AddComponent <RankItem>();
         }
         rankItem.target   = GameManager.Instance.playerDatas[i].gameObject;
         rankItem.name_str = GameManager.Instance.playerDatas[i].PlayerName;
         rankItemList.Add(rankItem);
         //NetworkServer.Spawn(rankItem_go);
     }
 }
Example #22
0
 private void OnRankRefresh(string gameEvent)
 {
     for (int i = 0; i < RankMgr.RANK_NUM; i++)
     {
         GameObject go   = grid.transform.GetChild(i).gameObject;
         RankItem   item = go.GetComponent <RankItem>();
         if (i < RankMgr.instance.rankInfos.Count)
         {
             item.SetData(RankMgr.instance.rankInfos[i]);
         }
         else
         {
             go.SetActive(false);
         }
     }
     grid.repositionNow = true;
 }
Example #23
0
    void CreateItem(List <SlgPB.PVPUser> _pvpUsers)
    {
//		_playItemList.Clear();
        _Grid.DestoryAllChildren();
//		int dataCount = _pvpUsers.Count;

        for (int i = 0; i < 8; i++)
        {
            GameObject prefab   = (GameObject)Resources.Load(AppConfig.FOLDER_PROFAB_UI + "pvp/rankItem");
            GameObject item     = NGUITools.AddChild(_Grid.gameObject, prefab);
            RankItem   playitem = item.GetComponent <RankItem>();
            item.name = "0" + i;
//			playitem.Init(_pvpUsers[i]);
//			_playItemList.Add(playitem);
        }
        _Grid.Reposition();
    }
Example #24
0
 public override void HandleAfterOpenView()
 {
     if (this.ladderBannerBgPic != null && this.ladderBannerBgPic.mainTexture == null)
     {
         this.ladderBannerBgPic.mainTexture = Resources.Load <Texture>("Texture/Rank/Ranking_title_bg_01");
     }
     if (this.magicBannerBgPic != null && this.magicBannerBgPic.mainTexture == null)
     {
         this.magicBannerBgPic.mainTexture = Resources.Load <Texture>("Texture/Rank/Ranking_title_bg_02");
     }
     if (this.magicBannerTexture != null && this.magicBannerTexture.mainTexture == null)
     {
         this.magicBannerTexture.mainTexture = Resources.Load <Texture>("Texture/MagicBottleHD/Magic_bottle_12");
     }
     this._rankItem = Resources.Load <RankItem>("Prefab/UI/Rank/RankItem");
     this.m_AlphaController.Begin();
 }
Example #25
0
    //显示面板
    public void Display()
    {
        //显示UI
        gameObject.SetActive(true);

        //排序(按照成绩 升序排列)
        dataList.Sort((a, b) => b.Score.CompareTo(a.Score));

        //创建UI项
        for (int i = 0; i < dataList.Count; i++)
        {
            //i  序号        dataList[i].Name  姓名  dataList[i].Score 成绩
            //创建UI
            RankItem item = Instantiate(itemUIPrefab, contentTF).GetComponent <RankItem>();
            //初始化(修改UI中的文字)
            item.Initialized(i + 1, dataList[i]);
        }
    }
Example #26
0
        private void ClearRankItemResources(Transform inParentTrans)
        {
            if (inParentTrans == null)
            {
                return;
            }
            int childCount = inParentTrans.childCount;

            for (int i = 0; i < childCount; i++)
            {
                Transform child     = inParentTrans.GetChild(i);
                RankItem  component = child.GetComponent <RankItem>();
                if (component != null)
                {
                    component.ClearResources();
                }
            }
        }
Example #27
0
    public void InfomationInit(int count)
    {
        ItemObjectReset();

        for (int i = 0; i < count; i++)
        {
            RankData dt = new RankData();
            dt.rank  = i + 1;
            dt.name  = Random.Range(100, 1000).ToString() + "Nick" + Random.Range(1, 100);
            dt.power = Random.Range(10000, 1000000);
            RankItem ri = Object.Instantiate(rankItem, parent.transform);
            ri.gameObject.SetActive(true);
            ri.transform.localScale    = Vector3.one;
            ri.transform.localRotation = Quaternion.identity;
            ri.InfoInit(dt);
            rankItemList.Add(ri);
        }
        Debug.Log(rankItemList.Count);
    }
Example #28
0
        public void AddMode1Rank(string name, int data)
        {
            if (name.Trim().Length == 0)
            {
                return;
            }
            RankItem ri = new RankItem()
            {
                name  = name,
                value = data,
            };

            bool isHave = false;

            foreach (RankItem item in m1r.datas)
            {
                if (item.name == name)
                {
                    if (item.value < data)
                    {
                        m1r.datas[m1r.datas.IndexOf(item)].value = data;
                    }
                    isHave = true;
                    break;
                }
            }

            if (!isHave)
            {
                m1r.datas.Add(ri);
            }

            m1r.datas.Sort();

            FileStream fs = new FileStream(@"data/mode1RankInfo.json", FileMode.Create, FileAccess.ReadWrite);

            StreamWriter sw = new StreamWriter(fs);

            sw.Write(JsonHelper.ToJson(m1r));

            sw.Close();
        }
Example #29
0
        void UpdateRanks()
        {
            RankItem rankItem = Economy.Ranks;

            rankItem.UpdatePrices();

            List <string> ranklist = new List <string>();

            foreach (RankItem.Rank rank in rankItem.RanksList)
            {
                ranklist.Add(rank.group.Name);
                if (rank.group.Permission >= rankItem.MaxRank)
                {
                    break;
                }
            }
            listBoxRank.DataSource   = ranklist;
            listBoxRank.SelectedItem = comboBoxRank.SelectedItem;
            listBoxRank_SelectedIndexChanged(null, null);
        }
Example #30
0
    RankItem GetRankItem(GameObject container)
    {
        RankItem rankItem = null;

        if (rankItemPrefab == null)
        {
            rankItemPrefab = Resources.Load("Prefabs/RankItem") as GameObject;
        }
        if (recycledItems.Count > 0)
        {
            rankItem = recycledItems.Dequeue();
            rankItem.transform.parent = container.transform;
        }
        else
        {
            GameObject rankItemObj = SystemUtility.InstantiatePrefabe(rankItemPrefab, container, new Vector3(0, -48, 0));
            rankItem = rankItemObj.GetComponent <RankItem>();
        }
        return(rankItem);
    }
Example #31
0
    public override void Show(bool active)
    {
        base.Show(active);
        if (active)
        {
            GameSystem.GetInstance().gameUI.mainMenu.Show(false);
            modeNameLabel.text     = TextManager.GetText(string.Format("mode_name_{0}", (int)GameSystem.GetInstance().CurrentMode));
            modeTypeNameLabel.text = string.Format("({0})", TextManager.GetText(string.Format("mode_type_name_{0}", (int)GameSystem.GetInstance().CurrentModeType)));

            topRankToggle.value = true;
            ResetTopRankPanelClipOffset();

#if UNITY_EDITOR
            loading.SetActive(false);
            loginButton.SetActive(false);
            RecycleAllTopRankItem();
            RecycleAllMyRankItem();
            for (int i = 0; i < Constant.TOP_RANK_COUNT; ++i)
            {
                RankItem rankItem = GetRankItem(topRankTable.gameObject);
                rankItem.name = string.Format("RankItem{0}", i);
                rankItem.Data = new RankData("username" + i, i + 1, (100 * (Constant.TOP_RANK_COUNT - i - 1)).ToString());
                topRankItems.Add(rankItem);

                rankItem      = GetRankItem(myRankTable.gameObject);
                rankItem.name = string.Format("RankItem{0}", i);
                rankItem.Data = new RankData("username" + i, i + 1, (100 * (Constant.TOP_RANK_COUNT - i - 1)).ToString());
                myRankItems.Add(rankItem);
            }
            topRankTable.repositionNow = true;
            myRankTable.repositionNow  = true;
#else
            if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
            {
                Debug.Log("Start Load Global Rank");
                loading.SetActive(true);
                LeaderboardManager.RequestGameLeaderboard(GameSystem.GetInstance().CurrentMode, GameSystem.GetInstance().CurrentModeType, this, RequestGameLeaderboardFinish);
            }
#endif
        }
    }