// Constructor public LobbyPlayer(Account nAccount) { account = nAccount; peer = AccountManager.Master.GetLoggedInPeer(account); statusObservers = new HashSet <LobbyPlayer>(); statusObservers.Add(this); stats = null; ffaStats = null; custom = null; friends = null; _location = null; _followers = null; _party = new LobbyParty(); _gameInstance = null; artifactsEditingFlag = false; channels = new List <LobbyChatChannel>(); chatMember = new ChatMember(account.id.value); accountsWhereInfoIsRequired = new HashSet <string>(); LobbyPlayer.list.Add(this); LobbyPlayer.accountIdToLobbyPlayer[account.id.value] = this; LobbyPlayer.peerToLobbyPlayer[peer] = this; }
private static void CharacterCustomization_setUpPositions_Postfix(CharacterCustomization __instance) { if (!Config.EnableMod || __instance.source != CharacterCustomization.Source.NewGame) { return; } int x = __instance.xPositionOnScreen + __instance.width + 4 + 8 + 88 + 4 + 8; int y = __instance.yPositionOnScreen; for (int i = 0; i < skillNames.Length; i++) { string name = skillNames[i]; __instance.leftSelectionButtons.Add(new ClickableTextureComponent("SDRPG_" + name, new Rectangle(new Point(x + statsX + 60, y + ccStatsY + i * ccStatY + 17), new Point(64, 64)), null, "", Game1.mouseCursors, OptionsPlusMinus.minusButtonSource, 4f, false) { myID = 106 - i, upNeighborID = -99998, leftNeighborID = -99998, rightNeighborID = -99998, downNeighborID = -99998 }); __instance.rightSelectionButtons.Add(new ClickableTextureComponent("SDRPG_" + name, new Rectangle(new Point(x + statsX + 134, y + ccStatsY + i * ccStatY + 17), new Point(64, 64)), null, "", Game1.mouseCursors, OptionsPlusMinus.plusButtonSource, 4f, false) { myID = 106 - i, upNeighborID = -99998, leftNeighborID = -99998, rightNeighborID = -99998, downNeighborID = -99998 }); } }
public void RenderingActiveMenu_CharacterCustomization(object sender, RenderingActiveMenuEventArgs e) { Type type = typeof(CharacterCustomization); CharacterCustomization activeMenu = Game1.activeClickableMenu as CharacterCustomization; TextBox nameBox = LazyHelper.GetInstanceField(type, activeMenu, "nameBox") as TextBox; TextBox farmNameBox = LazyHelper.GetInstanceField(type, activeMenu, "farmnameBox") as TextBox; TextBox favThingBox = LazyHelper.GetInstanceField(type, activeMenu, "favThingBox") as TextBox; if (!nameBox.Selected && String.IsNullOrWhiteSpace(nameBox.Text)) { nameBox.Text = "Player"; } Game1.player.Name = nameBox.Text; if (!farmNameBox.Selected && String.IsNullOrWhiteSpace(farmNameBox.Text)) { farmNameBox.Text = "Farm"; } if (!favThingBox.Selected && String.IsNullOrWhiteSpace(favThingBox.Text)) { favThingBox.Text = "Bananas"; } }
private void changeNameBoxOnCharacterCustomizer() { object l = new CharacterCustomization(null, null, null, false); object nameBox = new StardewValley.Menus.TextBox(null, null, Game1.smoothFont, Color.White); object text = new string(new char[5] { 'a', 'b', 'c', 'd', 'e' }); l = (StardewValley.Menus.CharacterCustomization)Game1.activeClickableMenu.GetType().GetField("subMenu", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Game1.activeClickableMenu); Log.AsyncM(l); if (l == null) { Log.AsyncC("cry"); } nameBox = (TextBox)l.GetType().GetField("nameBox", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(l); if (nameBox == null) { Log.AsyncM("BLARG"); } Log.AsyncG(nameBox); text = (string)nameBox.GetType().GetField("_text", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(nameBox); if ((text as string) == "") { Log.AsyncM("WTF"); } nameBox.GetType().GetField("_text", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(nameBox, "f**k"); }
private static void SelectionClickPostfix(CharacterCustomization __instance, string name, int change, List <ClickableComponent> ___leftSelectionButtons) { if (__instance.source != Source.NewGame) { return; } switch (name) { case "start_with_hand_mirror": { var button = ___leftSelectionButtons.First(c => c.name == "start_with_hand_mirror") as ClickableTextureComponent; Game1.playSound("drumkit6"); button.sourceRect.X = ((button.sourceRect.X == 227) ? 236 : 227); if (!Game1.player.modData.ContainsKey(ModDataKeys.STARTS_WITH_HAND_MIRROR) || !bool.Parse(Game1.player.modData[ModDataKeys.STARTS_WITH_HAND_MIRROR])) { Game1.player.modData[ModDataKeys.STARTS_WITH_HAND_MIRROR] = true.ToString(); } else { Game1.player.modData[ModDataKeys.STARTS_WITH_HAND_MIRROR] = false.ToString(); } break; } } }
public void editCharacter() { List <int> shirtOptions = new List <int>(); shirtOptions.Add(0); shirtOptions.Add(1); shirtOptions.Add(2); shirtOptions.Add(3); shirtOptions.Add(4); shirtOptions.Add(5); List <int> hairStyleOptions = new List <int>(); hairStyleOptions.Add(0); hairStyleOptions.Add(1); hairStyleOptions.Add(2); hairStyleOptions.Add(3); hairStyleOptions.Add(4); hairStyleOptions.Add(5); List <int> accessoryOptions = new List <int>(); accessoryOptions.Add(0); accessoryOptions.Add(1); accessoryOptions.Add(2); accessoryOptions.Add(3); accessoryOptions.Add(4); accessoryOptions.Add(5); this.characterCustomization = new CharacterCustomization(shirtOptions, hairStyleOptions, accessoryOptions, true); this.characterCustomization.randomButton.visible = false; Game1.activeClickableMenu = (IClickableMenu)characterCustomization; }
public BodyPart ParentBodyPart; //can be null with root public override void SetUp(CharacterCustomization incharacterCustomization, BodyPart Body_Part, string path) { base.SetUp(incharacterCustomization, Body_Part, path); RelatedBodyPart = Body_Part; List <string> itemOptions = null; // Make a list of all available options which can then be passed to the dropdown box foreach (var Keyv in incharacterCustomization.ParentDictionary) { if (Keyv.Value.Contains(Body_Part)) { ParentBodyPart = Keyv.Key; } } CurrentBodyPart = Body_Part; ToChooseFromBodyParts = Body_Part.OptionalReplacementOrgan; itemOptions = Body_Part.OptionalReplacementOrgan.Select(gameObject => gameObject.name).ToList(); itemOptions.Sort(); // Ensure "None" is at the top of the option lists itemOptions.Insert(0, Body_Part.name); Dropdown.AddOptions(itemOptions); Dropdown.onValueChanged.AddListener(ItemChange); }
public static void Prefix(CharacterCustomization __instance, SpriteBatch b) { if (__instance.source != CharacterCustomization.Source.NewGame && __instance.source != CharacterCustomization.Source.HostNewFarm) { return; } Mod.instance.plusButton.draw(b); }
void OnEnable() { cc = (CharacterCustomization)target; valid = cc.gameObject.scene.IsValid() && (cc.gameObject.scene.name != cc.gameObject.name) && cc.gameObject.scene.name != string.Empty; void UpdateCallback() { if (cc.currentEmotion != null) { cc.EmotionTick(); } } EditorApplication.update = UpdateCallback; if (valid && !Application.isPlaying) { if (!bodyColors) { GetColors(cc); } cc.StartupSerializationApply(); selectedHair = cc.hairActiveIndex + 1; selectedBeard = cc.beardActiveIndex + 1; selectedShirt = cc.clothesActiveIndexes[ClothesPartType.Shirt] + 1; selectedAccessory = cc.clothesActiveIndexes[ClothesPartType.Accessory] + 1; selectedPants = cc.clothesActiveIndexes[ClothesPartType.Pants] + 1; selectedShoes = cc.clothesActiveIndexes[ClothesPartType.Shoes] + 1; selectedHat = cc.clothesActiveIndexes[ClothesPartType.Hat] + 1; emotionsList.Clear(); foreach (var e in cc.emotionPresets) { emotionsList.Add(e.name); } minLod = cc.MinLODLevels; maxLod = cc.MaxLODLevels; minCombinedLod = cc.MinLODLevelsCombined; maxCombinedLod = cc.MaxLODLevelsCombined; combinedCharacter = cc.combinedCharacter; headSize = cc.headSizeValue; headOffset = cc.GetBodyShapeWeight("Head_Offset"); height = cc.heightValue; foreach (var bsw in bodyShapeWeight.Keys.ToArray()) { bodyShapeWeight[bsw] = cc.GetBodyShapeWeight(bsw.ToString()); } foreach (var fsw in faceShapeWeight.Keys.ToArray()) { faceShapeWeight[fsw] = cc.GetBodyShapeWeight(fsw.ToString()); } } }
// Set character customization public static void SetCharacterCustomization(string accountId, CharacterCustomization custom, GameDB.ActionOnResult<CharacterCustomization> func = null) { GameDB.instance.StartCoroutine(GameDB.Set<CharacterCustomization>( "AccountToCharacterCustomization", accountId, custom, func )); }
// Set character customization public static void SetCharacterCustomization(string accountId, CharacterCustomization custom, GameDB.ActionOnResult <CharacterCustomization> func = null) { GameDB.instance.StartCoroutine(GameDB.Set <CharacterCustomization>( "AccountToCharacterCustomization", accountId, custom, func )); }
public static void Postfix(CharacterCustomization __instance) { if (__instance.source != CharacterCustomization.Source.NewGame && __instance.source != CharacterCustomization.Source.HostNewFarm) { return; } Mod.instance.plusButton = new ClickableTextureComponent("NewGamePlus", new Rectangle(0, 0, 36, 36), null, null, Game1.mouseCursors, new Rectangle(227, 425, 9, 9), 4);; Mod.instance.plusButton.bounds = new Rectangle(__instance.xPositionOnScreen - 80 + 16, __instance.yPositionOnScreen + __instance.height - 80 - 16 - 45, 36, 36); }
private static void After_OptionButtonClick(CharacterCustomization __instance, string name) { if (name != $"ModFarm_{CharacterCustomizationPatcher.FarmTypeId}") { return; } // apply default options Game1.spawnMonstersAtNight = CharacterCustomizationPatcher.Config.DefaultSpawnMonstersAtNight; }
void ClientCharacterCustomization(CharacterCustomization newCustom, uLink.NetworkMessageInfo info) { if (info.sender != networkView.owner) { return; } this.networkView.RPC("ReceiveCharacterCustomization", uLink.RPCMode.OthersExceptOwner, newCustom); ReceiveCharacterCustomization(newCustom); }
private void GetColors(CharacterCustomization cc) { bodyColors = cc.GetBodyMaterialInstance(); if (bodyColors == null) { bodyColors = cc.bodyMaterial; } SkinColorNew = bodyColors.GetColor("_SkinColor"); HairColorNew = bodyColors.GetColor("_HairColor"); EyeColorNew = bodyColors.GetColor("_EyeColor"); UnderpantsColorNew = bodyColors.GetColor("_UnderpantsColor"); }
/// <summary> /// Called to switch out the canon CharacterCustomization Menu. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void newGameMenu(object sender, EventArgs e) { if (Game1.activeClickableMenu is TitleMenu) { if (TitleMenu.subMenu is CharacterCustomization) { CharacterCustomization oldMenu = (CharacterCustomization)TitleMenu.subMenu; CharacterCustomizationWithCustom menu = new CharacterCustomizationWithCustom(oldMenu.source); TitleMenu.subMenu = menu; } } }
public static void Postfix(CharacterCustomization __instance, int x, int y, ref string ___hoverText, ref string ___hoverTitle) { if (__instance.source != CharacterCustomization.Source.NewGame && __instance.source != CharacterCustomization.Source.HostNewFarm) { return; } if (Mod.instance.plusButton.bounds.Contains(x, y)) { ___hoverTitle = I18n.Create_Option_Name(); ___hoverText = I18n.Create_Option_Description(); } }
/// <summary> /// Used to replace the vanilla Character Customization Menu with MTN's version. This allows the user to /// be able to select custom farms and other options available. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewGameMenu(object sender, EventArgs e) { if (Game1.activeClickableMenu is TitleMenu) { if (TitleMenu.subMenu is CharacterCustomization) { CharacterCustomization oldMenu = (CharacterCustomization)TitleMenu.subMenu; CharacterCustomizationMTN menu = new CharacterCustomizationMTN(CustomManager, Monitor, oldMenu.source); TitleMenu.subMenu = menu; } } }
private void Start() { _player = gameObject; _body = _player.transform.Find("Body").gameObject; _playerBody = _body.GetComponent <CharacterCustomization>(); _playerHair = _player.GetComponent <HairCustomization>(); if (!_playerBody.IsCreatingCharacter && !_playerHair.IsCreatingCharacter) { LoadHairStyle(); LoadSkinValues(); } }
public override void SetUp(CharacterCustomization incharacterCustomization, BodyPart Body_Part, string path) { base.SetUp(incharacterCustomization, Body_Part, path); // Make a list of all available options which can then be passed to the dropdown box var itemOptions = OptionalSprites.Select(pcd => pcd.name).ToList(); itemOptions.Sort(); // Ensure "None" is at the top of the option lists itemOptions.Insert(0, "None"); Dropdown.AddOptions(itemOptions); Dropdown.onValueChanged.AddListener(ItemChange); }
private static void PerformHoverActionPostfix(CharacterCustomization __instance, List <ClickableComponent> ___leftSelectionButtons, ref string ___hoverText, int x, int y) { if (__instance.source != Source.NewGame) { return; } var button = ___leftSelectionButtons.FirstOrDefault(c => c.name == "start_with_hand_mirror") as ClickableTextureComponent; if (button is not null && button.containsPoint(x, y)) { ___hoverText = FashionSense.modHelper.Translation.Get("ui.fashion_sense.start_with_hand_mirror.description"); } }
// Awake protected override void Awake() { base.Awake(); baseMoveSpeed = Config.instance.playerMoveSpeed; // Parent myTransform.parent = Player.playerRoot; // Reset customization customization = null; // Full block duration playerVisibility = new Dictionary <Entity, bool>(); this.skillBuild = null; this.charStats = null; this.artifactTree = null; this.artifactReward = null; // Components motor = GetComponent <CharacterMotor>(); comboCounter = GetComponent <ComboCounter>(); voIP = GetComponent <VoIP>(); // Used for hovering / flying if (motor != null) { motorGravity = motor.movement.gravity; motorAirAcceleration = motor.movement.maxAirAcceleration; } charGraphicsModel = InstantiateChild(Config.instance.femalePrefab, charGraphics); // Destroy onDestroy += () => { // Remove from global lists Player.accountIdToPlayer.Remove(this.accountId); Player.allPlayers.Remove(this); Entity.idToEntity.Remove(this.id); // In case we stored some old pointers, react as if he is dead. // Particularly useful for the Enemy threat based target finding. health = 0; }; // Update player count Player.allPlayers.Add(this); }
private static void CharacterCustomization_selectionClick_Prefix(CharacterCustomization __instance, string name, int change) { if (!Config.EnableMod || __instance.source != CharacterCustomization.Source.NewGame || !name.StartsWith("SDRPG_") || (change == 1 && GetStatValue(Game1.player, "points") <= 0)) { return; } string stat = name.Substring("SDRPG_".Length); int oldStat = GetStatValue(Game1.player, stat); if ((change == 1 && oldStat >= Config.MaxStatValue) || (change == -1 && oldStat <= Config.MinStatValue)) { return; } SetModData(Game1.player, stat, oldStat + change); SetModData(Game1.player, "points", GetStatValue(Game1.player, "points") - change); }
private static void DrawPostfix(CharacterCustomization __instance, List <ClickableComponent> ___leftSelectionButtons, string ___hoverText, SpriteBatch b) { if (__instance.source != Source.NewGame) { return; } var button = ___leftSelectionButtons.First(c => c.name == "start_with_hand_mirror") as ClickableTextureComponent; Utility.drawTextWithShadow(b, button.hoverText, Game1.smallFont, new Vector2(button.bounds.X + button.bounds.Width + 8, button.bounds.Y + 8), Game1.textColor); if (___hoverText == FashionSense.modHelper.Translation.Get("ui.fashion_sense.start_with_hand_mirror.description")) { IClickableMenu.drawHoverText(b, Game1.parseText(___hoverText, Game1.smallFont, 256), Game1.smallFont, 0, 0, -1); } }
// BitStream Reader public static object ReadFromBitStream(uLink.BitStream stream, params object[] args) { var myObj = new CharacterCustomization(); myObj.height = stream.Read <float>(); myObj.voicePitch = stream.Read <float>(); myObj.skinColor = stream.Read <Color>(); myObj.hairColor = stream.Read <Color>(); myObj.eyeColor = stream.Read <Color>(); myObj.eyeBackgroundColor = stream.Read <Color>(); myObj.cloakColor = stream.Read <Color>(); myObj.topWearColor = stream.Read <Color>(); myObj.legWearColor = stream.Read <Color>(); myObj.bootsColor = stream.Read <Color>(); return(myObj); }
public override void SetUp(CharacterCustomization incharacterCustomization, BodyPart Body_Part, string path) { base.SetUp(incharacterCustomization, Body_Part, path); thisRelatedBodyPart = (IBodyPartDropDownOrgans)Body_Part; List <string> itemOptions = null; // Make a list of all available options which can then be passed to the dropdown box ToChooseFromBodyParts = RelatedBodyPart.OptionalOrgans; itemOptions = RelatedBodyPart.OptionalOrgans.Select(gameObject => gameObject.name).ToList(); itemOptions.Sort(); Dropdown.AddOptions(itemOptions); Dropdown.onValueChanged += ItemChange; }
void ClientCharacterCustomization(CharacterCustomization custom, LobbyMessageInfo info) { LobbyPlayer player = LobbyServer.GetLobbyPlayer(info); LogManager.General.Log(string.Format("Account '{0}' sent character customization!", player.account.name)); CharacterCustomizationDB.SetCharacterCustomization( player.accountId, custom, data => { if (data != null) { player.custom = data; Lobby.RPC("ReceiveCharacterCustomization", player.peer, player.accountId, player.custom); } } ); }
private static void CharacterCustomization_performHoverAction_Postfix(CharacterCustomization __instance, int x, int y, ref string ___hoverTitle, ref string ___hoverText) { if (!Config.EnableMod) { return; } coords = new Vector2(x, y); for (int i = 0; i < skillNames.Length; i++) { var rect = new Rectangle(Utility.Vector2ToPoint(new Vector2(__instance.xPositionOnScreen + __instance.width + 4 + 8 + 88 + 4 + 8 + statsX, __instance.yPositionOnScreen + ccStatsY + 17 + i * ccStatY)), Utility.Vector2ToPoint(Game1.smallFont.MeasureString(SHelper.Translation.Get(skillNames[i])))); if (rect.Contains(x, y)) { ___hoverTitle = SHelper.Translation.Get(skillNames[i] + "-full"); ___hoverText = SHelper.Translation.Get(skillNames[i] + "-desc"); break; } } }
void ReceiveCharacterCustomization(string accountId, CharacterCustomization custom) { LogManager.General.Log(string.Format("Lobby: Received character customization for account ID '{0}'!", accountId)); var acc = PlayerAccount.Get(accountId); acc.custom = custom; var accPage = (int)AccountSetupPage.CharacterCustomization; if (acc.isMine && accountSetupPageStatus[accPage] != RequestStatus.Exists) { characterCustomizationGUI.UpdateCustomization(); characterCustomizationGUI.EndCustomization(); accountSetupPageStatus[accPage] = RequestStatus.Exists; UpdateAccountInfo(); } }
public static void Postfix(CharacterCustomization __instance, int x, int y) { if (__instance.source != CharacterCustomization.Source.NewGame && __instance.source != CharacterCustomization.Source.HostNewFarm) { return; } if (Mod.instance.plusButton.bounds.Contains(x, y)) { Game1.playSound("drumkit6"); if (Mod.instance.plusButton.sourceRect.X == 227) { Mod.instance.plusButton.sourceRect.Offset(9, 0); } else { Mod.instance.plusButton.sourceRect.Offset(-9, 0); } } }
static void AssignPreset() { GameObject person = Selection.activeGameObject; CharacterCustomization appearance = person.GetComponent <CharacterCustomization> (); GameObject spawner = GameObject.Find("PeopleSpawner"); if (spawner == null) { EditorUtility.DisplayDialog("Spawner inactive", "Set PeopleSpawner active and try again", "OK"); return; } AppearancePreset preset = new AppearancePreset(appearance); PeopleSpawner script = spawner.GetComponent <PeopleSpawner> (); script.heroPreset = preset; DestroyImmediate(person); }