Example #1
0
    public void ctor(HUD.HUD hud, FContainer fContainer)
    {
        Type[] constructorSignature = new Type[1];
        constructorSignature[0] = typeof(HUD.HUD);
        RuntimeMethodHandle handle = typeof(HudPart).GetConstructor(constructorSignature).MethodHandle;

        RuntimeHelpers.PrepareMethod(handle);
        IntPtr           ptr   = handle.GetFunctionPointer();
        Action <HUD.HUD> funct = (Action <HUD.HUD>)Activator.CreateInstance(typeof(Action <HUD.HUD>), this, ptr);

        funct(hud);//HudPart Constructor
        this.lastPos = this.pos;

        if (hud.owner != null & hud.owner is Player)
        {
            this.circles = new HUDCircle[(hud.owner as Player).room.world.rainCycle.cycleLength / 1200];
        }
        else if (hud.owner != null & (hud.owner is patch_SleepAndDeathScreen))
        {
            this.circles = new HUDCircle[(hud.owner as patch_SleepAndDeathScreen).nextcycleLength / 1200];
        }
        for (int i = 0; i < this.circles.Length; i++)
        {
            this.circles[i] = new HUDCircle(hud, HUDCircle.SnapToGraphic.smallEmptyCircle, fContainer, 0);
        }
        if (hud.owner != null & hud.owner is Player)
        {
            if (((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(0) < this.circles.Length)
            {
                (this.circles[((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(0)] as patch_HUDCircle).danger = true;
            }
            if (((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(1) < this.circles.Length)
            {
                (this.circles[((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(1)] as patch_HUDCircle).danger = true;
            }
            if (((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(2) < this.circles.Length)
            {
                (this.circles[((hud.owner as Player).room.world.rainCycle as patch_RainCycle).getBurstIndex(2)] as patch_HUDCircle).danger = true;
            }
        }
        else if (hud.owner != null & !(hud.owner is Player) & (hud.owner is patch_SleepAndDeathScreen))
        {
            if ((hud.owner as patch_SleepAndDeathScreen).getBurst(0) < this.circles.Length)
            {
                (this.circles[(hud.owner as patch_SleepAndDeathScreen).getBurst(0)] as patch_HUDCircle).danger = true;
            }
            if ((hud.owner as patch_SleepAndDeathScreen).getBurst(1) < this.circles.Length)
            {
                (this.circles[(hud.owner as patch_SleepAndDeathScreen).getBurst(1)] as patch_HUDCircle).danger = true;
            }
            if ((hud.owner as patch_SleepAndDeathScreen).getBurst(2) < this.circles.Length)
            {
                (this.circles[(hud.owner as patch_SleepAndDeathScreen).getBurst(2)] as patch_HUDCircle).danger = true;
            }
            (hud.owner as patch_SleepAndDeathScreen).nextcycleLength  = (hud.owner as patch_SleepAndDeathScreen).nextcycleLength2;
            (hud.owner as patch_SleepAndDeathScreen).nextcycleLength2 = (hud.owner as patch_SleepAndDeathScreen).nextcycleLength3;
            (hud.owner as patch_SleepAndDeathScreen).burstNum         = (hud.owner as patch_SleepAndDeathScreen).burstNum2;
            (hud.owner as patch_SleepAndDeathScreen).burstNum2        = (hud.owner as patch_SleepAndDeathScreen).burstNum3;
        }
    }
Example #2
0
        public void ctor(HUD.HUD hud, FContainer fContainer)
        {
            Type[] constructorSignature = new Type[1];
            constructorSignature[0] = typeof(HUD.HUD);
            RuntimeMethodHandle handle = typeof(HudPart).GetConstructor(constructorSignature).MethodHandle;

            RuntimeHelpers.PrepareMethod(handle);
            IntPtr           ptr   = handle.GetFunctionPointer();
            Action <HUD.HUD> funct = (Action <HUD.HUD>)Activator.CreateInstance(typeof(Action <HUD.HUD>), this, ptr);

            funct(hud);//HudPart Constructor
            this.lastPos = this.pos;

            if (hud.owner != null & hud.owner is Player)
            {
                if (MonklandSteamManager.isInGame)
                {
                    this.circles = new HUDCircle[MonklandSteamManager.WorldManager.cycleLength / 1200];
                }
                else
                {
                    this.circles = new HUDCircle[(hud.owner as Player).room.world.rainCycle.cycleLength / 1200];
                }
            }
            else if (hud.owner != null & (hud.owner is MultiplayerSleepAndDeathScreen) && MonklandSteamManager.isInGame && MonklandSteamManager.WorldManager != null)
            {
                this.circles = new HUDCircle[MonklandSteamManager.WorldManager.cycleLength / 1200];
            }
            for (int i = 0; i < this.circles.Length; i++)
            {
                this.circles[i] = new HUDCircle(hud, HUDCircle.SnapToGraphic.smallEmptyCircle, fContainer, 0);
            }
        }
Example #3
0
        // public int halfTimeBlink;
        // public bool halfTimeShown;

        public RainMeterMultiplayer(HUD.HUD hud, FContainer fContainer) : base(hud)
        {
            this.lastPos = this.pos;
            if (MonklandSteamManager.isInGame && MonklandSteamManager.WorldManager != null)
            {
                this.circles = new HUDCircle[MonklandSteamManager.WorldManager.cycleLength / 1200];
            }
            for (int i = 0; i < this.circles.Length; i++)
            {
                this.circles[i] = new HUDCircle(hud, HUDCircle.SnapToGraphic.smallEmptyCircle, fContainer, 0);
            }
        }
Example #4
0
        private static void CtorHK(On.HUD.RainMeter.orig_ctor orig, RainMeter self, HUD.HUD hud, FContainer fContainer)
        {
            bool isMulti = true;

            if (!MonklandSteamManager.isInGame || MonklandSteamManager.WorldManager == null)
            {
                isMulti = false;
                if (hud.owner != null && hud.owner is Player p && p.room != null)
                {
                    orig(self, hud, fContainer);
                }
                else
                {
                    noOrigCtor(self, isMulti, hud, fContainer);
                }
            }
Example #5
0
        public MultiplayerHUD(HUD.HUD hud) : base(hud)
        {
            try
            {
                this.screenSize = hud.rainWorld.options.ScreenSize;
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
                this.screenSize = new Vector2(1280f, 768f);
            }
            this.screenPos = this.screenSize - new Vector2(1366f, 768f); // This needs to be adjusted
            //Futile.stage.AddChild(this.inFrontContainer);
            this.hud = hud;
            Debug.Log("Added MultiHUD");
            playerLabels        = new Dictionary <ulong, MUIPlayerTag>();
            elementsToBeRemoved = new List <ulong>();
            overLayActive       = false;
            exitting            = false;
            frontContainer      = new FContainer();

            this.backgroundBlack       = new FSprite("Futile_White", true);
            this.backgroundBlack.color = new Color(0f, 0f, 0f);
            this.container.AddChild(this.backgroundBlack);
            this.backgroundBlack.scaleX    = this.hud.rainWorld.options.ScreenSize.x / 16f;
            this.backgroundBlack.scaleY    = 48f;
            this.backgroundBlack.anchorX   = 0f;
            this.backgroundBlack.anchorY   = 0f;
            this.backgroundBlack.x         = 0f;
            this.backgroundBlack.y         = 0f;
            this.backgroundBlack.alpha     = 0.3f;
            this.backgroundBlack.isVisible = false;
            muiElements = new List <MUIHUD>();

            exitButton = false;

            muiElements.Add(new MUIButton(this, new Vector2(this.ContinueAndExitButtonsXPos - 320f, 20f), "SHUTDOWN"));
            muiElements.Add(new MUIPlayerList(this, new Vector2(this.hud.rainWorld.options.ScreenSize.x / 2f, this.hud.rainWorld.options.ScreenSize.y / 2f)));
            Futile.stage.AddChild(frontContainer);
        }
Example #6
0
        private static void InitSleepHudHK(On.HUD.HUD.orig_InitSleepHud orig, HUD.HUD self, SleepAndDeathScreen sleepAndDeathScreen, Map.MapData mapData, SlugcatStats charStats)
        {
            if (!(sleepAndDeathScreen is MultiplayerSleepAndDeathScreen))
            {
                Debug.Log("Calling orig ctor Sleeping Screen");
                orig(self, sleepAndDeathScreen, mapData, charStats);
                return;
            }

            self.AddPart(new FoodMeter(self, charStats.maxFood, charStats.foodToHibernate));
            //if (mapData != null)
            //{
            //this.AddPart(new Map(this, mapData));
            //}
            self.foodMeter.pos     = new Vector2(sleepAndDeathScreen.FoodMeterXPos((sleepAndDeathScreen.ID != ProcessManager.ProcessID.SleepScreen) ? 1f : 0f), 0f);
            self.foodMeter.lastPos = self.foodMeter.pos;

            RainMeterMultiplayer rainMeter = new RainMeterMultiplayer(self, self.fContainers[1]);

            rainMeter.pos = new Vector2(self.rainWorld.options.ScreenSize.x - 335f, self.rainWorld.options.ScreenSize.y - 70f);
            self.AddPart(rainMeter);
        }
Example #7
0
 public extern void orig_ctor(HUD.HUD hud, FContainer fContainer);
Example #8
0
 public patch_RainMeter(HUD.HUD hud, FContainer fContainer) : base(hud, fContainer)
 {
 }
Example #9
0
 public patch_FoodMeter(HUD.HUD hud, int maxFood, int survivalLimit) : base(hud, maxFood, survivalLimit)
 {
 }
 public patch_HUDCircle(HUD.HUD hud, SnapToGraphic snapGraphic, FContainer container, int color) : base(hud, snapGraphic, container, color)
 {
 }
Example #11
0
        public void ctor(Menu.Menu menu, MenuObject owner, int pageIndex, int slugcatNumber)
        {
            orig_ctor(menu, owner, pageIndex, slugcatNumber);
            hud.ClearAllSprites();
            hudContainers = new FContainer[2];
            for (int i = 0; i < hudContainers.Length; i++)
            {
                hudContainers[i] = new FContainer();
                Container.AddChild(hudContainers[i]);
            }
            hud = new HUD.HUD(hudContainers, menu.manager.rainWorld, this);
            saveGameData.karma = Custom.IntClamp(saveGameData.karma, 0, saveGameData.karmaCap);
            saveGameData.food  = Custom.IntClamp(saveGameData.food, 0, SlugcatStats.SlugcatFoodMeter(slugcatNumber).y);
            hud.AddPart(new KarmaMeter(hud, hudContainers[1], new IntVector2(saveGameData.karma, saveGameData.karmaCap), saveGameData.karmaReinforced));
            hud.AddPart(new FoodMeter(hud, SlugcatStats.SlugcatFoodMeter(slugcatNumber).x, SlugcatStats.SlugcatFoodMeter(slugcatNumber).y));
            string text = String.Empty;

            if (saveGameData.shelterName != null && saveGameData.shelterName.Length > 2)
            {
                string text2 = saveGameData.shelterName.Substring(0, 2);
                switch (text2)
                {
                case "CC":
                    text = "Chimney Canopy";
                    break;

                case "DS":
                    text = "Drainage System";
                    break;

                case "HI":
                    text = "Industrial Complex";
                    break;

                case "GW":
                    text = "Garbage Wastes";
                    break;

                case "SI":
                    text = "Sky Islands";
                    break;

                case "SU":
                    text = "Outskirts";
                    break;

                case "SH":
                    text = "Shaded Citadel";
                    break;

                case "IS":
                    text = "Intake System";
                    break;

                case "SL":
                    text = "Shoreline";
                    break;

                case "LF":
                    text = "Farm Arrays";
                    break;

                case "UW":
                    text = "The Exterior";
                    break;

                case "SB":
                    text = "Subterranean";
                    break;

                case "SS":
                    text = "Five Pebbles";
                    break;

                case "LM":
                    text = "Looks To the Moon";
                    break;

                case "MW":
                    text = "The Fragmented Exterior";
                    break;

                case "FS":
                    text = "Forest Sanctuary";
                    break;
                }
                if (text.Length > 0)
                {
                    text2 = text;
                    text  = string.Concat(new object[]
                    {
                        text2,
                        " - ",
                        menu.Translate("Cycle"),
                        " ",
                        (slugcatNumber != 2) ? saveGameData.cycle : (RedsIllness.RedsCycles(saveGameData.redsExtraCycles) - saveGameData.cycle)
                    });
                }
            }
            regionLabel = new MenuLabel(menu, this, text, new Vector2(-1000f, imagePos.y - 249f), new Vector2(200f, 30f), true);
            regionLabel.label.alignment = FLabelAlignment.Center;
            subObjects.Add(regionLabel);
        }
Example #12
0
 private static void HUD_InitSinglePlayerHud(On.HUD.HUD.orig_InitSinglePlayerHud orig, HUD.HUD self, RoomCamera cam)
 {
     orig(self, cam);
     self.AddPart(new MultiplayerHUD(self));
 }
 public extern void orig_ctor(HUD.HUD hud, int maxFood, int survivalLimit);
 public patch_KarmaMeter(HUD.HUD hud, FContainer fContainer, IntVector2 displayKarma, bool showAsReinforced) : base(hud, fContainer, displayKarma, showAsReinforced)
 {
 }
Example #15
0
        private static void RainMeter_ctor(On.HUD.RainMeter.orig_ctor orig, RainMeter self, HUD.HUD hud, FContainer fContainer)
        {
            try
            {
                orig(self, hud, fContainer);
            }
            catch (Exception e)
            {
                Debug.Log("Error in Rainmeter ctor " + e.Message);
            }

            if (hud.owner != null & hud.owner is Player)
            {
                if (MonklandSteamManager.isInGame)
                {
                    self.circles = new HUDCircle[MonklandSteamManager.WorldManager.cycleLength / 1200];
                }
                else
                {
                    //self.circles = new HUDCircle[(hud.owner as Player).room.world.rainCycle.cycleLength / 1200];
                }
            }
            else if (hud.owner != null & (hud.owner is MultiplayerSleepAndDeathScreen) && MonklandSteamManager.isInGame && MonklandSteamManager.WorldManager != null)
            {
                self.circles = new HUDCircle[MonklandSteamManager.WorldManager.cycleLength / 1200];
            }

            for (int i = 0; i < self.circles.Length; i++)
            {
                self.circles[i] = new HUDCircle(hud, HUDCircle.SnapToGraphic.smallEmptyCircle, fContainer, 0);
            }
        }
 //APPETITE
 private static void FoodMeter_ctor(On.HUD.FoodMeter.orig_ctor orig, HUD.FoodMeter self, HUD.HUD hud, int maxFood, int survivalLimit)
 {
     if (hud.owner is SlugcatSelectMenu.SlugcatPageContinue)
     {
         maxFood       = KarmaAppetite.GetFoodFromKarma(((SlugcatSelectMenu.SlugcatPageContinue)hud.owner).saveGameData.karma).x;
         survivalLimit = KarmaAppetite.GetFoodFromKarma(((SlugcatSelectMenu.SlugcatPageContinue)hud.owner).saveGameData.karma).y;
     }
     orig.Invoke(self, hud, maxFood, survivalLimit);
     if (hud.owner is Player && (hud.owner as Player).slugcatStats.name != SlugcatStats.Name.Red)
     {
         self.quarterPipShower = new FoodMeter.QuarterPipShower(self);
     }
 }
 public void ctor(HUD.HUD hud, int maxFood, int survivalLimit)
 {
     orig_ctor(hud, maxFood, survivalLimit);
     hibernation1 = false;
     hibernation2 = false;
 }