private void AddScoreButton(SandboxSettingsInterface.ScoreController button, ref IntVector2 ps) { if (button != null) { this.scoreControllers.Add(button); this.subObjects.Add(button); button.pos = new Vector2((float)ps.x * 88.666f + 0.01f, (float)ps.y * -30f); } ps.y++; if (ps.y > 8 && ps.x != 3) { ps.y = 0; ps.x++; } }
public void ctor(Menu.Menu menu, MenuObject owner) { //Delegate to call the base constructor Type[] constructorSignature = new Type[3]; constructorSignature[0] = typeof(Menu.Menu); constructorSignature[1] = typeof(MenuObject); constructorSignature[2] = typeof(Vector2); RuntimeMethodHandle handle = typeof(Menu.PositionedMenuObject).GetConstructor(constructorSignature).MethodHandle; RuntimeHelpers.PrepareMethod(handle); IntPtr ptr = handle.GetFunctionPointer(); Action <Menu.Menu, MenuObject, Vector2> funct = (Action <Menu.Menu, MenuObject, Vector2>)Activator.CreateInstance(typeof(Action <Menu.Menu, MenuObject, Vector2>), this, ptr); funct(menu, owner, new Vector2(440f, 385f));//RectangularMenuObject Constructor this.scoreControllers = new List <SandboxSettingsInterface.ScoreController>(); IntVector2 intVector = new IntVector2(0, 0); //Replaced Code foreach (patch_MultiplayerUnlocks.SandboxUnlockID creature in patch_MultiplayerUnlocks.CreatureUnlockList) { if (creature != patch_MultiplayerUnlocks.SandboxUnlockID.Fly && creature != patch_MultiplayerUnlocks.SandboxUnlockID.Leech && creature != patch_MultiplayerUnlocks.SandboxUnlockID.SeaLeech && creature != patch_MultiplayerUnlocks.SandboxUnlockID.SmallNeedleWorm && creature != patch_MultiplayerUnlocks.SandboxUnlockID.Spider && creature != patch_MultiplayerUnlocks.SandboxUnlockID.VultureGrub && creature != patch_MultiplayerUnlocks.SandboxUnlockID.BigEel && creature != patch_MultiplayerUnlocks.SandboxUnlockID.Deer && creature != patch_MultiplayerUnlocks.SandboxUnlockID.WalkerBeast && creature != patch_MultiplayerUnlocks.SandboxUnlockID.SmallCentipede && creature != patch_MultiplayerUnlocks.SandboxUnlockID.TubeWorm && creature != patch_MultiplayerUnlocks.SandboxUnlockID.Hazer) { this.AddScoreButton((MultiplayerUnlocks.SandboxUnlockID)creature, ref intVector); } } //-=-=-=-=-=-=-=-=-=-=- //for (int j = 0; j < 1; j++) //{ // this.AddScoreButton(null, ref intVector); //} this.AddScoreButton(new SandboxSettingsInterface.MiscScore(menu, this, menu.Translate("Food"), "FOODSCORE"), ref intVector); this.AddScoreButton(new SandboxSettingsInterface.MiscScore(menu, this, menu.Translate("Survive"), "SURVIVESCORE"), ref intVector); this.AddScoreButton(new SandboxSettingsInterface.MiscScore(menu, this, menu.Translate("Spear hit"), "SPEARHITSCORE"), ref intVector); if (menu.CurrLang != InGameTranslator.LanguageID.English) { for (int k = 1; k < 4; k++) { SandboxSettingsInterface.ScoreController scoreController = this.scoreControllers[this.scoreControllers.Count - k]; scoreController.pos.x = scoreController.pos.x + 24f; } } this.subObjects.Add(new SymbolButton(menu, this, "Menu_Symbol_Clear_All", "CLEARSCORES", new Vector2(0f, -280f))); for (int l = 0; l < this.subObjects.Count; l++) { if (this.subObjects[l] is SandboxSettingsInterface.ScoreController) { (this.subObjects[l] as SandboxSettingsInterface.ScoreController).scoreDragger.UpdateScoreText(); } } }