public MBVassalBannerEditorGauntletScreen(NewClanBannerEditorState bannerEditorState) { LoadingWindow.EnableGlobalLoadingWindow(); this._clan = bannerEditorState.GetClan(); this._bannerEditorLayer = new BannerEditorView(bannerEditorState.GetCharacter(), bannerEditorState.GetClan().Banner, new ControlCharacterCreationStage(this.OnDone), new TextObject("{=WiNRdfsm}Done", null), new ControlCharacterCreationStage(this.OnCancel), new TextObject("{=3CpNUnVl}Cancel", null), null, null, null, null, null); this._bannerEditorLayer.DataSource.SetClanRelatedRules(bannerEditorState.GetClan().Kingdom == null); }
public BannerEditorScreen(BannerEditorState bannerEditorState) { LoadingWindow.EnableGlobalLoadingWindow(); _bannerEditorLayer = new BannerEditorView(BannerEditorState.Character, BannerEditorState.Banner, OnDone, new TextObject("{=WiNRdfsm}Done"), OnCancel, new TextObject("{=3CpNUnVl}Cancel")); _bannerEditorLayer.DataSource.SetClanRelatedRules(true); }
static void Postfix(BannerEditorView __instance) { if (__instance.SceneLayer.Input.IsHotKeyPressed("Copy") || __instance.GauntletLayer.Input.IsHotKeyPressed("Copy")) { try { Input.SetClipboardText(__instance.DataSource.BannerVM.Banner.Serialize()); } catch (Exception ex) { Log.write("Error copying banner code"); InformationManager.DisplayMessage(new InformationMessage("Error copying banner code", new Color(1f, 0, 0))); Log.write(ex); } } else if (__instance.SceneLayer.Input.IsHotKeyPressed("Paste") || __instance.GauntletLayer.Input.IsHotKeyPressed("Paste")) { try { // test banner deserialization first var bannerCode = Input.GetClipboardText(); var banner = new Banner(bannerCode); // then try to draw it banner.ConvertToMultiMesh(); // hopefully we have thrown by now if we're gonna __instance.DataSource.BannerVM.BannerCode = bannerCode; Traverse.Create(__instance).Method("RefreshShieldAndCharacter").GetValue(); } catch (Exception ex) { Log.write("Error deserializing banner code"); InformationManager.DisplayMessage(new InformationMessage($"Error pasting banner code", new Color(1f, 0, 0))); Log.write(ex); } } }