Esempio n. 1
0
        private static void CreateRunes()
        {
            if (Instance.BaseRunePrefab == null)
            {
                Debug.LogError("Rune prefab is null");
                return;
            }

            foreach (Rune rune in RuneDB.Instance.AllRunes)
            {
                try
                {
                    rune.prefab      = UnityEngine.Object.Instantiate(Instance.BaseRunePrefab, RuneContainer.transform);
                    rune.prefab.name = rune.GetToken();
                    rune.prefab.GetComponent <ItemDrop>().m_itemData.m_shared.m_name        = rune.GetToken();
                    rune.prefab.GetComponent <ItemDrop>().m_itemData.m_shared.m_description = rune.GetToken() + "_Desc"; //rune.Desc ?? "";
                    rune.prefab.GetComponent <ItemDrop>().m_itemData.m_variant = rune.AssetIndex;
                    if (ObjectDB.instance.GetItemPrefab(rune.prefab.name.GetStableHashCode()) == null)
                    {
                        ItemHelper.AddItemToObjectDB(rune.prefab);
                        ItemHelper.AddItemToZNetScene(rune.prefab);
                    }
                }
                catch (Exception e)
                {
                    Debug.LogError($"Failed to create rune prefab: {rune.GetName()}");
                    Debug.LogException(e);
                }
            }
        }
Esempio n. 2
0
 public static void Prefix()
 {
     Instance.Load();
     if (ZNetScene.instance == null)
     {
         return;
     }
     foreach (GameObject prefab in Instance.Prefabs)
     {
         ItemHelper.AddPrefabToZNetScene(prefab);
     }
 }