コード例 #1
0
        // Token: 0x06000052 RID: 82 RVA: 0x0000358C File Offset: 0x0000178C
        public override void Initialize(Dictionary <string, Dictionary <string, GameObject> > preloadedObjects)
        {
            Uuwuu.Instance = this;
            Uuwuu.PreloadedGameObjects.Add("saw", preloadedObjects["White_Palace_07"]["wp_saw (30)"]);
            this.Unload();
            this.SetupSettings();
            ModHooks.Instance.BeforeSavegameSaveHook += Instance_BeforeSavegameSaveHook;
            ModHooks.Instance.AfterSavegameLoadHook  += this.SaveGame;
            ModHooks.Instance.NewGameHook            += AddComponent;
            ModHooks.Instance.LanguageGetHook        += this.OnLangGet;
            UnityEngine.SceneManagement.SceneManager.activeSceneChanged += this.SceneChanged;
            ModHooks.Instance.GetPlayerVariableHook += this.GetVariableHook;
            ModHooks.Instance.GetPlayerBoolHook     += this.OnGetPlayerBoolHook;
            ModHooks.Instance.SetPlayerBoolHook     += this.OnSetPlayerBoolHook;
            ModHooks.Instance.GetPlayerIntHook      += this.OnGetPlayerIntHook;
            Assembly asm = Assembly.GetExecutingAssembly();

            Sprites = new Dictionary <string, Sprite>();
            foreach (string res in asm.GetManifestResourceNames())
            {
                if (!res.EndsWith(".png"))
                {
                    continue;
                }

                if (res.Contains("Uuwuu.png"))
                {
                    using (Stream s = asm.GetManifestResourceStream(res))
                    {
                        if (s == null)
                        {
                            continue;
                        }
                        byte[] buffer = new byte[s.Length];
                        s.Read(buffer, 0, buffer.Length);
                        s.Dispose();

                        //Create texture from bytes
                        Texture2D tex = new Texture2D(1, 1);
                        tex.LoadImage(buffer);

                        //Create sprite from texture
                        Sprites.Add("Charm", Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)));
                        Log("Created sprite from embedded image: " + res);
                    }
                }
                if (res.Contains("Uumuu_picture.png"))
                {
                    using (Stream s = asm.GetManifestResourceStream(res))
                    {
                        if (s == null)
                        {
                            continue;
                        }
                        byte[] buffer = new byte[s.Length];
                        s.Read(buffer, 0, buffer.Length);
                        s.Dispose();

                        //Create texture from bytes
                        Texture2D tex = new Texture2D(1, 1);
                        tex.LoadImage(buffer);

                        //Create sprite from texture
                        Sprites.Add("Picture", Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)));
                        Log("Created sprite from embedded image: " + res);
                    }
                }
                if (res.Contains("Uumuu_portrait.png"))
                {
                    using (Stream s = asm.GetManifestResourceStream(res))
                    {
                        if (s == null)
                        {
                            continue;
                        }
                        byte[] buffer = new byte[s.Length];
                        s.Read(buffer, 0, buffer.Length);
                        s.Dispose();

                        //Create texture from bytes
                        Texture2D tex = new Texture2D(1, 1);
                        tex.LoadImage(buffer);

                        //Create sprite from texture
                        Sprites.Add("Portrait", Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)));
                        Log("Created sprite from embedded image: " + res);
                    }
                }
                if (res.Contains("divider.png"))
                {
                    using (Stream s = asm.GetManifestResourceStream(res))
                    {
                        if (s == null)
                        {
                            continue;
                        }
                        byte[] buffer = new byte[s.Length];
                        s.Read(buffer, 0, buffer.Length);
                        s.Dispose();

                        //Create texture from bytes
                        Texture2D tex = new Texture2D(1, 1);
                        tex.LoadImage(buffer);

                        //Create sprite from texture
                        Sprites.Add("Divider", Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)));
                        Log("Created sprite from embedded image: " + res);
                    }
                }
            }
            this.ChHelper             = new CharmHelper();
            ChHelper.customCharms     = 1;
            ChHelper.customSprites[0] = Uuwuu.Instance.Sprites["Charm"];
            jh = JournalHelper.AddJournalEntry(Sprites["Portrait"], Sprites["Picture"], new JournalHelper.JournalPlayerData()
            {
                haskilled = false, Hidden = true, killsremaining = 3, newentry = true
            }, new JournalHelper.JournalNameStrings()
            {
                name = "Uuwuu", desc = "Hidden master of the Fog Canyon", note = "I'm gonna kill you uwu - Uuwuu", shortname = "Uuwuu"
            }, JournalHelper.EntryType.Custom, Sprites["Divider"]);
        }