void OnEnable() { _instance = this; itemList.Clear(); // @ToDo: select items depending on NPC level and area foreach (Item itm in Service.db.Select <Item>("FROM item limit 0," + MAX_ITEMS)) { itemList.Add(itm); } ScrollableList scroll = scrollPanel.GetComponent <ScrollableList>(); scroll.itemCount = MAX_ITEMS; scroll.load(delegate(GameObject newItem, int num) { Item tItem = itemList[num]; Vector3 price = Util.formatMoney(tItem.price); newItem.SetActive(true); newItem.gameObject.transform.Find("Button/NameLabel").GetComponent <Text>().text = tItem.name; newItem.gameObject.transform.Find("Button/GalleonLabel").GetComponent <Text> ().text = price.x.ToString(); newItem.gameObject.transform.Find("Button/SickleLabel").GetComponent <Text> ().text = price.y.ToString(); newItem.gameObject.transform.Find("Button/KnutLabel").GetComponent <Text> ().text = price.z.ToString(); newItem.gameObject.transform.Find("Icon").GetComponent <RawImage> ().texture = tItem.icon; newItem.gameObject.transform.Find("Button").GetComponent <Button>().onClick.AddListener( delegate { selectedItem = tItem; }); return(newItem); }); updateMoney(); }
public override void Update() { AuroraUTP template = (AuroraUTP)placeable.template; // Load the items List <AuroraUIElement> items = new List <AuroraUIElement>(); foreach (AuroraUTP.AItem item in template.ItemList) { // Create an item instance for each item in the inventory // (this will be transferred into the player's inventory when they pick the item up) UnityEngine.Debug.Log("Loading item " + item.InventoryRes); Item uiItem = new Item(this.width, this.height * 2 / 9, AuroraEngine.Resources.LoadItem(item.InventoryRes)); uiItem.button.Clicked += (_, __) => PlayerTakeItem(item); uiItem.button.Clicked += (_, __) => placeable.OnInvDisturbed(); items.Add(uiItem); } // Create the scrollable list scroll = new ScrollableList(width, height * 2 / 3, items); // Create the buttons getItems = new Button(width, height / 12, "Get Items"); getItems.Clicked += GetAllItems; switchToGiveItems = new Button(width, height / 12, "Switch to Give Items"); switchToGiveItems.Clicked += SwitchToGiveItems; close = new Button(width, height / 12, "Close"); close.Clicked += Close; }
public override void OnEnter() { if (listPrefab.Value == null) { Finish(); return; } if (values == null || values.stringValues == null) { Finish(); return; } var items = new Dictionary <string, string>(); for (int i = 0; i < values.stringValues.Length; i++) { items.Add(values.stringValues[i], string.Empty); } var scrollableList = ScrollableList.Create(listPrefab.Value, uiTitle.Value, items); scrollableList.ItemSelected += OnScrollableListComplete; scrollableList.UIClosed += OnScrollableListClosed; }
public override void OnEnter() { if (listPrefab.Value == null) { Finish(); return; } if (titles == null) { Finish(); return; } var items = new Dictionary <string, string>(); for (int i = 0; i < titles.Length; i++) { string titleStr = titles[i].Value; string subtitleStr = subtitles != null && subtitles[i] != null ? subtitles[i].Value : string.Empty; items.Add(titleStr, subtitleStr); } var scrollableList = ScrollableList.Create(listPrefab.Value, uiTitle.Value, items); scrollableList.ItemSelected += OnScrollableListComplete; scrollableList.UIClosed += OnScrollableListClosed; }
void OnScrollableListComplete(ScrollableList list, string title, string subtitle) { list.ItemSelected -= OnScrollableListComplete; selectedTitle.Value = title; selectedSubtitle.Value = subtitle; Finish(); }
public IHttpActionResult Get(Query query) { query.Count = true; var result = IndexService.Search(query); var model = new ScrollableList <IndexDocument>(result, Request.RequestUri); return(Ok(model)); }
/// <summary> /// Initializiation /// </summary> private void Start() { if (Instance != null) { CustomLogger.Instance.Error(LogMessages.MULTIPLE_INSTANCES); return; } Instance = this; current_item = null; list = List_Panel.GetComponentInChildren <ScrollableList>(); List_Panel.SetActive(false); Info_Panel.SetActive(false); Item_Panel.SetActive(false); }
/// <summary> /// SDisplay the agents that are available for hire to the user. /// </summary> public void ShowAgentsToHire() { AgentCreator ac = GameObject.FindObjectOfType <AgentCreator>(); agentCanvas.SetActive(true); ScrollableList sl = agentCanvas.GetComponentInChildren <ScrollableList>(); sl.ClearList(); sl.CreateList(agentsForHire.Count, 1); for (int i = 0; i < agentsForHire.Count; i++) { SetAgentBoxData(sl.elements[i].transform, agentsForHire[i], Purpose.ShowAgentsToHire); } }
void OnMouseDown() { guiManager.gunMarketGUI.SetActive(true); ScrollableList sl = guiManager.gunMarketGUI.GetComponentInChildren <ScrollableList> (); sl.ClearList(); sl.CreateList(guns.Length, 1); for (int i = 0; i < guns.Length; i++) { Gun gun = guns[i]; sl.elements[i].transform.FindChild("Text").GetComponent <Text>().text = guns[i].name; sl.elements[i].transform.FindChild("Text - Price").GetComponent <Text>().text = "£" + guns[i].price; sl.elements[i].transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { AddEquipmentToPlayer(gun); }); } }
/// <summary> /// Updates the list of agents available for hire. This is global due to the nature of this object. /// </summary> public void UpdateHireList() { ScrollableList sl = agentCanvas.GetComponentInChildren <ScrollableList>(); sl.ClearList(); if (agentsForHire.Count > 0) { sl.CreateList(agentsForHire.Count, 1); for (int i = 0; i < agentsForHire.Count; i++) { SetAgentBoxData(sl.elements[i].transform, agentsForHire[i], Purpose.ShowAgentsToHire); } } }
/// <summary> /// Updates the agents that are currently in the office associated with this object. /// </summary> private void UpdateOfficeList() { ScrollableList sl = agentCanvas.GetComponentInChildren <ScrollableList>(); sl.ClearList(); if (safehouse.officeAgents.Count > 0) { sl.CreateList(safehouse.officeAgents.Count, 1); for (int i = 0; i < safehouse.officeAgents.Count; i++) { SetAgentBoxData(sl.elements[i].transform, safehouse.officeAgents[i], Purpose.ShowAgentsInOffice); } } }
public void LoadContent() { tilesets = WorldBuilderUtils.GetTileSets(SimulationGame.ContentManager.RootDirectory + "\\Tiles"); Bounds = new Rect(SimulationGame.Resolution.Width * 2 / 3, 0, SimulationGame.Resolution.Width / 3, SimulationGame.Resolution.Height); tilesetSelectionArea = new Rect(Bounds.X, Bounds.Y + 120, Bounds.Width - 10, Bounds.Height); backgroundOverlay = new Texture2D(SimulationGame.Graphics.GraphicsDevice, 1, 1); backgroundOverlay.SetData(new Color[] { Color.White }); placeView = new BaseUI() { Bounds = new Rect(0, 0, SimulationGame.Resolution.Width * 2 / 3, SimulationGame.Resolution.Height) }; placeView.OnKeyPress(Keys.Escape, () => { if (placementMode == PlacementMode.CreateFromTileset) { tileSetSelectionView.Deselect(); } }); placeView.OnClick(placeObjectAtPosition); selectedObjectDetailTextView = new TextView(tilesetSelectionArea, ""); worldPartDetailsTextView = new TextView(tilesetSelectionArea, ""); inspectView = new InspectView(new Rect(0, 0, SimulationGame.Resolution.Width * 2 / 3, SimulationGame.Resolution.Height)); inspectView.OnSelect(handleInspectGameObjectSelection, handleInspectBlockSelection, handleInspectWorldLinkSelection); tileSetSelectionView = new TileSetSelectionView(tilesetSelectionArea); tilesetSelectionList = new ScrollableList(tilesetSelectionArea); tilesetSelectionList.OnSelect((UIElement selectedElement) => { placementMode = PlacementMode.CreateFromTileset; tileSetSelectionView.SetTileSet(((Button)selectedElement).Text); }); manageObjectList = new ScrollableList(tilesetSelectionArea); foreach (var tileset in tilesets) { var button = new Button(tileset, Point.Zero); button.ShowBorder = false; tilesetSelectionList.AddElement(button); } // Block Type Button blockTypeBtn = new Button("Blocks", new Point(Bounds.X, Bounds.Y + 10)); blockTypeBtn.OnClick(() => { placementType = PlacementType.BlockPlacement; handleManageBtnClick(); }); // Ambient Object Type Button ambientObjectTypeBtn = new Button("Ambient Objects", new Point(blockTypeBtn.Bounds.Right + 10, Bounds.Y + 10)); ambientObjectTypeBtn.OnClick(() => { placementType = PlacementType.AmbientObjectPlacement; handleManageBtnClick(); }); // Ambient Hitable Object Type Button ambientHitableObjectTypeBtn = new Button("Hitable Objects", new Point(ambientObjectTypeBtn.Bounds.Right + 10, Bounds.Y + 10)); ambientHitableObjectTypeBtn.OnClick(() => { placementType = PlacementType.AmbientHitableObjectPlacement; handleManageBtnClick(); }); // Ambient Hitable Object Type Button livingEntityTypeBtn = new Button("Living Entities", new Point(ambientHitableObjectTypeBtn.Bounds.Right + 10, Bounds.Y + 10)); livingEntityTypeBtn.OnClick(() => { placementType = PlacementType.LivingEntityPlacement; handleManageBtnClick(); }); // World Part Details Button worldPartBtn = new Button("World Details", new Point(livingEntityTypeBtn.Bounds.Right + 10, Bounds.Y + 10)); worldPartBtn.OnClick(() => { placementType = PlacementType.WorldPartDetails; placementMode = PlacementMode.NoPlacement; }); // Manage Button manageBtn = new Button("Manage", new Point(Bounds.X, blockTypeBtn.Bounds.Bottom + 10)); manageBtn.OnClick(handleManageBtnClick); // Create From Json createFromJsonBtn = new Button("Create From Json", new Point(manageBtn.Bounds.Right + 10, blockTypeBtn.Bounds.Bottom + 10)); createFromJsonBtn.OnClick(createNewObjectFromJson); // Create From Tileset createFromTilesetBtn = new Button("Create From Tileset", new Point(createFromJsonBtn.Bounds.Right + 10, blockTypeBtn.Bounds.Bottom + 10)); createFromTilesetBtn.OnClick(() => placementMode = PlacementMode.ChooseTileset); // Edit Btn editBtn = new Button("Edit", new Point(Bounds.X, manageBtn.Bounds.Bottom + 10)); editBtn.OnClick(editObject); // Create New From Btn createNewFromBtn = new Button("Create New From", new Point(editBtn.Bounds.Right + 10, manageBtn.Bounds.Bottom + 10)); createNewFromBtn.OnClick(createNewFrom); // Remove Btn removeBtn = new Button("Remove", new Point(createNewFromBtn.Bounds.Right + 10, manageBtn.Bounds.Bottom + 10)); removeBtn.OnClick(removeObject); // Create If not exist Btn createIfNotExistBtn = new Button("Create If Not Exist", new Point(Bounds.X, manageBtn.Bounds.Bottom + 10)); createIfNotExistBtn.OnClick(createNewObjectIfNotExists); // Create Btn createBtn = new Button("Create New", new Point(createIfNotExistBtn.Bounds.Right + 10, manageBtn.Bounds.Bottom + 10)); createBtn.OnClick(createNewObject); // Edit Instance Btn editInstanceBtn = new Button("Edit", new Point(Bounds.X, manageBtn.Bounds.Bottom + 10)); editInstanceBtn.OnClick(handleEditInstanceBtnClick); // Remove Instance Btn removeInstanceBtn = new Button("Remove", new Point(editInstanceBtn.Bounds.Right + 10, manageBtn.Bounds.Bottom + 10)); removeInstanceBtn.OnClick(handleRemoveInstanceBtnClick); // Show Instance Type Btn showInstanceTypeBtn = new Button("Show Type", new Point(removeInstanceBtn.Bounds.Right + 10, manageBtn.Bounds.Bottom + 10)); showInstanceTypeBtn.OnClick(handleShowInstanceTypeBtnClick); // Change Persistency Btn changePersistencyBtn = new Button("Change Persistency", new Point(Bounds.X, worldPartBtn.Bounds.Bottom + 10)); changePersistencyBtn.OnClick(handleChangePersistencyBtn); // Create WorldLink Btn createWorldLinkBtn = new Button("Create Worldlink", new Point(changePersistencyBtn.Bounds.Right + 10, worldPartBtn.Bounds.Bottom + 10)); createWorldLinkBtn.OnClick(handleCreateWorldLinkBtn); // Create Interior Btn createInteriorBtn = new Button("Create Interior", new Point(createWorldLinkBtn.Bounds.Right + 10, worldPartBtn.Bounds.Bottom + 10)); createInteriorBtn.OnClick(handleCreateInteriorBtn); // Change Interior Dimensions Btn changeInteriorDimensionsBtn = new Button("Change Dimensions", new Point(Bounds.X, manageBtn.Bounds.Bottom + 10)); changeInteriorDimensionsBtn.OnClick(hanleChangeInteriorDimensionsBtn); // Delete Interior Btn removeInteriorBtn = new Button("Remove Interior", new Point(changeInteriorDimensionsBtn.Bounds.Right + 10, manageBtn.Bounds.Bottom + 10)); removeInteriorBtn.OnClick(handleRemoveInteriorBtn); OnKeyPress(Keys.Delete, handleRemoveInstanceBtnClick); OnRightClick(() => { if (placementMode == PlacementMode.CreateFromTileset) { placementMode = PlacementMode.ChooseTileset; } }); OnKeyPress(Keys.Back, () => { if (placementMode == PlacementMode.CreateFromTileset) { placementMode = PlacementMode.ChooseTileset; } }); AddElement(blockTypeBtn); AddElement(ambientObjectTypeBtn); AddElement(ambientHitableObjectTypeBtn); AddElement(livingEntityTypeBtn); AddElement(worldPartBtn); }
public void Add(ScrollableList guiScrollableList) { GuiScrollableList.Add(guiScrollableList); }
void Start() { attributesScript = GameObject.Find("Player").GetComponent<PlayerAttributes> (); scrollableList = GameObject.Find ("WeaponScroll").GetComponent<ScrollableList> (); sound = GameObject.Find ("Player").GetComponent<Sounds>(); }
void OnScrollableListClosed(ScrollableList list) { list.UIClosed -= OnScrollableListClosed; Finish(); }
public void UpdateImageList(Dictionary <Tuple <string, string>, string> profiles) { ScrollableList list = imageList.GetComponent <ScrollableList>(); list.LoadImages(profiles); }
public void Update_GUI() { foreach (KeyValuePair <TabType, Button> pair in tab_buttons) { GameObject.Destroy(pair.Value.gameObject); } tab_buttons.Clear(); foreach (KeyValuePair <TabType, GameObject> pair in tab_panels) { GameObject.Destroy(pair.Value); } tab_panels.Clear(); int index = 0; foreach (TabType tab in Enum.GetValues(typeof(TabType))) { //Button Button button = GameObject.Instantiate( Tab_Button_Prototype, new Vector3( Tab_Button_Prototype.transform.position.x + (Tab_Button_Prototype.GetComponent <RectTransform>().rect.width *index), Tab_Button_Prototype.transform.position.y, Tab_Button_Prototype.transform.position.z ), Quaternion.identity, Main_Panel.transform ); button.name = string.Format("{0}_button", tab.ToString()); button.gameObject.SetActive(true); button.GetComponentInChildren <Text>().text = tab.ToString(); Button.ButtonClickedEvent click = new Button.ButtonClickedEvent(); click.AddListener(new UnityAction(delegate() { Select_Tab(tab); })); button.onClick = click; tab_buttons.Add(tab, button); //Panel GameObject panel = GameObject.Instantiate( Tab_Panel_Prototype, new Vector3( Tab_Panel_Prototype.transform.position.x, Tab_Panel_Prototype.transform.position.y, Tab_Panel_Prototype.transform.position.z ), Quaternion.identity, Main_Panel.transform ); panel.name = string.Format("{0}_panel", tab.ToString()); panel.SetActive(true); tab_panels.Add(tab, panel); //Recipes string s; foreach (CraftingRecipe recipe in CraftingRecipePrototypes.Instance.Get_All_In(tab)) { ScrollableList list = panel.GetComponentInChildren <ScrollableList>(); list.Add_Row(recipe.Id.ToString(), new List <ScrollableList.TextData>() { new ScrollableList.TextData("NameText", Player.Current.Can_Craft(recipe, out s) ? recipe.Name : string.Format("<i>{0}</i>", recipe.Name), true) }, new List <ScrollableList.ImageData>() { new ScrollableList.ImageData("IconImage", recipe.Icon_Sprite, recipe.Icon_Sprite_Type, true) }, new List <ScrollableList.ButtonData>() { new ScrollableList.ButtonData("SelectButton", null, delegate() { Select_Recipe(recipe); }, true, true) }); } panel.SetActive(false); index++; } }
protected EquipMenuTab(EquipMenuComponent menuComponent) { MenuComponent = menuComponent; PlayerList = new ScrollableList(PLAYER_NAMES_VISIBLE, () => MenuEngine.Game.DataEngine.Players.Count()); }