コード例 #1
0
        public void UpdateList(bl_ClassCustomize target)
        {
            List <bl_GunInfo> all = bl_GameData.Instance.AllWeapons;

            for (int i = 0; i < all.Count; i++)
            {
                int index = AllWeapons.FindIndex(x => x.Name == all[i].Name);
                if (index < 0)
                {
                    WeaponItemData wid = new WeaponItemData()
                    {
                        Name  = all[i].Name,
                        GunID = i,
                    };
                    AllWeapons.Add(wid);
#if UNITY_EDITOR
                    EditorUtility.SetDirty(target);
#endif
                }
                else
                {
                    if (AllWeapons[index].GunID != i)
                    {
                        AllWeapons[index].GunID = i;
#if UNITY_EDITOR
                        EditorUtility.SetDirty(target);
#endif
                    }
                }
            }
            //clean non existing fields
            for (int i = 0; i < AllWeapons.Count; i++)
            {
                int index = all.FindIndex(x => x.Name == AllWeapons[i].Name);
                if (index < 0)
                {
                    AllWeapons.RemoveAt(i);
#if UNITY_EDITOR
                    EditorUtility.SetDirty(target);
#endif
                }
            }
        }
コード例 #2
0
 private void OnEnable()
 {
     script = (bl_ClassCustomize)target;
 }
コード例 #3
0
ファイル: bl_ClassInfoUI.cs プロジェクト: cnshouse/FPS_HEXEN2
        /// <summary>
        ///
        /// </summary>
        public void ChangeSlot()
        {
            bl_ClassCustomize c = FindObjectOfType <bl_ClassCustomize>();

            c.ChangeSlotClass(ID, ClassId, ListID);
        }