コード例 #1
0
ファイル: PlayerPerk.cs プロジェクト: shibuzhuan/CovKnight
        public void Init()
        {
            if (init)
            {
                return;
            }
            init = true;

            //if(!enablePerk) return;

            //loading the perks from DB
            List <Perk> dbList = PerkDB.Load();

            for (int i = 0; i < dbList.Count; i++)
            {
                if (!unavailableIDList.Contains(dbList[i].ID))
                {
                    Perk perk = dbList[i].Clone();
                    perkList.Add(perk);
                }
            }

            for (int i = 0; i < perkList.Count; i++)
            {
                perkList[i].SetPlayer(player);
            }

            StartCoroutine(UnlockPurchasedPerk());
        }
コード例 #2
0
 public static void CopyFromOldDB()
 {
     Init();
     if (instance.copiedFromOldDB)
     {
         return;
     }
     instance.copiedFromOldDB = true;
     instance.perkList        = new List <Perk>(PerkDB.LoadClone1());
 }
コード例 #3
0
        public static List <Perk> LoadClone1()
        {
            PerkDB      instance = LoadDB1();
            List <Perk> list     = new List <Perk>();

            for (int i = 0; i < instance.perkList.Count; i++)
            {
                list.Add(instance.perkList[i].Clone());
            }
            return(list);
        }
コード例 #4
0
        public static List <Perk> Load()
        {
            GameObject obj = Resources.Load("DB_TDSTK/DB_Perk", typeof(GameObject)) as GameObject;

                        #if UNITY_EDITOR
            if (obj == null)
            {
                obj = CreatePrefab();
            }
                        #endif

            PerkDB instance = obj.GetComponent <PerkDB>();
            return(instance.perkList);
        }
コード例 #5
0
        public static List <Perk> LoadClone()
        {
            GameObject obj = Resources.Load("DB_TDSTK/DB_Perk", typeof(GameObject)) as GameObject;

                        #if UNITY_EDITOR
            if (obj == null)
            {
                obj = CreatePrefab();
            }
                        #endif

            PerkDB instance = obj.GetComponent <PerkDB>();

            List <Perk> list = new List <Perk>();
            for (int i = 0; i < instance.perkList.Count; i++)
            {
                list.Add(instance.perkList[i].Clone());
            }

            return(list);
        }
コード例 #6
0
        public static void LoadPerk()
        {
            perkDB = PerkDB.LoadDB();

            for (int i = 0; i < perkDB.perkList.Count; i++)
            {
                if (perkDB.perkList[i] != null)
                {
                    //perkDB.perkList[i].ID=i;
                    perkIDList.Add(perkDB.perkList[i].ID);
                }
                else
                {
                    perkDB.perkList.RemoveAt(i);
                    i -= 1;
                }
            }

            UpdateLabel_Perk();

            TDSEditorWindow.SetPerkDB(perkDB, perkIDList, perkLabel);
            TDSEditorInspector.SetPerkDB(perkDB, perkIDList, perkLabel);
        }
コード例 #7
0
 public static void SetPerkDB(PerkDB db, List <int> IDList, string[] label)
 {
     perkDB     = db;
     perkIDList = IDList;
     perkLabel  = label;
 }