public extern void OriginalConstructor(Menu.Menu menu, MenuObject owner, Vector2 pos, FContainer container, KarmaLadder ladder);
public void ctor_EndgameTokens(Menu.Menu menu, MenuObject owner, Vector2 pos, FContainer container, KarmaLadder ladder) { //Created Delegate to call Menu.PositionedMenuObject constructor Type[] constructorSignature = new Type[3]; constructorSignature[0] = typeof(Menu.Menu); constructorSignature[1] = typeof(Menu.MenuObject); constructorSignature[2] = typeof(Vector2); RuntimeMethodHandle handle = typeof(Menu.PositionedMenuObject).GetConstructor(constructorSignature).MethodHandle; RuntimeHelpers.PrepareMethod(handle); IntPtr ptr = handle.GetFunctionPointer(); Action <Menu.Menu, Menu.MenuObject, Vector2> funct = (Action <Menu.Menu, Menu.MenuObject, Vector2>)Activator.CreateInstance(typeof(Action <Menu.Menu, Menu.MenuObject, Vector2>), this, ptr); funct(menu, owner, pos);//Menu.PositionedMenuObject constructor //Original Code: this.tokens = new List <EndgameTokens.Token>(); bool flag = false; this.addPassageButtonWhenTokenBecomesVisible = false; int num = 0; for (int i = 0; i < ladder.endGameMeters.Count; i++) { if (ladder.endGameMeters[i].fullfilledNow) { this.addPassageButtonWhenTokenBecomesVisible = true; } if (ladder.endGameMeters[i].tracker.GoalFullfilled && !ladder.endGameMeters[i].tracker.consumed) { if (ladder.endGameMeters[i].tracker.GoalAlreadyFullfilled && !flag) { flag = true; } this.tokens.Add(new EndgameTokens.Token(menu, this, default(Vector2), ladder.endGameMeters[i], container, num)); this.subObjects.Add(this.tokens[this.tokens.Count - 1]); num++; } if (ladder.endGameMeters[i].fullfilledNow) { this.forceShowTokenAdd = true; } } // New Code: if (menu is SleepAndDeathScreen) //To avoid calling menu as SleepAndDeathScreen when menu is MultiplayerSleepAndDeathScreen { if ((menu as SleepAndDeathScreen).winState != null) { for (int j = 0; j < (menu as SleepAndDeathScreen).winState.endgameTrackers.Count; j++) { if (!(menu as SleepAndDeathScreen).winState.endgameTrackers[j].GoalAlreadyFullfilled && (menu as SleepAndDeathScreen).winState.endgameTrackers[j].GoalFullfilled) { this.pingAchivements = true; break; } } } if (flag) { (menu as SleepAndDeathScreen).AddPassageButton(false); this.addPassageButtonWhenTokenBecomesVisible = false; } } else { if ((menu as MultiplayerSleepAndDeathScreen).winState != null) { for (int j = 0; j < (menu as MultiplayerSleepAndDeathScreen).winState.endgameTrackers.Count; j++) { if (!(menu as MultiplayerSleepAndDeathScreen).winState.endgameTrackers[j].GoalAlreadyFullfilled && (menu as MultiplayerSleepAndDeathScreen).winState.endgameTrackers[j].GoalFullfilled) { this.pingAchivements = true; break; } } } } }
public patch_EndgameTokens(Menu.Menu menu, MenuObject owner, Vector2 pos, FContainer container, KarmaLadder ladder) : base(menu, owner, pos, container, ladder) { }