コード例 #1
0
        public static CustomCharacterData BuildCharacter(string filePath, CustomPlayableCharacters identity, Vector3 foyerPos, bool hasAltSkin, Vector3 altSwapperPos, bool removeFoyerExtras = true, bool hasArmourlessAnimations = false, bool usesArmourNotHealth = false, bool paradoxUsesSprites = true,
                                                         bool useGlow = false, GlowMatDoer glowVars = null, GlowMatDoer altGlowVars = null, int metaCost = 0, bool hasCustomPast = false, string customPast = "")
        {
            //ETGModConsole.Log(BotsModule.FilePath);
            //ETGModConsole.Log(BotsModule.ZipFilePath);

            var data = GetCharacterData(filePath);

            data.foyerPos = foyerPos;
            data.idleDoer = new CharacterSelectIdleDoer
            {
                onSelectedAnimation = "select_choose",
                coreIdleAnimation   = "select_idle",
                idleMax             = 10,
                idleMin             = 4,
                EeveeTex            = null,
                IsEevee             = false,
                AnimationLibraries  = new tk2dSpriteAnimation[0],
                phases = new CharacterSelectIdlePhase[0],
            };

            //BotsModule.Log(data.nameInternal);
            //data.atlas = GameUIRoot.Instance.ConversationBar.portraitSprite.Atlas;//obj.GetOrAddComponent<dfAtlas>();



            data.skinSwapperPos = altSwapperPos;

            data.identity = identity;

            bool success = true;

            if (!CharApiHiveMind.AddNewCharacter(CharApi.prefix, (PlayableCharacters)identity))
            {
                ToolsCharApi.PrintError($"Duplicate Character ID found!! Character building for {identity} has been stopped to avoid horribly breaking things!");
                success = false;
            }
            else
            {
                try
                {
                    CharacterBuilder.BuildCharacter(data, hasAltSkin, paradoxUsesSprites, removeFoyerExtras, hasArmourlessAnimations, usesArmourNotHealth, hasCustomPast, customPast, metaCost, useGlow, glowVars, altGlowVars);
                    myPlayableCharacters.Add((PlayableCharacters)data.identity);
                }
                catch (Exception e)
                {
                    success = false;
                    ToolsCharApi.PrintError("An error occured while creating the character: " + data.name);
                    ToolsCharApi.PrintException(e);
                }
            }


            if (success)
            {
                ToolsCharApi.Print("Built prefab for: " + data.name);
                return(data);
            }
            return(null);
        }
コード例 #2
0
 public static void Init(string prefix)
 {
     CharApi.prefix = prefix;
     CharApiHiveMind.Init(prefix);
     Hooks.Init();
     ToolsCharApi.Init();
     ETGMod.StartGlobalCoroutine(DelayedStartCR());
     //SaveFileBullShit.Load();
 }