public SceneUserProfile(Game game) : base(game) { dim = GameInstance.ScreenInfo; root = GameInstance.UI.Root; cache = GameInstance.ResourceCache; font = cache.GetFont(GameInstance.defaultFont); ui = GameInstance.UI; JsonReaderCharacter.GetCharacterConfig(); counter = Plugin.Settings.CrossSettings.Current.GetValueOrDefault("img_character_id", 0); CreateUI(); }
public SceneProfileImage(Game game, bool IsUserProfile = false) : base(game) { dim = GameInstance.ScreenInfo; root = GameInstance.UI.Root; cache = GameInstance.ResourceCache; font = cache.GetFont("Fonts/OpenSans-Bold.ttf"); ui = GameInstance.UI; _isUserProfile = IsUserProfile; JsonReaderCharacter.GetCharacterConfig(); counter = CharacterManager.Instance.User != null ? CharacterManager.Instance.User.PortraitId : 0; _nameText = CharacterManager.Instance.User?.Username; CreateUI(); }
void ScrollImage() { if (counter < 0) { counter = 0; } var character = JsonReaderCharacter.GetSingleCharacter(counter); imageSlider.Value = counter; int type = character.Type; int left = character.ImagePosition.Left; int top = character.ImagePosition.Top; int right = character.ImagePosition.Right; int bottom = character.ImagePosition.Bottom; _nameText = character.Name ?? "Unset"; if (counter == 0) { p_prev_img.ImageRect = new IntRect(750, 1250, 1000, 1500); prev_img.ImageRect = new IntRect(1000, 1250, 1250, 1500); sel_img.ImageRect = new IntRect(0, 0, 250, 250); next_img.ImageRect = new IntRect(250, 0, 500, 250); male.ImageRect = new IntRect(260, 0, 520, 110); female.ImageRect = new IntRect(0, 0, 260, 110); other.ImageRect = new IntRect(0, 0, 260, 110); } else if (counter == 1) { p_prev_img.ImageRect = new IntRect(1250, 1250, 1500, 1500); prev_img.ImageRect = new IntRect(0, 0, 250, 250); sel_img.ImageRect = new IntRect(250, 0, 500, 250); next_img.ImageRect = new IntRect(500, 0, 750, 250); male.ImageRect = new IntRect(260, 0, 520, 110); female.ImageRect = new IntRect(0, 0, 260, 110); other.ImageRect = new IntRect(0, 0, 260, 110); } else { sel_img.ImageRect = new IntRect(left, top, right, bottom); next_img.Enabled = true; sel_img.Enabled = true; switch (type) { case 0: male.ImageRect = new IntRect(260, 0, 520, 110); female.ImageRect = new IntRect(0, 0, 260, 110); other.ImageRect = new IntRect(0, 0, 260, 110); break; case 1: male.ImageRect = new IntRect(0, 0, 260, 110); female.ImageRect = new IntRect(260, 0, 520, 110); other.ImageRect = new IntRect(0, 0, 260, 110); break; case 2: male.ImageRect = new IntRect(0, 0, 260, 110); female.ImageRect = new IntRect(0, 0, 260, 110); other.ImageRect = new IntRect(260, 0, 520, 110); break; } int p_prev; int prev; int next; int n_next; if (counter == 43) { p_prev = counter - 2; prev = counter - 1; next = 44; n_next = 0; } else if (counter == 44) { p_prev = counter - 2; prev = counter - 1; next = 0; n_next = 1; } else { p_prev = counter - 2; prev = counter - 1; next = counter + 1; n_next = counter + 2; } character = JsonReaderCharacter.GetSingleCharacter(p_prev); int left_pp = character.ImagePosition.Left; int top_pp = character.ImagePosition.Top; int right_pp = character.ImagePosition.Right; int bottom_pp = character.ImagePosition.Bottom; p_prev_img.ImageRect = new IntRect(left_pp, top_pp, right_pp, bottom_pp); character = JsonReaderCharacter.GetSingleCharacter(prev); int left_p = character.ImagePosition.Left; int top_p = character.ImagePosition.Top; int right_p = character.ImagePosition.Right; int bottom_p = character.ImagePosition.Bottom; prev_img.ImageRect = new IntRect(left_p, top_p, right_p, bottom_p); character = JsonReaderCharacter.GetSingleCharacter(next); int left_n = character.ImagePosition.Left; int top_n = character.ImagePosition.Top; int right_n = character.ImagePosition.Right; int bottom_n = character.ImagePosition.Bottom; next_img.ImageRect = new IntRect(left_n, top_n, right_n, bottom_n); character = JsonReaderCharacter.GetSingleCharacter(n_next); int left_nn = character.ImagePosition.Left; int top_nn = character.ImagePosition.Top; int right_nn = character.ImagePosition.Right; int bottom_nn = character.ImagePosition.Bottom; n_next_img.ImageRect = new IntRect(left_nn, top_nn, right_nn, bottom_nn); } lineEdit.Text = _nameText; }
void CreateProfileBar() { container = root.CreateSprite(); container.Texture = GameInstance.ResourceCache.GetTexture2D(AssetsCoordinates.Generic.Boxes.ResourcePath); container.ImageRect = AssetsCoordinates.Generic.Boxes.ContainerTrasparent; container.SetSize((int)(dim.XScreenRatio * 1200), (int)(dim.YScreenRatio * 1400)); container.SetPosition((int)(dim.XScreenRatio * 0), (int)(dim.YScreenRatio * 50)); // USER LEVEL INDICATOR Sprite LevelInd = new Sprite(); container.AddChild(LevelInd); LevelInd.Texture = GameInstance.ResourceCache.GetTexture2D(AssetsCoordinates.Generic.Boxes.ResourcePath); LevelInd.ImageRect = AssetsCoordinates.Generic.Boxes.LevelBlueBox; LevelInd.SetSize((int)(dim.XScreenRatio * 140), (int)(dim.YScreenRatio * 140)); LevelInd.SetPosition((int)(dim.XScreenRatio * 80), (int)(dim.YScreenRatio * 220)); // Title Text level = new Text(); LevelInd.AddChild(level); level.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Top); level.SetPosition(0, 10); level.SetFont(font, dim.XScreenRatio * 20); level.Value = "LEVEL"; // Value Text levelnumber = new Text(); LevelInd.AddChild(levelnumber); levelnumber.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center); levelnumber.SetPosition(0, 15); levelnumber.SetFont(font, dim.XScreenRatio * 50); levelnumber.Value = string.Format("{0}", CharacterManager.Instance.User.Level); Sprite AchievementsIcon = new Sprite(); container.AddChild(AchievementsIcon); AchievementsIcon.Texture = GameInstance.ResourceCache.GetTexture2D(AssetsCoordinates.Generic.Boxes.ResourcePath); AchievementsIcon.ImageRect = AssetsCoordinates.Generic.Boxes.IconAchievementsBlue; AchievementsIcon.SetSize((int)(dim.XScreenRatio * 140), (int)(dim.YScreenRatio * 140)); AchievementsIcon.SetPosition((int)(dim.XScreenRatio * 80), (int)(dim.YScreenRatio * 400)); Sprite WhiteBox = new Sprite(); container.AddChild(WhiteBox); WhiteBox.Texture = GameInstance.ResourceCache.GetTexture2D(AssetsCoordinates.Generic.Boxes.ResourcePath); WhiteBox.ImageRect = AssetsCoordinates.Generic.Boxes.WhiteBackground; WhiteBox.SetSize((int)(dim.XScreenRatio * 500), (int)(dim.YScreenRatio * 500)); WhiteBox.SetPosition((int)(dim.XScreenRatio * 250), (int)(dim.YScreenRatio * 220)); var character = JsonReaderCharacter.GetSingleCharacter(CharacterManager.Instance.User.PortraitId); int left = character.ImagePosition.Left; int top = character.ImagePosition.Top; int right = character.ImagePosition.Right; int bottom = character.ImagePosition.Bottom; //set the profile image Button ProfileImage = new Button(); container.AddChild(ProfileImage); ProfileImage.Texture = cache.GetTexture2D("Textures/Generic/profiles.png"); ProfileImage.ImageRect = new IntRect(left, top, right, bottom); ProfileImage.SetSize((int)(dim.XScreenRatio * 490), (int)(dim.YScreenRatio * 495)); ProfileImage.SetPosition((int)(dim.XScreenRatio * 255), (int)(dim.YScreenRatio * 220)); ProfileImage.Pressed += args => { GameInstance.LaunchScene(GameScenesEnumeration.PROFILE); }; var buttonProfileImage = new Button(); container.AddChild(buttonProfileImage); buttonProfileImage.Texture = cache.GetTexture2D("Textures/Generic/profiles.png"); buttonProfileImage.ImageRect = new IntRect(left, top, right, bottom); buttonProfileImage.SetSize((int)(dim.XScreenRatio * 490), (int)(dim.YScreenRatio * 495)); buttonProfileImage.SetPosition((int)(dim.XScreenRatio * 255), (int)(dim.YScreenRatio * 220)); buttonProfileImage.Pressed += (PressedEventArgs args) => { GameInstance.LaunchScene(GameScenesEnumeration.PROFILE, true); }; // USERNAME Sprite UsernameBar = new Sprite(); container.AddChild(UsernameBar); UsernameBar.Texture = GameInstance.ResourceCache.GetTexture2D(AssetsCoordinates.Generic.Boxes.ResourcePath); UsernameBar.ImageRect = AssetsCoordinates.Generic.Boxes.BarNameBlue; UsernameBar.SetSize((int)(dim.XScreenRatio * 660), (int)(dim.YScreenRatio * 70)); UsernameBar.SetPosition((int)(dim.XScreenRatio * 160), (int)(dim.YScreenRatio * 800)); // Valye Text Username = new Text(); UsernameBar.AddChild(Username); Username.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center); Username.SetPosition(0, 0); Username.SetFont(font, dim.XScreenRatio * 30); Username.Value = CharacterManager.Instance.User.Username; }