コード例 #1
0
        private void Start()
        {
            Instance = this;

            if (!KKAPI.KoikatuAPI.CheckRequiredPlugin(this, KKAPI.KoikatuAPI.GUID, new Version(KKAPI.KoikatuAPI.VersionConst)))
            {
                return;
            }

            if (File.Exists(Path.Combine(Paths.PluginPath, "KKABMPlugin.dll")) || File.Exists(Path.Combine(Paths.PluginPath, "KKABMGUI.dll")))
            {
                Log(LogLevel.Message | LogLevel.Error, "Old version of ABM found! Remove KKABMPlugin.dll and KKABMGUI.dll and restart the game.");
                return;
            }

            XyzMode                 = new ConfigWrapper <bool>("XYZ-Scale-Mode", this, false);
            RaiseLimits             = new ConfigWrapper <bool>("RaiseLimits", this, false);
            XyzMode.SettingChanged += KKABMX_GUI.OnIsAdvancedModeChanged;

            gameObject.AddComponent <KKABMX_GUI>();

            CharacterApi.RegisterExtraBehaviour <BoneController>(ExtDataGUID);

            Hooks.Init();
        }
コード例 #2
0
ファイル: KKABMX_Core.cs プロジェクト: AxSaber/KKABMX
        private void Start()
        {
            Instance = this;

            if (!KKAPI.KoikatuAPI.CheckRequiredPlugin(this, KKAPI.KoikatuAPI.GUID, new Version(KKAPI.KoikatuAPI.VersionConst)))
            {
                return;
            }

            XyzMode                 = Config.Wrap("GUI", Metadata.XyzModeName, Metadata.XyzModeDesc, false);
            RaiseLimits             = Config.Wrap("GUI", Metadata.RaiseLimitsName, Metadata.RaiseLimitsDesc, false);
            XyzMode.SettingChanged += KKABMX_GUI.OnIsAdvancedModeChanged;

            gameObject.AddComponent <KKABMX_GUI>();

            CharacterApi.RegisterExtraBehaviour <BoneController>(ExtDataGUID);

            HarmonyWrapper.PatchAll(typeof(Hooks));
        }
コード例 #3
0
        private void DrawHeader()
        {
            GUILayout.BeginHorizontal(UnityEngine.GUI.skin.box);
            {
                GUILayout.Label("Add a new bone to the list. If valid, it will be saved to the card.");

                // todo Use _boneControllerMgr.GetAllPossibleBoneNames() for autocomplete/suggestions
                _boneAddFieldValue = GUILayout.TextField(_boneAddFieldValue, GUILayout.Width(90));

                if (GUILayout.Button("Add"))
                {
                    _addedBones.Add(_boneAddFieldValue);

                    var bc = _boneControllerMgr;

                    if (bc.GetModifier(_boneAddFieldValue) != null)
                    {
                        Logger.Log(LogLevel.Message, $"Bone {_boneAddFieldValue} is already added.");
                        _boneAddFieldValue = "";
                    }
                    else
                    {
                        var newMod = new BoneModifier(_boneAddFieldValue);
                        bc.AddModifier(newMod);
                        if (newMod.BoneTransform == null)
                        {
                            Logger.Log(LogLevel.Message, $"Failed to add bone {_boneAddFieldValue}, make sure the name is correct.");
                            bc.Modifiers.Remove(newMod);
                        }
                        else
                        {
                            Logger.Log(LogLevel.Message, $"Added bone {_boneAddFieldValue} successfully. Modify it to make it save.");
                            _boneAddFieldValue = "";
                        }
                    }
                }

                _onlyShowAdditional = GUILayout.Toggle(_onlyShowAdditional, "Only show added bones");
            }
            GUILayout.EndHorizontal();
        }