Example #1
0
        private void Setup()
        {
            var packName = "sinai-dev CombatHUD";

            var pack   = SL.GetSLPack(packName);
            var bundle = pack.AssetBundles["combathud"];

            var canvasAsset = bundle.LoadAsset <GameObject>("HUDCanvas");

            HUDCanvas = Instantiate(canvasAsset);
            DontDestroyOnLoad(HUDCanvas);
            HUDCanvas.hideFlags |= HideFlags.HideAndDontSave;

            var canvas = HUDCanvas.GetComponent <Canvas>();

            canvas.sortingOrder = 999;

            var targetMgrHolder = HUDCanvas.transform.Find("TargetManager_Holder");

            for (int i = 0; i < 2; i++)
            {
                targetMgrHolder.transform.Find($"TargetManager_P{i + 1}")
                .gameObject.AddComponent <TargetManager>()
                .SplitID = i;
            }

            HUDCanvas.transform.Find("PlayerStatusTimers").gameObject.AddComponent <PlayersManager>();
            HUDCanvas.transform.Find("DamageLabels").gameObject.AddComponent <DamageLabels>();

            Logger.LogMessage("Combat HUD finished setting up");
        }
Example #2
0
        public static void Init()
        {
            var pack = SL.GetSLPack("sinai-dev Necromancer");

            trainerTemplate = pack.CharacterTemplates["com.sinai.necromancer.trainer"];

            trainerTemplate.OnSpawn += LocalTrainerSetup;
        }
Example #3
0
        internal static void Init()
        {
            var pack = SL.GetSLPack("sinai-dev Necromancer");

            Skeleton          = pack.CharacterTemplates["com.sinai.necromancer.skeleton"];
            Skeleton.OnSpawn += OnSummonSpawn;

            Ghost          = pack.CharacterTemplates["com.sinai.necromancer.ghost"];
            Ghost.OnSpawn += OnSummonSpawn;
        }
        private void SetupCanvas()
        {
            // Debug.Log(ModBase.ModName + " started, version: " + ModBase.ModVersion);

            var pack = SL.GetSLPack("SharedModConfig");

            if (pack == null)
            {
                Debug.LogError("ERROR: Could not find pack 'SharedModConfig'! Please make sure it exists at Mods/SideLoader/SharedModConfig!");
            }

            var bundle = pack.AssetBundles["sharedmodconfig"];

            if (bundle.LoadAsset <GameObject>("SharedModConfigCanvas") is GameObject canvasAsset)
            {
                m_ConfigCanvas = Instantiate(canvasAsset);
                DontDestroyOnLoad(m_ConfigCanvas);
                m_ConfigCanvas.SetActive(true);

                m_MenuButton = m_ConfigCanvas.transform.Find("MenuButton").GetComponent <Button>();
                m_MenuButton.gameObject.SetActive(true);
                m_MenuButton.onClick.AddListener(MenuButton);

                m_ConfigPanel = m_ConfigCanvas.transform.Find("Panel").gameObject;

                var headerHolder = m_ConfigPanel.transform.Find("Header_Holder");

                // close button (X)
                m_closeButton = headerHolder.transform.Find("CloseButton").gameObject.GetComponent <Button>();
                m_closeButton.onClick.AddListener(CloseButton);

                // mod list and buttons
                m_modListHolder       = headerHolder.Find("ModList_Holder").Find("ModList_Viewport").Find("ModList_Content").gameObject;
                m_ModListButtonPrefab = m_modListHolder.transform.Find("Button_Holder").gameObject;
                var modlistButton = m_ModListButtonPrefab.GetComponent <Button>();
                modlistButton.onClick.AddListener(ModListButton);
                m_ModListButtonPrefab.SetActive(false);

                // mod settings template
                m_SettingsHolder = m_ConfigPanel.transform.Find("Settings_Holder").gameObject;

                m_SettingsPrefab = m_SettingsHolder.transform.Find("Settings_Prefab").gameObject;
                m_SettingsPrefab.SetActive(false);

                // disable main panel
                m_ConfigPanel.SetActive(false);
            }
        }
Example #5
0
        private void CreatePack()
        {
            RefreshLoadedSLPacks();

            var name = m_createInput.text;

            var safename = Serializer.ReplaceInvalidChars(name);

            if (string.IsNullOrEmpty(safename))
            {
                return;
            }

            if (name != safename)
            {
                SL.LogWarning("SLPack name contains invalid path characters! Try '" + safename + "'");
                return;
            }

            if (SL.GetSLPack(name) != null)
            {
                SL.LogWarning("Cannot make an SLPack with this name as one already exists!");
                return;
            }

            var slPack = new SLPack
            {
                Name = name
            };

            Directory.CreateDirectory(Paths.PluginPath + $@"\{name}");
            SL.s_packs.Add(name, slPack);

            RefreshLoadedSLPacks();

            for (int i = 0; i < m_slPackDropdown.options.Count; i++)
            {
                var opt = m_slPackDropdown.options[i];
                if (opt.text == name)
                {
                    m_slPackDropdown.value = i;
                    break;
                }
            }
        }
Example #6
0
        public override void ApplyTemplate(ContentTemplate template)
        {
            var character = template as SL_Character;

            character.ApplyActualTemplate();

            if (!string.IsNullOrEmpty(character.SerializedSLPackName))
            {
                var pack = SL.GetSLPack(character.SerializedSLPackName);
                if (pack.CharacterTemplates.ContainsKey(character.UID))
                {
                    SL.LogWarning("Loaded a dupliate UID SL_Character! UID: " + character.UID);
                }
                else
                {
                    pack.CharacterTemplates.Add(character.UID, character);
                }
            }
        }
Example #7
0
        private void Setup()
        {
            var packName = "sinai-dev CombatHUD";

            var pack   = SL.GetSLPack(packName);
            var bundle = pack.AssetBundles["combathud"];

            var canvasAsset = bundle.LoadAsset <GameObject>("HUDCanvas");

            HUDCanvas = UnityEngine.Object.Instantiate(canvasAsset);
            UnityEngine.Object.DontDestroyOnLoad(HUDCanvas);
            HUDCanvas.hideFlags |= HideFlags.HideAndDontSave;

            // setup draw order
            var canvas = HUDCanvas.GetComponent <Canvas>();

            canvas.sortingOrder = 999; // higher = shown above other layers.

            // setup the autonomous components

            // ====== target manager ======
            var targetMgrHolder = HUDCanvas.transform.Find("TargetManager_Holder");

            for (int i = 0; i < 2; i++)
            {
                var mgr = targetMgrHolder.transform.Find($"TargetManager_P{i + 1}").gameObject.AddComponent <TargetManager>();
                mgr.Split_ID = i;
            }

            // ====== player manager ======
            var statusTimerHolder = HUDCanvas.transform.Find("PlayerStatusTimers");

            statusTimerHolder.gameObject.AddComponent <PlayersManager>();

            // ====== damage labels ======
            var damageLabels = HUDCanvas.transform.Find("DamageLabels");

            damageLabels.gameObject.AddComponent <DamageLabels>();

            Logger.LogMessage("Combat HUD finished setting up");
        }