private void ExecuteHandler(ClientSession session) { MapButton button = session.CurrentMapInstance.Buttons.Find(s => s.MapButtonId == ButtonId); if (button != null) { session.CurrentMapInstance.Broadcast(StaticPacketHelper.Out(UserType.Object, button.MapButtonId)); button.RunAction(); session.CurrentMapInstance.Broadcast(button.GenerateIn()); } }
/// <summary> /// GitPacket packet /// </summary> /// <param name="packet"></param> public void Git(GitPacket packet) { MapButton button = Session.CurrentMapInstance.Buttons.FirstOrDefault(s => s.MapButtonId == packet.ButtonId); if (button != null) { Session.CurrentMapInstance.Broadcast(button.GenerateOut()); button.RunAction(); Session.CurrentMapInstance.Broadcast(button.GenerateIn()); } }
private void CreateLoadMapBtn(string mapName) { MapButton mapButton = new MapButton(); mapButton.m_mapDataName = mapName; m_mapButtons.Add(mapButton); var btn = m_mapBtn.CloneTree().Q <Button>(); btn.clicked += mapButton.OnClicked; m_mapButtonsList.Add(btn); btn.Q <TextElement>().text = mapName; }
public void NextMap(int mapID, Action callback) { MapButton button = _buttons[mapID - 1]; if (animal != null) { animal.JumpToMap(0.5f, button.transform.position, 0.0f, callback); } else { callback(); } }
private void RegisterButton(MapButton button, string placeholder, Context context) { if (button == null) { return; } UnityEngine.Events.UnityAction selectAction = () => SearchLocation(context); UnityEngine.Events.UnityAction clearAction = () => SetMarker(null, context); button.AddListener(selectAction, clearAction, placeholder); button.SetDisplayedText(placeholder, true); }
public MapData GetMapData() { Voteable v = voteables[mapState.currentMapID]; Debug.Log("current map voteable ID: " + mapState.currentMapID); MapButton button = v.GetComponent <MapButton> (); Debug.Log("Button being referenced: " + button); MapData data = button.GetMap(); Debug.Log("MapData of referenced button: " + data); return(voteables[mapState.currentMapID].GetComponent <MapButton> ().GetMap()); }
void CreateMapButtons() { for (int i = 0; i < mapDatabase.Count; i++) { if (!mapDatabase.Maps[i].IsMenuScene) { GameObject gbj = Instantiate(mapButton.gameObject, mapCanvas); MapButton mb = gbj.GetComponent <MapButton>(); mb.map = mapDatabase.Maps[i]; mb.image.sprite = mb.map.MapImage; mb.button.onClick.AddListener(() => SetMap(mb.map)); } } }
void ReleaseDesignerOutlets() { if (DeleteMarkerButton != null) { DeleteMarkerButton.Dispose(); DeleteMarkerButton = null; } if (DeleteTaskButton != null) { DeleteTaskButton.Dispose(); DeleteTaskButton = null; } if (DescriptionTask != null) { DescriptionTask.Dispose(); DescriptionTask = null; } if (LabelNetworkAccessTaskView != null) { LabelNetworkAccessTaskView.Dispose(); LabelNetworkAccessTaskView = null; } if (MapButton != null) { MapButton.Dispose(); MapButton = null; } if (NameTask != null) { NameTask.Dispose(); NameTask = null; } if (SaveTaskButton != null) { SaveTaskButton.Dispose(); SaveTaskButton = null; } if (StatusTask != null) { StatusTask.Dispose(); StatusTask = null; } }
/// <summary> /// Jumps to the specified map (one-based). /// </summary> public void JumpToMap(int mapID, Action callback) { MapButton button = _buttons[mapID - 1]; Assert.IsTrue(button.Unlocked); if (animal != null) { animal.JumpToMap(0.0f, button.transform.position, 0.1f, callback); } else { callback(); } }
private void ChangeActiveButton(Direction direction) { switch (direction) { case Direction.Up: if (_currentActiveButton.ButtonOnUp != null) { _currentActiveButton.ToggleActive(); _currentActiveButton = _currentActiveButton.ButtonOnUp; _currentActiveButton.ToggleActive(); } break; case Direction.Down: if (_currentActiveButton.ButtonOnDown != null) { _currentActiveButton.ToggleActive(); _currentActiveButton = _currentActiveButton.ButtonOnDown; _currentActiveButton.ToggleActive(); } break; case Direction.Left: if (_currentActiveButton.ButtonOnLeft != null) { _currentActiveButton.ToggleActive(); _currentActiveButton = _currentActiveButton.ButtonOnLeft; _currentActiveButton.ToggleActive(); } break; case Direction.Right: if (_currentActiveButton.ButtonOnRight != null) { _currentActiveButton.ToggleActive(); _currentActiveButton = _currentActiveButton.ButtonOnRight; _currentActiveButton.ToggleActive(); } break; default: throw new ArgumentOutOfRangeException("direction", direction, null); } }
public MapSelect(GameObject mapSelectMenu) { state = StateManager.state; gui = state.gui; network = state.network; players = new Text[4]; GameObject playerList = mapSelectMenu.transform.Find("Player List").gameObject; for (int i = 0; i < 4; ++i) { players[i] = playerList.transform.GetChild(i).GetComponent <Text>(); } ownerControl = mapSelectMenu.transform.Find("Owner Control").GetComponent <Toggle> (); roomID = mapSelectMenu.transform.Find("RoomID").GetComponent <Text> (); mapButtonParent = mapSelectMenu.transform.Find("MapButtons"); mapPreview = mapSelectMenu.transform.Find("MapPreview").GetComponent <Image> (); startGame = mapSelectMenu.transform.Find("Start Game").GetComponent <Button> (); GameObject mapButtonPrefab = Resources.Load("Prefabs/MapButton", typeof(GameObject)) as GameObject; GameObject[] maps = Resources.LoadAll <GameObject> ("Maps"); float buttonWidth = mapButtonPrefab.GetComponent <RectTransform>().rect.width; float buttonHeight = mapButtonPrefab.GetComponent <RectTransform>().rect.height; float xOffset = 50f; float yOffset = 50f; float xStart = Mathf.Max((-1 * Screen.width / 2) + buttonWidth, -1 * (buttonWidth * maps.Length) / 2); float xPos = xStart; float yPos = 50f; foreach (GameObject map in maps) { GameObject mapButton = UnityEngine.Object.Instantiate(mapButtonPrefab, mapButtonParent); MapButton buttonScript = mapButton.GetComponent <MapButton> (); mapButton.transform.localPosition = new Vector3(xPos, yPos, 0); xPos += mapButton.GetComponent <RectTransform> ().rect.width + xOffset; buttonScript.init(map.GetComponent <MapData> (), mapPreview); mapButton.SetActive(true); if (xPos > (xStart * -1)) { xPos = xStart; yPos -= buttonHeight + yOffset; } } voteables = mapSelectMenu.GetComponentsInChildren <Voteable> (true); }
public void OnTap(Gesture gesture) { Ray ray; RaycastHit hit; ray = MapCamera.ScreenPointToRay(gesture.position); if (!Physics.Raycast(ray, out hit, 1000)) { return; } MapButton Button = hit.collider.GetComponent <MapButton>(); if (Button != null) { Menu.Instance.OpenLevelPopup(Button.LevelID); } }
public static bool Prefix(MapButton __instance, Btd6Player player, Animator medalAnimator, string mapId, string difficulty, string mode) { //Console.WriteLine("ShowMedal"); //Console.WriteLine(player == null); //Console.WriteLine(player.debugUnlockAllModes = true); player.debugUnlockAllModes = true; //player.CompleteMap("lyne"); //player.CompleteMap("heartgate"); //player.MarkSeenMapUnlock("lyne"); //player.MarkSeenMapUnlock("lyne"); //player.MarkSeenMapUnlock("heartgate"); foreach (var item in UI.instance.mapSet.Maps.items) { player.MarkSeenMapUnlock(item.id); } //player.kno //Console.WriteLine(mapId); //Console.WriteLine(difficulty); //Console.WriteLine(mode); return(true); }
public static bool Prefix(MapButton __instance, Btd6Player player, Animator medalAnimator, string mapId, string difficulty, string mode) { //player.debugUnlockAllModes = true; //player.IsModeUnlocked foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.UnlockMap(mapnamesfinal); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Easy", "Standard", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Easy", "PrimaryOnly", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Easy", "Deflation", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Easy", "Reverse", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Medium", "Standard", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Medium", "MilitaryOnly", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Medium", "Apopalypse", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Medium", "Reverse", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Hard", "Standard", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Hard", "MagicOnly", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Hard", "DoubleMoabHealth", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Hard", "HalfCash", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Hard", "AlternateBloonsRounds", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Hard", "Impoppable", false, false); } foreach (string mapnamesfinal in UnlockMaps.mapnamesfinal) { player.CompleteMode(mapnamesfinal, "Hard", "Clicks", false, false); } return(true); //foreach (var item in Game.instance.mapSet.Maps.items) //{ // player.MarkSeenMapUnlock(item.id); // player.IsMapUnlocked //} //player.kno //Console.WriteLine(mapId); //Console.WriteLine(difficulty); //Console.WriteLine(mode); //player.CompleteMap("lyne"); //player.CompleteMap("heartgate"); //player.MarkSeenMapUnlock("lyne"); //player.MarkSeenMapUnlock("lyne"); //player.MarkSeenMapUnlock("heartgate"); //Console.WriteLine("ShowMedal"); //Console.WriteLine(player == null); //Console.WriteLine(player.debugUnlockAllModes = true); }
public void Init(int level, Tracker tracker, GameObject greyBG, MapButton mapButton, GameObject speechUI) { Init(level, tracker, greyBG); this.mapButton = mapButton; this.speechUI = speechUI; }
void Start() { // Get current level int level = UserData.Instance.Level; int mapCount = maps.Length; float mapWidth = maps[0].GetWidth(); int buttonCount = -1; float cloudY = -1; for (int zone = 0; zone < 2; zone++) { ZoneType zoneType = zone.ToZoneType(); if (level <= zoneType.MapCount()) { buttonCount = zoneType.MapCount() + 1; cloudY = clouds.GetChild(zone).position.y; break; } } Vector3 position = Vector3.zero; for (int i = 0; i < mapCount; i++) { GameObject bg = new GameObject(string.Format("Background {0}", i + 1)); bg.transform.SetParent(background); bg.transform.localPosition = position; SpriteRenderer renderer = bg.AddComponent <SpriteRenderer>(); renderer.sprite = maps[i]; renderer.sortingOrder = -3; float height = maps[i].GetHeight(); position.y += height; if (cloudY > 0 && position.y >= cloudY) { break; } } if (cloudY < 0) { cloudY = position.y; } // Set cloud position cloud.transform.SetPositionY(cloudY); // Set number of maps _mapCount = points.childCount; if (buttonCount < 0) { buttonCount = _mapCount; } // Create buttons _buttons = new MapButton[buttonCount]; bool isNewLevel = UserData.Instance.NewLevel; for (int i = 0; i < buttonCount; i++) { position = points.GetChild(i).position; int mapID = i + 1; GameObject map = buttonPrefab.Create(background, position); map.name = string.Format("Map {0}", mapID); bool unlocked = mapID < level || (mapID == level && !isNewLevel); MapButton mapButton = map.GetComponent <MapButton>(); mapButton.Construct(spriteLock, zones[ZoneTypeHelper.GetZoneType(mapID).ToInt()].mapIcon, mapID, unlocked); _buttons[i] = mapButton; } // Destroy points Destroy(points.gameObject); // Destroy clouds Destroy(clouds.gameObject); // Fixed width float scale = Camera.main.GetWidth() / mapWidth; background.SetScale(scale); float mapHeight = cloudY * scale; // _squareRadius = ButtonRadius * ButtonRadius * scale * scale; // Create vertical scroll _verticalScroll = new VerticalScroll(); _verticalScroll.Construct(-Camera.main.orthographicSize, mapHeight, Camera.main.GetHeight()); // Set map position // transform.SetPositionY(_verticalScroll.Position); // Get current map int mapIndex = Mathf.Clamp(UserData.Instance.Map - 1, 0, _buttons.Length - 1); if (animal != null) { // Set animal position animal.transform.position = _buttons[mapIndex].transform.position; // Set skin animal.idleDuration = 0; ZoneType zoneType = ZoneTypeHelper.GetZoneType(mapIndex + 1); if (!zoneType.IsDefault()) { ZoneSetting zone = zones[zoneType.ToInt()]; animal.SetClothes(zone.clothesLeft, zone.clothesUp, zone.clothesDown); animal.SetCap(zone.capLeft, zone.capUp, zone.capDown); } } MoveObjectToCenter(_buttons[mapIndex].gameObject); }
private void Start() { Button = GetComponentInParent <MapButton>(); UpdateStars(); }
void ReleaseDesignerOutlets() { if (AddSeekiosButton != null) { AddSeekiosButton.Dispose(); AddSeekiosButton = null; } if (AddSeekiosLabel != null) { AddSeekiosLabel.Dispose(); AddSeekiosLabel = null; } if (AllSeekiosMapLabel != null) { AllSeekiosMapLabel.Dispose(); AllSeekiosMapLabel = null; } if (CreditsLabel != null) { CreditsLabel.Dispose(); CreditsLabel = null; } if (CreditsTitleLabel != null) { CreditsTitleLabel.Dispose(); CreditsTitleLabel = null; } if (EmailUser != null) { EmailUser.Dispose(); EmailUser = null; } if (FeedbackButton != null) { FeedbackButton.Dispose(); FeedbackButton = null; } if (FeedbackLabel != null) { FeedbackLabel.Dispose(); FeedbackLabel = null; } if (Head2View != null) { Head2View.Dispose(); Head2View = null; } if (HeadView != null) { HeadView.Dispose(); HeadView = null; } if (HistoriqueConsommationButton != null) { HistoriqueConsommationButton.Dispose(); HistoriqueConsommationButton = null; } if (MapButton != null) { MapButton.Dispose(); MapButton = null; } if (MyConsoLabel != null) { MyConsoLabel.Dispose(); MyConsoLabel = null; } if (NameUser != null) { NameUser.Dispose(); NameUser = null; } if (ParameterButton != null) { ParameterButton.Dispose(); ParameterButton = null; } if (ParametersLabel != null) { ParametersLabel.Dispose(); ParametersLabel = null; } if (SeekiosTutorialButton != null) { SeekiosTutorialButton.Dispose(); SeekiosTutorialButton = null; } if (SettingsImageView != null) { SettingsImageView.Dispose(); SettingsImageView = null; } if (UserGuideLabel != null) { UserGuideLabel.Dispose(); UserGuideLabel = null; } if (UserImageView != null) { UserImageView.Dispose(); UserImageView = null; } }
public override void Begin() { if (!loaded) { Entity entity = new Entity(-1); entity.Add(this.Renderer = new MapRenderer(false)); base.Add <Entity>(entity); } this.Buttons = new List <MapButton>(); if (this.Mode == MainMenu.RollcallModes.Versus) { InitVersusButtons(); } else if (this.Mode == MainMenu.RollcallModes.Quest) { Buttons.Add(new GoToWorkshopMapButton()); for (int i = 0; i < GameData.QuestLevels.Length; i++) { if (SaveData.Instance.Unlocks.GetQuestTowerUnlocked(i)) { this.Buttons.Add(new QuestMapButton(GameData.QuestLevels[i])); } } LinkButtonsList(); } else if (Mode == MainMenu.RollcallModes.DarkWorld) { for (int j = 0; j < GameData.DarkWorldTowers.Count; j++) { if (SaveData.Instance.Unlocks.GetDarkWorldTowerUnlocked(j)) { Buttons.Add(new DarkWorldMapButton(GameData.DarkWorldTowers[j])); } } LinkButtonsList(); } else { if (Mode != MainMenu.RollcallModes.Trials) { throw new Exception("Mode not recognized!"); } List <MapButton[]> list = new List <MapButton[]>(); for (int k = 0; k < GameData.VersusTowers.Count; k++) { if (SaveData.Instance.Unlocks.GetTowerUnlocked(k)) { MapButton[] array = new MapButton[GameData.TrialsLevels.GetLength(1)]; for (int l = 0; l < array.Length; l++) { array[l] = new TrialsMapButton(GameData.TrialsLevels[k, l]); Buttons.Add(array[l]); } for (int m = 0; m < array.Length; m++) { if (m > 0) { array[m].UpButton = array[m - 1]; } if (m < array.Length - 1) { array[m].DownButton = array[m + 1]; } } list.Add(array); } } for (int n = 0; n < list.Count; n++) { if (n > 0) { for (int num = 0; num < list[n].Length; num++) { list[n][num].LeftButton = list[n - 1][num]; } } if (n < list.Count - 1) { for (int num2 = 0; num2 < list[n].Length; num2++) { list[n][num2].RightButton = list[n + 1][num2]; } } for (int num3 = 0; num3 < list[n].Length; num3++) { list[n][num3].MapXIndex = n; } } } foreach (MapButton entity2 in this.Buttons) { Add(entity2); } MapButton mapButton; if (Mode == MainMenu.RollcallModes.Versus) { if (MainMenu.VersusMatchSettings.LevelSystem.CustomTower) { mapButton = Buttons[0]; } else if (MainMenu.VersusMatchSettings.RandomVersusTower) { mapButton = Buttons[1]; for (int num4 = 0; num4 < this.Buttons.Count; num4++) { if (Buttons[num4] is VersusRandomSelect) { mapButton = Buttons[num4]; break; } } } else { mapButton = GetButtonFromID(MainMenu.VersusMatchSettings.LevelSystem.ID); if (mapButton == null) { mapButton = Buttons[1]; } } } else if (Mode == MainMenu.RollcallModes.Trials) { mapButton = GetButtonFromID(MainMenu.TrialsMatchSettings.LevelSystem.ID); if (mapButton == null) { mapButton = Buttons[0]; } } else if (Mode == MainMenu.RollcallModes.Quest) { mapButton = GetButtonFromID(MainMenu.QuestMatchSettings.LevelSystem.ID); if (mapButton == null) { mapButton = Buttons[0]; } } else { if (Mode != MainMenu.RollcallModes.DarkWorld) { throw new Exception("Mode not recognized!"); } mapButton = GetButtonFromID(MainMenu.DarkWorldMatchSettings.LevelSystem.ID); if (mapButton == null) { mapButton = Buttons[0]; } } if (mapButton.Data == null) { Renderer.OnStartSelection(""); } else { Renderer.OnStartSelection(mapButton.Data.Title); } this.InitButtons(mapButton); this.CanAct = false; base.Add <CoroutineEntity>(new CoroutineEntity(this.IntroSequence())); base.Camera.Position = MapScene.ClampCamera(this.Selection.MapPosition); if (!loaded) { this.Cursor = new MapCursor(this.Selection); base.Add <MapCursor>(this.Cursor); } if (this.Mode == MainMenu.RollcallModes.Trials) { base.Add <TrialsLevelSelectOverlay>(this.trialsOverlay = new TrialsLevelSelectOverlay(this)); } else if (this.Mode == MainMenu.RollcallModes.Quest) { base.Add <QuestLevelSelectOverlay>(this.questOverlay = new QuestLevelSelectOverlay(this)); } else if (this.Mode == MainMenu.RollcallModes.DarkWorld) { base.Add <DarkWorldLevelSelectOverlay>(this.darkWorldOverlay = new DarkWorldLevelSelectOverlay(this)); } if ((this.Mode == MainMenu.RollcallModes.Trials || this.Mode == MainMenu.RollcallModes.Versus) && !GameData.DarkWorldDLC) { base.Add <MapDarkWorldGate>(new MapDarkWorldGate(this)); } //scene.begin UpdateEntityLists(); foreach (KeyValuePair <int, Layer> keyValuePair in this.Layers) { keyValuePair.Value.Begin(); } loaded = true; }
public bool AddButton(MapButton button) { this.addTexToSubdiv(button.X, button.Y, button.ImageData); button.canvas.RenderTransform = new TranslateTransform(button.X * RegionImage.Width, button.Y * RegionImage.Height); button.Ellipse.PreviewTouchDown += ButtonSelected; ((Canvas)RegionImage.Parent).Children.Add(button.canvas); _mapbuttons.Add(button); return true; }
public void AddArtwork(MapButton button) { //maybe a boolean flag or hashmap-ish thing instead? if (!_containedArtworks.Contains(button.ImageData)) _containedArtworks.Add(button.ImageData); this.AddButton(button); }
public override void ViewDidLoad() { base.ViewDidLoad(); // button click seekios tutorial SeekiosTutorialButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToListTutorial(); })); // button click my consomation HistoriqueConsommationButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.Credits.GoToCreditHistoric(); })); // button click on add a seekios AddSeekiosButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToAddSeekios(); })); // button click on map all seekios MapButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { if (App.CurrentUserEnvironment.LsSeekios.Count == 0) { AlertControllerHelper.ShowAlert(Application.LocalizedString("ZeroSeekios") , Application.LocalizedString("NeedAtLeastOneSeekios") , Application.LocalizedString("Close")); } else { if (App.CurrentUserEnvironment.LsSeekios.All(a => a.LastKnownLocation_latitude == App.DefaultLatitude && a.LastKnownLocation_longitude == App.DefaultLongitude)) { if (App.CurrentUserEnvironment.LsSeekios.Count == 1) { AlertControllerHelper.ShowAlert(Application.LocalizedString("NoPosition") , Application.LocalizedString("OneSeekiosNewlyAdded") , Application.LocalizedString("Close")); } else { AlertControllerHelper.ShowAlert(Application.LocalizedString("NoPosition") , Application.LocalizedString("PluralSeekiosNewlyAdded") , Application.LocalizedString("Close")); } } else { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToSeekiosMapAllSeekios(); } } })); // button click on feedback FeedbackButton.AddGestureRecognizer(new UITapGestureRecognizer(() => { var feedbackManager = BITHockeyManager.SharedHockeyManager.FeedbackManager; feedbackManager.ShowFeedbackListView(); feedbackManager.ShowFeedbackComposeView(); NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); })); // button click on Parameter UserImageView.UserInteractionEnabled = true; UserImageView.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); EmailUser.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); NameUser.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); SettingsImageView.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); CreditsTitleLabel.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); CreditsLabel.AddGestureRecognizer(new UITapGestureRecognizer(() => { NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true); App.Locator.LeftMenu.GoToParameter(); })); }
private void ExecuteHandler(ClientSession session) { if (session.Character.LastSkillUse.AddSeconds(1) > DateTime.UtcNow || (session.Character.IsVehicled && session.CurrentMapInstance?.MapInstanceType != MapInstanceType.EventGameInstance) || !session.HasCurrentMapInstance) { return; } if (TransportId < 100000) { MapButton button = session.CurrentMapInstance.Buttons.Find(s => s.MapButtonId == TransportId); if (button != null) { session.SendPacket(UserInterfaceHelper.GenerateDelay(2000, 1, $"#git^{button.MapButtonId}")); } } else { if (!session.CurrentMapInstance.DroppedList.ContainsKey(TransportId)) { return; } MapItem mapItem = session.CurrentMapInstance.DroppedList[TransportId]; if (mapItem != null) { bool canpick = false; switch (PickerType) { case 1: canpick = session.Character.IsInRange(mapItem.PositionX, mapItem.PositionY, 8); break; case 2: Mate mate = session.Character.Mates.Find(s => s.MateTransportId == PickerId && s.CanPickUp); if (mate != null) { canpick = mate.IsInRange(mapItem.PositionX, mapItem.PositionY, 8); } break; } if (canpick && session.HasCurrentMapInstance) { if (mapItem is MonsterMapItem item) { MonsterMapItem monsterMapItem = item; if (session.CurrentMapInstance.MapInstanceType != MapInstanceType.LodInstance && monsterMapItem.OwnerId.HasValue && monsterMapItem.OwnerId.Value != -1) { Group group = ServerManager.Instance.Groups.Find(g => g.IsMemberOfGroup(monsterMapItem.OwnerId.Value) && g.IsMemberOfGroup(session.Character.CharacterId)); if (item.CreatedDate.AddSeconds(30) > DateTime.UtcNow && !(monsterMapItem.OwnerId == session.Character.CharacterId || (group?.SharingMode == (byte)GroupSharingType.Everyone))) { session.SendPacket( session.Character.GenerateSay( Language.Instance.GetMessageFromKey("NOT_YOUR_ITEM"), 10)); return; } } // initialize and rarify item.Rarify(null); } if (mapItem.ItemVNum != 1046) { ItemInstance mapItemInstance = mapItem.GetItemInstance(); if (mapItemInstance.Item.ItemType == ItemType.Map) { if (mapItemInstance.Item.Effect == 71) { session.Character.SpPoint += mapItem.GetItemInstance().Item.EffectValue; if (session.Character.SpPoint > 10000) { session.Character.SpPoint = 10000; } session.SendPacket(UserInterfaceHelper.GenerateMsg( string.Format(Language.Instance.GetMessageFromKey("SP_POINTSADDED"), mapItem.GetItemInstance().Item.EffectValue), 0)); session.SendPacket(session.Character.GenerateSpPoint()); } if (ServerManager.Instance.QuestModelList.FirstOrDefault(s => s.QuestGiver.QuestGiverId == mapItemInstance.Item.VNum && s.QuestGiver.Type == QuestGiverType.ItemLoot) is QuestModel model) { session.Character.QuestManager.AddQuest(model.QuestId); } session.CurrentMapInstance.DroppedList.Remove(TransportId); session.CurrentMapInstance?.Broadcast( session.Character.GenerateGet(PickerId, TransportId)); } else { lock (session.Character.Inventory) { short amount = mapItem.Amount; ItemInstance inv = session.Character.Inventory.AddToInventory(mapItemInstance) .FirstOrDefault(); if (inv != null) { session.CurrentMapInstance.DroppedList.Remove(TransportId); session.CurrentMapInstance?.Broadcast( session.Character.GenerateGet(PickerId, TransportId)); if (PickerType == 2) { Mate mate = session.Character.Mates.FirstOrDefault(s => s.MateTransportId == PickerId && s.CanPickUp); if (mate != null) { session.SendPacket(session.Character.GenerateIcon(1, 1, inv.ItemVNum)); mate.Owner?.Session.CurrentMapInstance?.Broadcast(StaticPacketHelper.GenerateEff(UserType.Npc, mate.MateTransportId, 5004), mate.PositionX, mate.PositionY); } else { return; } } session.SendPacket(session.Character.GenerateSay( $"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {inv.Item.Name} x {amount}", 12)); if (session.CurrentMapInstance.MapInstanceType == MapInstanceType.LodInstance) { session.CurrentMapInstance?.Broadcast( session.Character.GenerateSay( $"{string.Format(Language.Instance.GetMessageFromKey("ITEM_ACQUIRED_LOD"), session.Character.Name)}: {inv.Item.Name} x {mapItem.Amount}", 10)); } session.Character.OnPickupItem(new PickupItemEventArgs(inv.Item)); } else { session.SendPacket(UserInterfaceHelper.GenerateMsg( Language.Instance.GetMessageFromKey("NOT_ENOUGH_PLACE"), 0)); } } } } else { // handle gold drop long maxGold = ServerManager.Instance.Configuration.MaxGold; double multiplier = 1 + (session.Character.GetBuff(BCardType.CardType.Item, (byte)AdditionalTypes.Item.IncreaseEarnedGold)[0] / 100D); multiplier += (session.Character.ShellEffectMain.FirstOrDefault(s => s.Effect == (byte)ShellWeaponEffectType.GainMoreGold)?.Value ?? 0) / 100D; if (mapItem is MonsterMapItem droppedGold) { if (session.Character.Gold + (droppedGold.GoldAmount * multiplier) <= maxGold) { if (PickerType == 2) { session.SendPacket(session.Character.GenerateIcon(1, 1, 1046)); } session.Character.Gold += (int)(droppedGold.GoldAmount * multiplier); GameLogger.Instance.LogPickupGold(ServerManager.Instance.ChannelId, session.Character.Name, session.Character.CharacterId, (int)(droppedGold.GoldAmount * multiplier), false); session.SendPacket(session.Character.GenerateSay( $"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {mapItem.GetItemInstance().Item.Name} x {droppedGold.GoldAmount}{(multiplier > 1 ? $" + {(int) (droppedGold.GoldAmount * multiplier) - droppedGold.GoldAmount}" : string.Empty)}", 12)); } else { session.Character.Gold = maxGold; GameLogger.Instance.LogPickupGold(ServerManager.Instance.ChannelId, session.Character.Name, session.Character.CharacterId, (int)(droppedGold.GoldAmount * multiplier), true); session.SendPacket( UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("MAX_GOLD"), 0)); } } session.SendPacket(session.Character.GenerateGold()); session.CurrentMapInstance.DroppedList.Remove(TransportId); session.CurrentMapInstance?.Broadcast(session.Character.GenerateGet(PickerId, TransportId)); } } } } }
public override void Enter() { base.Enter(); Program.Instance.Interface.AddChild(new Control { Background = new StretchingImageGraphic { Texture = new TextureFromFile("mainmenubackground.png"), Size = new Vector2(Program.Settings.GraphicsDeviceSettings.Resolution.Width, Program.Settings.GraphicsDeviceSettings.Resolution.Height) }, Dock = System.Windows.Forms.DockStyle.Fill }); if (Common.ProgramConfigurationInformation.Warnings.Count > 0) { Program.Instance.Interface.AddChild( new Graphics.Interface.ProgramConfigurationInformationControl { Position = new Vector2(0, 150) }); } form = new DeveloperMainMenuForm(); Program.Instance.Interface.AddChild(form); Program.Instance.Interface.AddChild(new TestMaps()); var buttonsGrid = new Grid { Size = new Vector2(800, 200), Anchor = Orientation.BottomLeft, NWidth = 4, NHeight = 8 }; Program.Instance.Interface.AddChild(buttonsGrid); var videoSettings = new Button { Size = new Vector2(200, 20), Text = "Options", Position = new Vector2(200, 60) }; buttonsGrid.AddChild(videoSettings); videoSettings.Click += new EventHandler(videoSettings_Click3); videoSettings = new Button { Text = "Fullscreen", }; buttonsGrid.AddChild(videoSettings); videoSettings.Click += new EventHandler((o, e) => { Program.Settings.WindowMode = WindowMode.Fullscreen; Program.UpdateWindowMode(); }); Button exitGameButton = new Button { Position = new Vector2(200, 40), Size = new Vector2(200, 20), Text = "Exit", }; buttonsGrid.AddChild(exitGameButton); exitGameButton.Click += new EventHandler(exitGameButton_Click); Button ratingTestPopup = new Button { Position = new Vector2(200, 0), Size = new Vector2(200, 20), Text = "Rating Test" }; buttonsGrid.AddChild(ratingTestPopup); ratingTestPopup.Click += new EventHandler((o, e) => { Client.Game.Interface.ScoreScreenControl ssc = new Client.Game.Interface.ScoreScreenControl { GameState = new Client.Game.GameState { }, Map = new Client.Game.Map.Map { Settings = new Client.Game.Map.MapSettings { Name = "asdf" } }, GameTime = 123, Statistics = new Client.Game.Statistics { }, EarnedGoldCoins = 1, SilverEnabled = Program.Settings.SilverEnabled, HideStats = Program.Settings.HideStats }; ssc.AddChild(new Client.Game.Interface.RatingBox { Anchor = Orientation.TopRight, Position = new Vector2(0, 45) }); Program.Instance.Interface.AddChild(ssc); }); Button helpPopup = new Button { Position = new Vector2(200, 40), Size = new Vector2(200, 20), Text = "Help", }; buttonsGrid.AddChild(helpPopup); helpPopup.Click += new EventHandler(helpPopup_Click); Button button = new Button { Text = "NormalWindow", }; buttonsGrid.AddChild(button); button.Click += new EventHandler((o, e) => { Program.Instance.Interface.AddChild( new Window { Anchor = Orientation.Center, Moveable = true }); }); button = new Button { Text = "LargeWindow", }; buttonsGrid.AddChild(button); button.Click += new EventHandler((o, e) => { Program.Instance.Interface.AddChild( new Window { Anchor = Orientation.Center, Moveable = true, LargeWindow = true }); }); button = new Button { Text = "Display settings form" }; buttonsGrid.AddChild(button); button.Click += new EventHandler(button_Click); var currentStages = new Client.Game.Interface.StageInfo[] { new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Time = 200, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Time = 200, MaxHitPoints = 600, }, null, null, null }; var bestStages = new Client.Game.Interface.StageInfo[] { new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3f, Time = 150, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 100, Rage = 3f, Time = 150, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3f, Time = 150, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3f, Time = 150, MaxHitPoints = 600, }, null }; Action <String, Func <Graphics.Entity> > addDialogTest = (text, dialog) => { button = new Button { Text = text, }; buttonsGrid.AddChild(button); button.Click += new EventHandler((o, e) => { var d = dialog(); Program.Instance.Interface.AddChild(d); System.Windows.Forms.Form f = new System.Windows.Forms.Form { Size = new System.Drawing.Size(200, 500) }; var pg = new System.Windows.Forms.PropertyGrid { SelectedObject = d, Dock = System.Windows.Forms.DockStyle.Fill }; f.Controls.Add(pg); pg.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler((o2, e2) => { d.Invalidate(); }); f.Show(); }); }; addDialogTest("StartScreenControl", () => new Game.Interface.StartScreenControl { Anchor = Orientation.Center, Moveable = true, MapSettings = new Client.Game.Map.MapSettings { Name = "The test map", }, AvailableRangedWeapons = Program.Instance.Profile.AvailableRangedWeapons, AvailableMeleeWeapons = Program.Instance.Profile.AvailableMeleeWeapons }); addDialogTest("CreditsText", () => new Game.Interface.CreditsText { Title = "Entertainment", Text = "The muppets", }); addDialogTest("LargeStoneButton", () => new LargeStoneButton { Text = "Button", Anchor = Orientation.Center }); addDialogTest("StoneButton", () => new StoneButton { Text = "Button", Anchor = Orientation.Center }); Random random = new Random(); var stats = new Client.Game.Statistics(); stats.CharacterActions.ShotgunFired = 40; stats.CharacterActions.ShotgunSlugHits = 67; stats.CharacterActions.GhostRifleFired = 20; stats.CharacterActions.GhostRifleHits = 18; stats.Actions.DamageDealt = random.Next(950); stats.Actions.DamageTaken = random.Next(340); stats.Actions.HitsTaken = random.Next(34); stats.Actions.TimesNetted = random.Next(40); stats.Kills.TotalKills = random.Next(12031); addDialogTest("ScoreScreenControl", () => new Game.Interface.ScoreScreenControl { Anchor = Orientation.Center, Map = new Client.Game.Map.Map { Settings = new Client.Game.Map.MapSettings { Name = "The Challenge", Stages = 5 } }, Statistics = stats, Moveable = true, EarnedGoldCoins = 1, LostGameReason = "You were killed by a grunt", GameState = Client.Game.GameState.Won, AchievementsEarned = new List <Achievement> { new Achievements.Make5TriesOnASingleMap(), new Achievements.Kill70ZombiesInUnder10Seconds(), new Achievements.Make10TriesOnASingleMap(), new Achievements.Make20TriesOnASingleMap(), new Achievements.Kill100ZombiesInUnder10Seconds(), }, CurrentStages = currentStages, BestStages = bestStages, SilverEnabled = Program.Settings.SilverEnabled, HideStats = Program.Settings.HideStats }); addDialogTest("InGameMenu", () => new Game.Interface.InGameMenu { Anchor = Orientation.Center, MapSettings = new Client.Game.Map.MapSettings { Name = "The test map", }, }); addDialogTest("StoneDropDownBar", () => { var r = new StoneDropDownBar { Anchor = Orientation.Center, }; r.AddItem("hello"); r.AddItem("cruel"); r.AddItem("world which sdlf jdsf klsdfadsflksda jödaskfj lsdjf lksafdjdöf kl sdkj\n\nslkfj"); return(r); }); addDialogTest("AchievementUnlockedPopup", () => new AchievementUnlockedPopup { DisplayName = "O needs medical attention?", Description = "Complete \"Reverse Gauntlet\" without killing any regular chests." }); addDialogTest("UnlockButton", () => new UnlockButton { }); addDialogTest("MapButton", () => { var mb = new MapButton { Map = "LevelA", }; Program.Instance.Tooltip.SetToolTip(mb, new MapToolTip { Title = "Jahman", Objective = "Killin them zombies", Yield = 2 }); return(mb); }); addDialogTest("RatingBox", () => new Game.Interface.RatingBox { }); addDialogTest("ActionTipText", () => new Game.Interface.WarningFlashText { Text = "Press space!" }); addDialogTest("TutorialText", () => new Game.Interface.TutorialText { Text = "Dead Meets Lead is every bit and piece of what a zombie slaying, fast paced action game should be. Enter the role of the 18th century commander who's on a mission to obliterate the evil, by fighting your way through the islands and liberating the villagers before they are all consumed by a mystic plague. You'll have to act, think and move fast if you want to survive the horrors of these wicked parts of the world, and do not hope for any rescue or help, it's all up to you and you alone!", Title = "Tutorial" }); addDialogTest("Dialog", () => new Dialog { Title = "Hello", Text = "Applications that load assemblies with this method will be affected by upgrades of those assemblies. Therefore, do not use this method; redesign the application to use the Load(String) method overload or the LoadFrom(String) method overload.", }); addDialogTest("InGameMenu", () => new Game.Interface.InGameMenu { }); addDialogTest("SpeachBubble", () => new Game.Interface.SpeachBubble { Text = "Dead Meets Lead is every bit and piece of what a zombie slaying, fast paced action game should be. Enter the role of the 18th century commander who's on a mission..." }); addDialogTest("Rating", () => new Game.Interface.RatingControl { Anchor = global::Graphics.Orientation.Center }); addDialogTest("StageInfo", () => new Game.Interface.StageInfoControl { Anchor = global::Graphics.Orientation.Center, Background = InterfaceScene.DefaultSlimBorder, CurrentStage = new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Time = 200, MaxHitPoints = 600 }, BestStage = new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3, Time = 150, MaxHitPoints = 600 } }); addDialogTest("StageCompleted", () => { var s = new Game.Interface.StageControl { Anchor = global::Graphics.Orientation.Center, CurrentStage = new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Ammo = 15, Time = 200, MaxHitPoints = 600, Stage = 2 }, BestStage = new Client.Game.Interface.StageInfo { HitPoints = 200, Rage = 3, Ammo = 5, Time = 150, MaxHitPoints = 600 }, Stage = 1, Clickable = true }; s.Click += new EventHandler((o, e) => { if (s.State == Client.Game.Interface.StageCompletedState.Maximized) { s.State = Client.Game.Interface.StageCompletedState.Minimizing; } else { s.State = Client.Game.Interface.StageCompletedState.Maximizing; } }); return(s); } ); addDialogTest("ArrowIndicator", () => new ArrowIndicator { Anchor = global::Graphics.Orientation.Center, Size = new Vector2(100, 100) }); addDialogTest("DefaultFormBorderOutlined", () => new Form { Anchor = global::Graphics.Orientation.Center, Size = new Vector2(250, 140), Background = InterfaceScene.DefaultFormBorderOutlined, Moveable = true }); addDialogTest("Stages", () => { var s = new Client.Game.Interface.StagesControl { Anchor = global::Graphics.Orientation.Center, Size = new Vector2(1000, 140), NStages = 5 }; for (int i = 0; i < s.NStages; i++) { s.SetBestStage(i + 1, bestStages[i]); s.SetCurrentStage(i + 1, currentStages[i]); } s.SetActive(1, true); Program.Instance.Timeout(2, () => s.Maximize(2)); Program.Instance.Timeout(10, () => s.Minimize(2)); return(s); }); addDialogTest("Scaling", () => { var s = new Graphics.Interface.Control { Background = new Graphics.Content.ImageGraphic { SizeMode = SizeMode.AutoAdjust, Texture = new TextureFromFile("checker.png") }, Size = new Vector2(512, 512), Position = new Vector2(100, 100), Updateable = true }; var c = new Graphics.Interface.Control { Background = new Graphics.Content.ImageGraphic { SizeMode = SizeMode.AutoAdjust, Texture = new TextureFromFile("cornell.png") }, Size = new Vector2(128, 128), Position = new Vector2(100, 100), }; s.AddChild(c); float v = 0; s.Update += new UpdateEventHandler((o, d) => { v += d.Dtime; s.Scale = new Vector3((float)Math.Abs(Math.Sin(v)), (float)Math.Abs(Math.Sin(v)), 1); }); return(s); }); addDialogTest("VideoOptionsWindow", () => new VideoOptionsWindow { AvailableAnimationQualities = new Graphics.Renderer.Settings.AnimationQualities[] { Graphics.Renderer.Settings.AnimationQualities.Low, Graphics.Renderer.Settings.AnimationQualities.Medium, Graphics.Renderer.Settings.AnimationQualities.High }, AnimationQuality = Program.Settings.RendererSettings.AnimationQuality, AvailableVideoQualities = new VideoQualities[] { VideoQualities.Custom, VideoQualities.Low, VideoQualities.Medium, VideoQualities.High, VideoQualities.Ultra }, OverallVideoQuality = Program.Settings.VideoQuality, }); deviceRes = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(0, 50) }; clientRes = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(80, 50) }; windowRes = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(240, 50) }; fps = new Label { Anchor = Orientation.BottomRight, Size = new Vector2(70, 70), Position = new Vector2(160, 50) }; mousePos = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(320, 50) }; #if DEBUG_DEVELOPERMAINMENU i++; s[i] = new System.IO.StreamWriter("debugRESOLUTION" + i + ".txt"); #endif Program.Instance.Interface.AddChild(deviceRes); Program.Instance.Interface.AddChild(clientRes); Program.Instance.Interface.AddChild(windowRes); Program.Instance.Interface.AddChild(fps); Program.Instance.Interface.AddChild(mousePos); fader = new Fader { State = FadeState.FadedOut }; Program.Instance.Interface.AddChild(fader); }
public void RegisterButton(MapButton button) { _buttons.Add(button); _gameManager = GameManager.GetGameManager(); }
public override void Draw() { switch (NogardGame.GameState) { case NogardGame.GameStateEnum.MainMenu: PlayButton.DrawStandardButton(5, "Play", 1); ScoreButton.DrawStandardButton(5, " Highscore", 0.5f); AboutNogardButton.DrawStandardButton(5, "About Nogard", 0.4f); InstuctionsButton.DrawStandardButton(5, " How to play", 0.4f); ExitButton.DrawStandardButton(5, " Exit", 0.4f); MapButton.DrawStandardButton(5, " MapMaker", 0.4f); break; case NogardGame.GameStateEnum.Story: if (StoryMode.IntroStory) { BackButton.DrawStandardButton(5, " Back", 0.5f); } else { ContinueButton.DrawStandardButton(5, " Continue", 0.5f); } break; case NogardGame.GameStateEnum.GameActive: break; case NogardGame.GameStateEnum.HighScoreView: BackButton.DrawStandardButton(5, " Back", 0.5f); break; case NogardGame.GameStateEnum.Pause: ResumeButton.DrawStandardButton(5, "Resume", 0.5f); PauseMenuButton.DrawStandardButton(5, "MainMenu", 0.5f); break; case NogardGame.GameStateEnum.GameOver: if (GameOverManager.ScoreForm.GameSaved == false) { SaveScoreButton.DrawStandardButton(5, "Save Score", 0.5f); } else { SaveScoreButton.DrawStandardButton(5, "Score saved", 0.45f); } MainMenuButton.DrawStandardButton(5, " MainMenu", 0.4f); QuitButton.DrawStandardButton(5, " Quit Game", 0.4f); break; case NogardGame.GameStateEnum.MapMaker: break; case NogardGame.GameStateEnum.LevelSelector: LevelOneButton.DrawStandardButton(5, " Level One", 0.5f); LevelTwoButton.DrawStandardButton(5, " Level Two", 0.5f); LevelThreeButton.DrawStandardButton(5, " Level Three", 0.5f); SelectorBackButton.DrawStandardButton(5, " Back", 0.4f); break; default: throw new ArgumentOutOfRangeException(); } }