Example #1
0
        public override void OnApplicationStart()
        {
            Instance = this;
            try
            {
                //Adapted from knah's JoinNotifier mod found here: https://github.com/knah/VRCMods/blob/master/JoinNotifier/JoinNotifierMod.cs
                using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ActionMenuUtils.icons"))
                    using (var tempStream = new MemoryStream((int)stream.Length))
                    {
                        stream.CopyTo(tempStream);

                        iconsAssetBundle            = AssetBundle.LoadFromMemory_Internal(tempStream.ToArray(), 0);
                        iconsAssetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset;
                    }
                respawnIcon            = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Refresh.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>();
                respawnIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset;
                helpIcon                      = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Help.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>();
                helpIcon.hideFlags           |= HideFlags.DontUnloadUnusedAsset;
                goHomeIcon                    = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Home.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>();
                goHomeIcon.hideFlags         |= HideFlags.DontUnloadUnusedAsset;
                resetAvatarIcon               = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Avatar.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>();
                resetAvatarIcon.hideFlags    |= HideFlags.DontUnloadUnusedAsset;
                rejoinInstanceIcon            = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Pin.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>();
                rejoinInstanceIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset;
            }
            catch (Exception e) {
                MelonLogger.Warning("Consider checking for newer version as mod possibly no longer working, Exception occured OnAppStart(): " + e.Message);
            }
            // Creates new Api instance and patches all required methods if found
            actionMenuApi = new ActionMenuAPI();
            ModSettings.RegisterSettings();
            ModSettings.Apply();
            SetupButtons();
            //_ = Utils.GetGoHomeDelegate;
        }