예제 #1
0
    void MakeChamp(string name)
    {
        ChampInstance myInstance;
        GameObject    myChamp;

        for (int i = 0; i < addObjectCnt; i++)
        {
            championPrefabs.TryGetValue(name, out myChamp);
            myInstance           = new ChampInstance();
            myInstance.name      = name;
            myInstance.quality   = 1;
            myInstance.isClickOk = false;
            myInstance.champion  = Instantiate(myChamp, Vector3.zero, Quaternion.identity, transform);
            myInstance.champion.SetActive(false);
            ChampInfo.SetupChampInfo(myInstance);
            myInstance.SetupDefault();
            championPool.Add(myInstance);
        }// loop: 정해진 크기만큼 미리 인스턴스를 생성한다

        // 오브젝트풀의 크기가 maxPoolCnt 보다 커지면 넘어간 만큼 지운다.
        if (championPool.Count > maxPoolCnt)
        {
            RemoveChamp(championPool.Count - maxPoolCnt);
        }
    }
예제 #2
0
    void generate_champ_list()
    {
        int total_num = Utility.get_num_all_champions();

        for (int i = 1; i <= total_num; ++i)
        {
            GameObject newChamp  = Instantiate(champButton_prefab, Vector3.zero, Quaternion.identity) as GameObject;
            ChampInfo  champinfo = newChamp.GetComponent <ChampInfo> ();
            champinfo.name = (Champion.champion_name)i;
            Button button = newChamp.GetComponent <Button>();
            newChamp.transform.FindChild("Name").gameObject.GetComponent <Text>().text = GameData.champ_names[(int)champinfo.name];
            newChamp.transform.SetParent(champs.transform);
        }
    }
 void Reg_buttons(int _idx)
 {
     ManagerInstance.button_blue.GetComponent <Button>().onClick.AddListener(delegate { ManagerInstance.change_team_BLUE(idx); });
     ManagerInstance.button_red.GetComponent <Button>().onClick.AddListener(delegate { ManagerInstance.change_team_RED(idx); });
     ManagerInstance.button_quit.GetComponent <Button> ().onClick.AddListener(delegate { ManagerInstance.OnClickQuit(idx); });
     //reg champ select button
     for (int i = 0; i < ManagerInstance.champs.transform.childCount; ++i)
     {
         ChampInfo champinfo = ManagerInstance.champs.transform.GetChild(i).GetComponent <ChampInfo> ();
         Button    button    = ManagerInstance.champs.transform.GetChild(i).GetComponent <Button>();
         button.onClick.AddListener(delegate { ManagerInstance.sel_champ(champinfo.name, idx); });          //champinfo.name
     }
     //reg lock button
     ManagerInstance.champsellist.transform.FindChild("Button_lock").gameObject.GetComponent <Button>().onClick.AddListener(delegate {
         SendReady(true);
     });
 }
예제 #4
0
        public void LoadChampInfo()
        {
            DataPull  pull = new DataPull();
            DataView  dv   = new DataView();
            ChampInfo ci   = new ChampInfo();

            dv = pull.PullChampInfo();

            foreach (DataRowView row in dv)
            {
                Champ cha = new Champ();

                cha.championId       = int.Parse(row["championId"].ToString());
                cha.banRate          = row["banRate"].ToString();
                cha.pickRate         = row["pickRate"].ToString();
                cha.winWithItems     = row["winWithItems"].ToString();
                cha.winWithoutItems  = row["winWithoutItems"].ToString();
                cha.bestItem         = row["bestItem"].ToString();
                cha.AvgAssist        = row["AvgAssist"].ToString();
                cha.AvgDeaths        = row["AvgDeaths"].ToString();
                cha.AvgGoldEarned    = row["AvgGoldEarned"].ToString();
                cha.AvgKills         = row["AvgKills"].ToString();
                cha.AvgMinionsKilled = row["AvgMinionsKilled"].ToString();
                cha.AvgTowerKills    = row["AvgTowerKills"].ToString();
                cha.AvgWardsPlaced   = row["AvgWardsPlaced"].ToString();
                cha.MaxAssist        = row["MaxAssist"].ToString();
                cha.MaxDeaths        = row["MaxDeaths"].ToString();
                cha.MaxGoldEarned    = row["MaxGoldEarned"].ToString();
                cha.MaxKills         = row["MaxKills"].ToString();
                cha.MaxMinionsKilled = row["MaxMinionsKilled"].ToString();
                cha.MaxTowerKills    = row["MaxTowerKills"].ToString();
                cha.MaxWardsPlaced   = row["MaxWardsPlaced"].ToString();

                ci.info.Add(cha);
            }

            string json = JsonConvert.SerializeObject(ci);
            var    path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "//RitoOutput//ChampInfo.json";

            File.WriteAllText(path, json);
        }