Beispiel #1
0
        // Token: 0x06001854 RID: 6228 RVA: 0x00069274 File Offset: 0x00067474
        private static void SetProjectilePrefabs(GameObject[] newProjectilePrefabs)
        {
            ProjectileCatalog.projectilePrefabs = HGArrayUtilities.Clone <GameObject>(newProjectilePrefabs);
            int num = 256;

            if (ProjectileCatalog.projectilePrefabs.Length > num)
            {
                Debug.LogErrorFormat("Cannot have more than {0} projectile prefabs defined, which is over the limit for {1}. Check comments at error source for details.", new object[]
                {
                    num,
                    typeof(byte).Name
                });
                for (int i = num; i < ProjectileCatalog.projectilePrefabs.Length; i++)
                {
                    Debug.LogErrorFormat("Could not register projectile [{0}/{1}]=\"{2}\"", new object[]
                    {
                        i,
                        num - 1,
                        ProjectileCatalog.projectilePrefabs[i].name
                    });
                }
            }
            ProjectileCatalog.projectilePrefabProjectileControllerComponents = new ProjectileController[ProjectileCatalog.projectilePrefabs.Length];
            ProjectileCatalog.projectileNames = new string[ProjectileCatalog.projectilePrefabs.Length];
            for (int j = 0; j < ProjectileCatalog.projectilePrefabs.Length; j++)
            {
                GameObject           gameObject = ProjectileCatalog.projectilePrefabs[j];
                ProjectileController component  = gameObject.GetComponent <ProjectileController>();
                component.catalogIndex = j;
                ProjectileCatalog.projectilePrefabProjectileControllerComponents[j] = component;
                ProjectileCatalog.projectileNames[j] = gameObject.name;
            }
        }
Beispiel #2
0
 // Token: 0x060003EF RID: 1007 RVA: 0x0000F7B4 File Offset: 0x0000D9B4
 private static void SetBodyPrefabs([NotNull] GameObject[] newBodyPrefabs)
 {
     BodyCatalog.bodyPrefabs = HGArrayUtilities.Clone <GameObject>(newBodyPrefabs);
     BodyCatalog.bodyPrefabBodyComponents = new CharacterBody[BodyCatalog.bodyPrefabs.Length];
     BodyCatalog.bodyNames      = new string[BodyCatalog.bodyPrefabs.Length];
     BodyCatalog.bodyComponents = new Component[BodyCatalog.bodyPrefabs.Length][];
     BodyCatalog.skillSlots     = new GenericSkill[BodyCatalog.bodyPrefabs.Length][];
     BodyCatalog.skins          = new SkinDef[BodyCatalog.bodyPrefabs.Length][];
     BodyCatalog.nameToIndexMap.Clear();
     for (int i = 0; i < BodyCatalog.bodyPrefabs.Length; i++)
     {
         GameObject gameObject = BodyCatalog.bodyPrefabs[i];
         string     name       = gameObject.name;
         BodyCatalog.bodyNames[i]      = name;
         BodyCatalog.bodyComponents[i] = gameObject.GetComponents <Component>();
         BodyCatalog.skillSlots[i]     = gameObject.GetComponents <GenericSkill>();
         BodyCatalog.nameToIndexMap.Add(name, i);
         BodyCatalog.nameToIndexMap.Add(name + "(Clone)", i);
         (BodyCatalog.bodyPrefabBodyComponents[i] = gameObject.GetComponent <CharacterBody>()).bodyIndex = i;
         Texture2D    texture2D = Resources.Load <Texture2D>("Textures/BodyIcons/" + name);
         SkinDef[][]  array     = BodyCatalog.skins;
         int          num       = i;
         ModelLocator component = gameObject.GetComponent <ModelLocator>();
         SkinDef[]    array2;
         if (component == null)
         {
             array2 = null;
         }
         else
         {
             Transform modelTransform = component.modelTransform;
             if (modelTransform == null)
             {
                 array2 = null;
             }
             else
             {
                 ModelSkinController component2 = modelTransform.GetComponent <ModelSkinController>();
                 array2 = ((component2 != null) ? component2.skins : null);
             }
         }
         array[num] = (array2 ?? Array.Empty <SkinDef>());
         if (texture2D)
         {
             BodyCatalog.bodyPrefabBodyComponents[i].portraitIcon = texture2D;
         }
         else if (BodyCatalog.bodyPrefabBodyComponents[i].portraitIcon == null)
         {
             BodyCatalog.bodyPrefabBodyComponents[i].portraitIcon = Resources.Load <Texture2D>("Textures/MiscIcons/texMysteryIcon");
         }
         if (Language.IsTokenInvalid(BodyCatalog.bodyPrefabBodyComponents[i].baseNameToken))
         {
             BodyCatalog.bodyPrefabBodyComponents[i].baseNameToken = "UNIDENTIFIED";
         }
     }
     BodyCatalog.bodyCount = BodyCatalog.bodyPrefabs.Length;
 }
 // Token: 0x060017AF RID: 6063 RVA: 0x00066E18 File Offset: 0x00065018
 private static void SetEntries(GameObject[] newEntries)
 {
     MasterCatalog.masterPrefabs = HGArrayUtilities.Clone <GameObject>(newEntries);
     MasterCatalog.masterPrefabMasterComponents = new CharacterMaster[MasterCatalog.masterPrefabs.Length];
     for (int i = 0; i < MasterCatalog.masterPrefabs.Length; i++)
     {
         MasterCatalog.MasterIndex value = new MasterCatalog.MasterIndex(i);
         MasterCatalog.nameToIndexMap.Add(MasterCatalog.masterPrefabs[i].name, value);
         MasterCatalog.nameToIndexMap.Add(MasterCatalog.masterPrefabs[i].name + "(Clone)", value);
         MasterCatalog.masterPrefabMasterComponents[i] = MasterCatalog.masterPrefabs[i].GetComponent <CharacterMaster>();
     }
     MasterCatalog.aiMasterPrefabs = (from master in MasterCatalog.masterPrefabMasterComponents
                                      where master.GetComponent <BaseAI>()
                                      select master).ToArray <CharacterMaster>();
 }
Beispiel #4
0
 // Token: 0x06001910 RID: 6416 RVA: 0x0006C164 File Offset: 0x0006A364
 private static void SetSceneDefs(SceneDef[] newSceneDefs)
 {
     SceneCatalog.indexToSceneDef = HGArrayUtilities.Clone <SceneDef>(newSceneDefs);
     for (int i = 0; i < SceneCatalog.indexToSceneDef.Length; i++)
     {
         SceneCatalog.indexToSceneDef[i].sceneDefIndex = i;
     }
     SceneManager.activeSceneChanged += delegate(Scene oldScene, Scene newScene)
     {
         SceneCatalog.currentSceneDef = SceneCatalog.GetSceneDefFromSceneName(newScene.name);
         if (SceneCatalog.currentSceneDef != null)
         {
             SceneCatalog.mostRecentSceneDef = SceneCatalog.currentSceneDef;
             Action <SceneDef> action = SceneCatalog.onMostRecentSceneDefChanged;
             if (action == null)
             {
                 return;
             }
             action(SceneCatalog.mostRecentSceneDef);
         }
     };
     SceneCatalog.currentSceneDef    = SceneCatalog.GetSceneDefFromSceneName(SceneManager.GetActiveScene().name);
     SceneCatalog.mostRecentSceneDef = SceneCatalog.currentSceneDef;
 }