public override void NoHarmonyLoad() { AddBehavior <InitServerBehaviour>(); AddBehavior <GameLoadedBehaviour>(); Harmony harmony = new Harmony("com.TaleWorlds.MountAndBlade.Bannerlord"); IEnumerable <Type> patches = from t in Assembly.GetExecutingAssembly().GetTypes() where t.IsDefined(typeof(PatchAttribute)) select t; foreach (Type patch in patches) { FieldWatcher.ApplyFieldWatcherPatches(harmony, patch); } harmony.PatchAll(); }
private void InitMaidStatus() { maidStatusWatcher = FieldWatcher.CreateWatcher <Status>(); maidStatusWatcher.OnValueChanged = OnStatusUpdate; bonusStatusField = typeof(Status).GetField("bonusStatus", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); bonusStatusFields = typeof(BonusStatus).GetFields(BindingFlags.Instance | BindingFlags.Public); maidSetters = new Dictionary <string, MethodInfo>(); maidGetters = new Dictionary <string, MethodInfo>(); maidFields = new Dictionary <string, FieldInfo>(); var props = typeof(Status).GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo propertyInfo in props) { MethodInfo get = propertyInfo.GetGetMethod(); MethodInfo set = propertyInfo.GetSetMethod(); if (get != null && (get.ReturnType.IsPrimitive || get.ReturnType == typeof(string) || get.ReturnType.IsEnum)) { maidGetters.Add(propertyInfo.Name, get); } if (set != null) { maidSetters.Add(propertyInfo.Name, set); } } var fields = typeof(Status).GetFields(BindingFlags.Instance | BindingFlags.Public).Where(f => f.FieldType.IsValueType || f.FieldType.IsEnum || f.FieldType == typeof(string)); foreach (var field in fields) { maidFields[field.Name] = field; } MaidStatusHooks.PropertyChanged += OnPropertyChange; MaidStatusHooks.WorkDataChanged += OnMaidStatusHooksOnWorkDataChanged; MaidStatusHooks.PropFeatureChanged += OnPropFeatureChanged; MaidStatusHooks.OldMaidDeserialized += OnOldMaidDeserialized; MaidStatusHooks.ProprtyShouldChange += CheckPropertyShouldChange; YotogiSkillHooks.SkillInfoChanged += OnYotogiSkillHooksOnSkillInfoChanged; MaidStatusHooks.ThumbnailChanged += (sender, args) => { if (IsDeserializing) { return; } Emit("maid_thumbnail_changed", new Dict { ["guid"] = args.Maid.status.guid, ["thumb"] = args.Maid.GetThumIcon().EncodeToPNG() }); }; }
public Field(Gameplay game) { CriticalLeft = GameObject.FindGameObjectWithTag("CriticalFrontLeft"); CriticalVanguard = GameObject.FindGameObjectWithTag("CriticalVanguard"); CriticalRight = GameObject.FindGameObjectWithTag("CriticalFrontRight"); returnList = new List<Card>(); CallEffect = GameObject.FindGameObjectWithTag("CallEffect"); fieldInfo = new FieldInformation(); Soul = new List<Card>(); Vanguard = null; Left_Rear = null; Left_Front = null; Center_Rear = null; Right_Rear = null; Left_Rear = null; delta = new Vector3(0.0f, 0.06f, 0.0f); VanguardPower = (TextMesh)GameObject.FindGameObjectWithTag("VanguardPowerText").GetComponent("TextMesh"); FrontRightPower = (TextMesh)GameObject.FindGameObjectWithTag("FrontRightPowerText").GetComponent("TextMesh"); FrontLeftPower = (TextMesh)GameObject.FindGameObjectWithTag("FrontLeftPowerText").GetComponent("TextMesh"); RearRightPower = (TextMesh)GameObject.FindGameObjectWithTag("RearRightPowerText").GetComponent("TextMesh"); RearLeftPower = (TextMesh)GameObject.FindGameObjectWithTag("RearLeftPowerText").GetComponent("TextMesh"); RearCenterPower = (TextMesh)GameObject.FindGameObjectWithTag("RearCenterPowerText").GetComponent("TextMesh"); VC = (TextMesh)GameObject.FindGameObjectWithTag("VC").GetComponent("TextMesh"); FRC = (TextMesh)GameObject.FindGameObjectWithTag("FRC").GetComponent("TextMesh"); FLC = (TextMesh)GameObject.FindGameObjectWithTag("FLC").GetComponent("TextMesh"); RRC = (TextMesh)GameObject.FindGameObjectWithTag("RRC").GetComponent("TextMesh"); RLC = (TextMesh)GameObject.FindGameObjectWithTag("RLC").GetComponent("TextMesh"); RCC = (TextMesh)GameObject.FindGameObjectWithTag("RCC").GetComponent("TextMesh"); VC.text = ""; FRC.text = ""; FLC.text = ""; RRC.text = ""; RLC.text = ""; RCC.text = ""; VanguardPower.text = ""; FrontRightPower.text = ""; FrontLeftPower.text = ""; RearRightPower.text = ""; RearLeftPower.text = ""; RearCenterPower.text = ""; DamageZone = new List<Card>(); DropZone = new List<Card>(); BindZone = new List<Card>(); VanguardPower.renderer.material.color = Color.yellow; FrontRightPower.renderer.material.color = Color.yellow; FrontLeftPower.renderer.material.color = Color.yellow; RearRightPower.renderer.material.color = Color.yellow; RearLeftPower.renderer.material.color = Color.yellow; RearCenterPower.renderer.material.color = Color.yellow; ViewBackground = Resources.Load ("ViewCardBackground") as Texture2D; CardsWatching = new List<Game2DCard>(); TotalCards = new List<Game2DCard>(); _Game = game; CardSelectedVector = new List<CardIdentifier>(); fieldWatcher = new FieldWatcher(game); HelpZone = new List<Card>(); exitBtnStyle.normal.background = Resources.Load("GUI/exit") as Texture2D; exitBtnStyle.hover.background = Resources.Load("GUI/exit_hover") as Texture2D; leftArrowBtnStyle.normal.background = Resources.Load("GUI/left_arrow") as Texture2D; leftArrowBtnStyle.hover.background = Resources.Load("GUI/left_arrow_hover") as Texture2D; rightArrowBtnStyle.normal.background = Resources.Load("GUI/right_arrow") as Texture2D; rightArrowBtnStyle.hover.background = Resources.Load("GUI/right_arrow_hover") as Texture2D; }