public void InitItemBoard() { // 아이템 셀 초기화 SelectedItemCell = null; buyBtnText.text = ""; statText.text = ""; foreach (var itemCell in itemCells) { int price = 0; itemCell.SetInfo(null); } ItemCell.OnClickItem = OnClickItemProfile; int curStageIdx = GameData.Instance.playerInfo.stageIdx; int curLevelIdx = GameData.Instance.playerInfo.levelIdx; // 플레이어 저장 데이터에 현재 상점 정보가 없으면 새로 저장, 아이템 셀에 입력 if (!GameData.Instance.playerInfo.shopInfo.Any()) { for (int i = 0; i < GameData.Instance.stages[curStageIdx].levels[curLevelIdx].monsters.Length; ++i) { CharacterInfo characterInfo = GameData.Instance.CharacterInfos[GameData.Instance.stages[curStageIdx].levels[curLevelIdx].monsters[i]]; int price = GameData.Instance.stages[curStageIdx].levels[curLevelIdx].monstersPos[i]; ItemInfo itemInfo = new ItemInfo(characterInfo, price, i); itemCells[i].SetInfo(itemInfo); GameData.Instance.playerInfo.shopInfo.Add(itemInfo); } } else { // 아이템 셀에 입력 for (int i = 0; i < GameData.Instance.playerInfo.shopInfo.Count; ++i) { itemCells[i].SetInfo(GameData.Instance.playerInfo.shopInfo[i]); } } // 저장 GameData.Instance.SavePlayerData(); }
private void onClickNewBuild(Cell cell, TypeBuild type_build, ItemCell item_cell) { List <ValueClass> price = Const.getPriceForBuilding(type_build); if (GameManager.gameManager.enoughMoney(price)) { GameManager.gameManager.payMoney(price); cell.startBuilding(type_build); item_cell.init(cell);// update that item close(); } else { TooltipManager.tooltip_manager.startTooltip("Not enough money"); // TODO what not enough? } }
public void init(Cell cell, ItemCell item_cell) { List <TypeBuild> available = GameManager.gameManager.getAvailableBuild(); int count_availab_builds = available.Count; item_build_cells = new ItemBuildCell[count_availab_builds]; for (int i = 0; i < count_availab_builds; i++) { ItemBuildCell item_build_cell = Instantiate(item_build, root).GetComponent <ItemBuildCell>(); TypeBuild type_build = available[i]; item_build_cell.init(type_build); item_build_cell.btn.onClick.AddListener(() => onClickNewBuild(cell, type_build, item_cell)); item_build_cells[i] = item_build_cell; } }
public void init(Region region) { this.region = region; updateCountRobots(); txt_name_region.text = region.region_type.ToString(); updateEco(); region.onUpdateEcology = updateEco; item_cells = new ItemCell[region.cells.Count]; for (int i = 0; i < region.cells.Count; i++) { ItemCell item = Instantiate(item_cell, item_root); Cell cell = region.cells[i]; item_cells[i] = item; item.init(cell); } }
private void SetCell(ItemCell itemCell, int index) { BookCell item = itemCell as BookCell; if (item == null) { Main.Logger.Log("WarehouseItem出错。。。"); return; } ChildData[] childDatas = item.childDatas; for (int i = 0; i < columns; i++) { int idx = (index - 1) * columns + i; if (i < childDatas.Length) { ChildData childData = childDatas[i]; if (idx < data.Length) { int bookId = data[idx]; GameObject go = childData.gameObject; if (!go.activeSelf) { go.SetActive(true); } childData.setBook.SetBookId(bookId); } else { GameObject go = childData.gameObject; if (go.activeSelf) { go.SetActive(false); } } } else { Main.Logger.Log("数据出错。。。"); } } }
// Public public void SetParam(HotBarCell hotBarCell, BasePanel rootPanel) { base.SetParam(baseCell, rootPanel); if (hotBarCell.baseCell == null) { imageInnerIcon.gameObject.SetActive(false); return; } if (hotBarCell.baseCell is ItemCell) { ItemCell itemCell = hotBarCell.baseCell as ItemCell; imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + itemCell.item.iconName); imageInnerIcon.gameObject.SetActive(true); } if (hotBarCell.baseCell is SkillCell) { SkillCell skillCell = hotBarCell.baseCell as SkillCell; imageInnerIcon.sprite = Resources.Load <Sprite>("Icons/" + skillCell.skill.iconName); imageInnerIcon.gameObject.SetActive(true); } }
private void CreateItem(int index) { createitemobject(index, (obj) => { if (obj != null) { obj.transform.SetParent(_content.transform); obj.GetComponent <RectTransform>().pivot = new Vector2(0f, 1f); obj.GetComponent <RectTransform>().sizeDelta = new Vector2(cellWidth, cellHeight); obj.transform.localScale = scale; ItemCell itemcell = new ItemCell { _index = index, item = obj }; SetItemIndex(itemcell, index); updateItem(itemcell, index); _itemList.Add(itemcell); } }); }
private void SetData(ItemCell go, int index) { index = index - 1; int item_count = show_items.Count; for (int i = 0; i < child_count; i++) { int idx = index * child_count + i; go.transform.GetChild(i).gameObject.SetActive(idx < max_item); GongfaData item; if (idx < item_count) { item = show_items[idx]; } else { item = null; } go.transform.GetChild(i).GetComponent <GongfaItem>().SetItem(item, RoleData.mainRole, true); } }
private void BeginDragItemCell(ItemCell itemCell) { isDraging = true; //记录当前选中的格子 nowSelItem = itemCell; //创建一个拖动的图片 PoolMgr.GetInstance().GetObj("UI/imgIcon", (obj) => { nowSelItemImg = obj.GetComponent <Image>(); nowSelItemImg.sprite = itemCell.imgIcon.sprite; //设置父对象 改变缩小大小相关 nowSelItemImg.transform.SetParent(UIManager.GetInstance().canvas); nowSelItemImg.transform.localScale = Vector3.one; //入过异步加载结束,拖动就已经结束了,那么就直接隐藏 if (!isDraging) { PoolMgr.GetInstance().PushObj(nowSelItemImg.name, nowSelItemImg.gameObject); } }); }
protected override void OnAwake() { btnClose = transform.Find("Pivot/Btn_Close").gameObject; btnReturn = transform.Find("Top/Btn_Return").gameObject; btnArrange = transform.Find("Pivot/Btn_Arrange").gameObject; btnOneKeyToSell = transform.Find("Pivot/Btn_OneKeyToSell").gameObject; labBagNum = transform.Find("Pivot/BagNum").GetComponent <UILabel>(); labArrange = transform.Find("Pivot/Btn_Arrange/Label").GetComponent <UILabel>(); mBagMenus.Add(EBagType.ITEM, transform.Find("Tables/Tab_Item").gameObject); mBagMenus.Add(EBagType.CHIP, transform.Find("Tables/Tab_Chip").gameObject); mBagMenus.Add(EBagType.GEM, transform.Find("Tables/Tab_Gem").gameObject); mBagMenus.Add(EBagType.FASHION, transform.Find("Tables/Tab_Fashion").gameObject); mBagMenus.Add(EBagType.RUNE, transform.Find("Tables/Tab_Rune").gameObject); mBagMenus.Add(EBagType.TASK, transform.Find("Tables/Tab_Task").gameObject); mBagMenus.Add(EBagType.CARD, transform.Find("Tables/Tab_Fetter").gameObject); bagView = transform.Find("Pivot/Bag/View").GetComponent <UIScrollView>(); itemPrefab = transform.Find("Pivot/Bag/View/Prefab").gameObject; itemGrid = transform.Find("Pivot/Bag/View/Grid").GetComponent <UIGrid>(); int bagNum = GTDataManager.Instance.GetBagNum(); itemPrefab.SetActive(false); for (int i = 1; i <= bagNum; i++) { ItemCell item = new ItemCell(); item.itemBtn = NGUITools.AddChild(itemGrid.gameObject, itemPrefab); item.itemBtn.SetActive(true); itemGrid.AddChild(item.itemBtn.transform); item.itemBtn.name = i.ToString(); item.itemTexture = item.itemBtn.transform.Find("Texture").GetComponent <UITexture>(); item.itemQuality = item.itemBtn.transform.Find("Quality").GetComponent <UISprite>(); item.itemNum = item.itemBtn.transform.Find("Num").GetComponent <UILabel>(); item.itemChip = item.itemBtn.transform.Find("Chip").gameObject; item.itemChip.SetActive(false); mBagCells.Add(item); } SetBagToggleGroup(); }
/// <summary> /// 检查自身位置,并触发更新事件 /// </summary> private void CheckSeleObjPos() { //处理数字 int rowMin = seleGrid.ContainsKey(-1) ? -1 : 0; int rowMax = 3; if (rowNum > rowMax) { rowNum = rowMax; } if (rowNum < rowMin) { rowNum = rowMin; } Transform father; if (coluNum < 0) { father = GetControl <Image>("ArrowLeft").gameObject.transform; seleObj.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(120, 240); } else if (coluNum > 9) { father = GetControl <Image>("ArrowRight").gameObject.transform; seleObj.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(120, 240); } else { father = seleGrid[rowNum][coluNum].transform; seleObj.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(140, 140); } seleObj.transform.SetParent(father); seleObj.transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; ItemCell cell = father.GetComponent <ItemCell>(); EventCenter.Instance.EventTrigger <ItemInfo>("CurrentPosBadge", cell.GetItemInfo()); }
private void ShowCellView(int index) { Dictionary <int, XItem> bagData = GTDataManager.Instance.GetBagDataByBagType(mShow); ItemCell cell = mBagCells[index]; int pos = index + 1; XItem item = null; if (bagData.ContainsKey(pos)) { item = bagData[pos]; } if (item == null) { cell.Show(false); return; } cell.Show(true); cell.itemNum.text = item.Num > 1 ? item.Num.ToString() : string.Empty; GTItemHelper.ShowItemTexture(cell.itemTexture, item.Id); GTItemHelper.ShowItemQuality(cell.itemQuality, item.Id); cell.itemChip.SetActive(mShow == EBagType.CHIP); }
private void UnEquipItemToBoxInventory(DragAndDropParam dragAndDropParam) { EquipCell equipCell = dragAndDropParam.dropCell as EquipCell; ItemCell itemCell = dragAndDropParam.dropCell as ItemCell; PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>(); if (itemCell != null) { Debug.Log("Drop to stuck"); } else { panelBoxInventory.sceneObject.GetItemInventory().AddItem(equipCell.item); // Update Character Param CharacterParam.UpadateParam(equipCell.item); equipCell.item = null; } // Update Box Inventory Panel panelBoxInventory.UpdatePanel(panelBoxInventory.sceneObject); // Update All Panels UIBuilder.UpdateAllPanels(); }
public static void change(ItemCell itemCell) { if (org) { itemCell.labelThird.IsVisible = false; itemCell.labelName.BindingContext = new { Name = api.APIHandler.myFeed.organizations[number].NAME }; itemCell.labelDescription.BindingContext = new { Name = api.APIHandler.myFeed.organizations[number].USERNAME }; itemCell.labelThird.BindingContext = "12 Members"; itemCell.organization = api.APIHandler.myFeed.organizations[number]; itemCell.real = true; itemCell.type = 0; number++; if (api.APIHandler.myFeed.organizations.Count <= number) { number = 0; org = false; } } else { if (api.APIHandler.myFeed.events.Count <= number) { return; } itemCell.labelThird.IsVisible = true; itemCell.labelName.BindingContext = new { Name = api.APIHandler.myFeed.events[number].NAME }; itemCell.labelDescription.BindingContext = new { Name = api.APIHandler.myFeed.events[number].ORGANIZATION_NAME }; itemCell.labelThird.BindingContext = new { Name = api.APIHandler.myFeed.events[number].START_TIME }; itemCell._event = api.APIHandler.myFeed.events[number]; itemCell.real = true; itemCell.type = 1; number++; } }
public Organization() { Label nameLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, Text = "Acton Boxborough School District", HorizontalOptions = LayoutOptions.Center }; Label usernameLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), Text = "ABRSD", HorizontalOptions = LayoutOptions.Center }; Label descriptionLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Text = "Acton-Boxborough Regional High School (ABRHS) is an open enrollment high school in Acton, Massachusetts. A part of the Acton-Boxborough Regional School District, it serves the Massachusetts towns of Acton and Boxborough and has students in grades 9 through 12.", HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center }; Button joinButton = new Button { BackgroundColor = Color.FromHex("#3498DB"), BorderRadius = 0, TextColor = Color.White, Text = "Join", HeightRequest = 50, }; ObservableCollection <Group> groupedItems = new ObservableCollection <Group>(); Group group2 = new Group("Events", "DS"); foreach (var item in api.APIHandler.myFeed.events) { var iItem = new ItemCell() { BindingContext = new { FirstName = "John Doe", Mobile = "Xamarin" } }; group2.Add(iItem); } try { var testItem = new ItemCell(); testItem.labelName.Text = "Test abc"; group2.Add(testItem); group2.Add(testItem); group2.Add(testItem); } catch (Exception ex) { } groupedItems.Add(group2); ListView listview = new ListView() { HasUnevenRows = true, RowHeight = 80, IsGroupingEnabled = true, GroupDisplayBinding = new Binding("Name"), GroupShortNameBinding = new Binding("ShortName"), ItemTemplate = new DataTemplate(typeof(ItemCell)), GroupHeaderTemplate = new DataTemplate(typeof(HeaderView)), ItemsSource = groupedItems }; StackLayout headerLayout = new StackLayout { Padding = 10, Children = { nameLabel, usernameLabel, descriptionLabel, joinButton, } }; StackLayout testLayout = new StackLayout { Children = { headerLayout, listview } }; //Grid grid = new Grid() //{ // Children = // { // nameLabel, // usernameLabel, // //buttonLayout // }, // Padding = 10, // RowSpacing = 10, // ColumnSpacing = 10, // //ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(.5, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(.1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(.4, GridUnitType.Star) } }, // //RowDefinitions = { new RowDefinition { Height = 50 }, new RowDefinition { Height = 50 } } //}; ScrollView scrollView = new ScrollView() { Content = testLayout }; Content = scrollView; }
private void SetCell(ItemCell itemCell, int index) { // Main.Logger.Log(index.ToString() + "设置 itemCell。。。" + itemCell.ToString() + " pos=" + scrollRect.verticalNormalizedPosition.ToString()); ActorItem item = itemCell as ActorItem; if (item == null) { // Main.Logger.Log("WarehouseItem出错。。。"); return; } // Main.Logger.Log("数据长度:" + m_data.Length); ChildData[] childDatas = item.childDatas; for (int i = 0; i < lineCount; i++) { int idx = (index - 1) * lineCount + i; // Main.Logger.Log("循环" + i + "获取第【" + idx + "】个元素的数据"); if (i < childDatas.Length) { ChildData childData = childDatas[i]; GameObject go = childData.gameObject; if (idx < m_data.Length) { go.transform.parent.gameObject.SetActive(true); if (!go.activeSelf) { go.SetActive(true); } int num2 = m_data[idx]; itemCell.name = "Actor," + num2; // Main.Logger.Log("改名A:" + itemCell.name); if (itemCell.transform.childCount > i) { var child = itemCell.transform.GetChild(i); child.name = "Actor," + num2; // Main.Logger.Log("改名B:" + itemCell.name); //Toggle tog = child.GetComponent<Toggle>(); //tog.group = ActorMenu.instance.listActorsHolder.GetComponent<ToggleGroup>(); // Main.Logger.Log(ActorMenu.instance.acotrId +" "+ num2 + "判断是否选中:" + (ActorMenu.instance.acotrId == num2)); //tog.isOn = ActorMenu.instance.acotrId == num2; if (ActorMenu.instance.acotrId == num2 && ActorMenuActorListPatch.giveActorId == num2) { childData.Select(SelectState.All); } else if (ActorMenu.instance.acotrId == num2) { childData.Select(SelectState.Select); } else if (ActorMenuActorListPatch.giveActorId == num2) { childData.Select(SelectState.Give); } else { childData.Select(SelectState.Node); } Button btn = child.GetComponentInChildren <Button>(); btn.onClick.RemoveAllListeners(); btn.onClick.AddListener(delegate() { ActorMenu.instance.SetActorAttr(int.Parse(go.name.Split(',')[1])); }); } SetListActor component = childData.setListActor; component.SetActor(num2); // Main.Logger.Log("此处是一些处理 不同身份的人处理方式不同"); if (!ActorMenu.instance.isEnemy) { if (num2 == DateFile.instance.MianActorID()) { // Main.Logger.Log("主角"); component.SetInTeamIcon(true); component.SetInBuildingIcon(false); component.RestMoodFace(); component.listActorFavorText.text = ""; component.listActorSamsaraText.text = ""; } else if (DateFile.instance.acotrTeamDate.Contains(num2)) { // Main.Logger.Log("是出战队员"); component.SetInTeamIcon(true); component.SetInBuildingIcon(false); component.RestMoodFace(); } else if (DateFile.instance.ParseInt(DateFile.instance.GetActorDate(num2, 27, addValue: false)) == 1) { // Main.Logger.Log("不知道是啥"); component.SetInTeamIcon(false); component.SetInBuildingIcon(false); component.RestMoodFace(); } else if (DateFile.instance.ActorIsWorking(num2) != null) { // Main.Logger.Log("正在工作的?"); component.SetInTeamIcon(false); component.SetInBuildingIcon(true); component.RestMoodFace(); } else { // Main.Logger.Log("其他"); component.SetInTeamIcon(false); component.SetInBuildingIcon(false); component.RestMoodFace(); } } else { // Main.Logger.Log("敌人"); component.SetInTeamIcon(false); component.SetInBuildingIcon(false); component.RestMoodFace(); } } else { if (go.activeSelf) { go.SetActive(false); } } if (i == 0 && !go.transform.parent.gameObject.activeSelf) { go.transform.parent.gameObject.SetActive(true); } } else { // Main.Logger.Log("数据出错。。。"); } // Main.Logger.Log("人物设置完毕"); } }
private void SetCell(ItemCell itemCell, int index) { //Main.Logger.Log(index.ToString() + "设置 itemCell。。。" + itemCell.ToString() + " pos=" + scrollRect.verticalNormalizedPosition.ToString()); NpcItem item = itemCell as NpcItem; if (item == null) { //Main.Logger.Log("WarehouseItem出错。。。"); return; } ChildData[] childDatas = item.childDatas; for (int i = 0; i < Main.settings.numberOfColumns; i++) { int idx = (index - 1) * Main.settings.numberOfColumns + i; //Main.Logger.Log("循环"+i+"获取第几个元素的数据" + idx.ToString()); if (i < childDatas.Length) { ChildData childData = childDatas[i]; GameObject go = childData.gameObject; if (idx < m_data.Length) { int num4 = m_data[idx]; if (!go.activeSelf) { go.SetActive(true); } itemCell.name = "Actor," + num4; if (itemCell.transform.childCount > 0) { itemCell.transform.GetChild(0).name = "Actor," + num4; } childData.setPlaceActor.SetActor(num4, Main.showNpcInfo); //int key = num4; //int num3 = int.Parse(DateFile.instance.GetActorDate(key, 19, false)); //int num2 = int.Parse(DateFile.instance.GetActorDate(key, 20, false)); //int key2 = (num2 < 0) ? (1001 + int.Parse(DateFile.instance.GetActorDate(key, 14, false))) : 1001; //int gangValueId = DateFile.instance.GetGangValueId(num3, num2); //int actorFavor = DateFile.instance.GetActorFavor(false, DateFile.instance.MianActorID(), key, false, false); //string des = "======"+((actorFavor != -1) ? ActorMenu.instance.Color5(actorFavor, true, -1) : DateFile.instance.SetColoer(20002, DateFile.instance.massageDate[303][2], false)); //des += "\n======" + ((int.Parse(DateFile.instance.GetActorDate(key, 8, false)) != 1) ? DateFile.instance.SetColoer((int.Parse(DateFile.instance.GetActorDate(key, 19, false)) == 18) ? 20005 : 20010, DateFile.instance.GetActorName(key, false, false), false) : DateFile.instance.GetActorName(key, false, false)); //des += "\n======" + DateFile.instance.SetColoer(10003, DateFile.instance.GetGangDate(num3, 0), false) + ((num3 == 0) ? "" : DateFile.instance.SetColoer(20011 - Mathf.Abs(num2), DateFile.instance.presetGangGroupDateValue[gangValueId][key2], false)); //Main.Logger.Log(des); } else { if (go.activeSelf) { go.SetActive(false); } } if (i == 0 && !go.transform.parent.gameObject.activeSelf) { go.transform.parent.gameObject.SetActive(true); } } else { Main.Logger.Log("数据出错。。。"); } } }
public int GetItemIndex(ItemCell itemcell) { return(itemcell._index); }
void SetItemIndex(ItemCell itemcell, int value) { itemcell._index = value; itemcell.item.transform.localPosition = GetPosition(value); //print ("4444=="+itemcell.item.transform.position); }
public void Set(ItemCell cell) { textNickName.text = cell.item != null ? cell.item.name : ". . ."; textSkinType.text = cell.type.ToString(); }
public void OnValueChange(Vector2 pos) { if (_itemList == null) { return; } int index = GetPosIndex(); // if(issynchysis!=null) // Debug.Log("index:"+index+",list:"+_itemList.Count+"\n"); if (_index != index && index > -1) { _index = index; //计算不显示对象 for (int i = 0; i < _itemList.Count; i++) { ItemCell item = _itemList[i]; int itemIndex = GetItemIndex(item); if (itemIndex < index * maxPerLine || (itemIndex >= (index + viewCount) * maxPerLine)) { hideitems.Add(item); } } for (int i = 0; i < hideitems.Count; ++i) { _itemList.Remove(hideitems[i]); } //Debug.Log("index:" + index + ",hideitems:" + hideitems.Count); //计算显示对象 for (int i = _index * maxPerLine; i < (_index + viewCount) * maxPerLine; i++) { if (i < 0) { continue; } if (i > _dataCount - 1) { continue; } if (_itemList.Find(delegate(ItemCell item) { return(GetItemIndex(item) == i); }) == null) { if (hideitems.Count > 0) { //Debug.Log("get old imte :" + i); bool issys = false; if (issynchysis != null) { issys = issynchysis(hideitems[0]._index, i); } if (!issys) { ItemCell o = hideitems[0]; hideitems.Remove(o); _itemList.Add(o); SetItemIndex(o, i); updateItem(o, i); } else { Destroy(hideitems[0].item); hideitems.RemoveAt(0); CreateItem(i); } } else if (PoolItems.Count > 0) { //Debug.Log("get old pool :" + i); ItemCell o = PoolItems[0]; o.item.SetActive(true); PoolItems.RemoveAt(0); _itemList.Add(o); SetItemIndex(o, i); updateItem(o, i); } else { //print("create i:" + i + "\n"); CreateItem(i); } } } } else { //_content.position = Vector3.zero; } for (int i = 0; i < PoolItems.Count; ++i) { Destroy(PoolItems[i].item); } PoolItems.Clear(); }
public Event() { Label nameLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, Text = "Dodgeball Tournament", HorizontalOptions = LayoutOptions.Center }; Label usernameLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), Text = "Acton Boxborough Regional High School", HorizontalOptions = LayoutOptions.Center }; Label organizationLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Text = "5:30PM - 6:30PM (EST) on May 18, 2017", HorizontalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold, }; Label descriptionLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Text = "We are hosting a dodgeball tournament and need people to help organize it! We would love kids in grades 9-12", HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center }; Button joinButton = new Button { BackgroundColor = Color.FromHex("#3498DB"), BorderRadius = 0, TextColor = Color.White, Text = "Apply to Event", HeightRequest = 50, }; StackLayout headerLayout = new StackLayout { Padding = 10, Children = { nameLabel, usernameLabel, organizationLabel, descriptionLabel, joinButton, } }; ObservableCollection <Group> groupedItems = new ObservableCollection <Group>(); Group group2 = new Group("Similar Events", "DS"); foreach (var item in api.APIHandler.myFeed.events) { var iItem = new ItemCell() { BindingContext = new { FirstName = "John Doe", Mobile = "Xamarin" } }; group2.Add(iItem); } try { var testItem = new ItemCell(); testItem.labelName.Text = "Test abc"; group2.Add(testItem); group2.Add(testItem); group2.Add(testItem); } catch (Exception ex) { } groupedItems.Add(group2); ListView listview = new ListView() { HasUnevenRows = true, RowHeight = 80, IsGroupingEnabled = true, GroupDisplayBinding = new Binding("Name"), GroupShortNameBinding = new Binding("ShortName"), ItemTemplate = new DataTemplate(typeof(ItemCell)), GroupHeaderTemplate = new DataTemplate(typeof(HeaderView)), ItemsSource = groupedItems }; StackLayout testLayout = new StackLayout { Children = { headerLayout, listview } }; //Grid grid = new Grid() //{ // Children = // { // nameLabel, // usernameLabel, // //buttonLayout // }, // Padding = 10, // RowSpacing = 10, // ColumnSpacing = 10, // //ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(.5, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(.1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(.4, GridUnitType.Star) } }, // //RowDefinitions = { new RowDefinition { Height = 50 }, new RowDefinition { Height = 50 } } //}; ScrollView scrollView = new ScrollView() { Content = testLayout }; Content = scrollView; }
// Public public void SetParam(ItemCell itemCell, BasePanel rootPanel) { base.SetParam(itemCell, rootPanel); }
public HomePage() { Title = "Your Feed"; navigation = Navigation; ToolbarItem save = new ToolbarItem() { Text = "Create", Command = new Command(async(obj) => { var action = await DisplayActionSheet("What do you want to create?", "Cancel", null, "Organization", "Event"); switch (action) { case "Cancel": break; case "Organization": await Navigation.PushAsync(new Commservus_Mobile.organization.CreateOrganization()); break; case "Event": await DisplayAlert("Boop", "Event", "Beep"); break; } }) }; ToolbarItems.Add(save); footer = new Footer(); ObservableCollection <Group> groupedItems = new ObservableCollection <Group>(); Group group = new Group("Organizations", "SD"); foreach (var item in api.APIHandler.myFeed.organizations) { var iItem = new ItemCell(); iItem.Client.FirstName = item.NAME; iItem.Client.Mobile = item.USERNAME; group.Add(iItem); } Group group2 = new Group("Events", "DS"); foreach (var item in api.APIHandler.myFeed.events) { var iItem = new ItemCell() { BindingContext = new { FirstName = "John Doe", Mobile = "Xamarin" } }; iItem.Client.FirstName = item.NAME; iItem.Client.Mobile = item.LOCATION; group2.Add(iItem); } groupedItems.Add(group); groupedItems.Add(group2); ListView listview = new ListView() { HasUnevenRows = true, RowHeight = 80, IsGroupingEnabled = true, GroupDisplayBinding = new Binding("Name"), GroupShortNameBinding = new Binding("ShortName"), ItemTemplate = new DataTemplate(typeof(ItemCell)), GroupHeaderTemplate = new DataTemplate(typeof(HeaderView)), ItemsSource = groupedItems }; layout = new StackLayout() { Children = { listview, footer } }; this.Content = layout; }
private void SetCell(ItemCell itemCell, int index) { if (actor) { int num2 = DateFile.instance.MianActorID(); bool flag = !Main.settings.remoteWarehouse; if (flag) { flag = HomeSystem.instance.homeMapPartId != DateFile.instance.mianPartId || HomeSystem.instance.homeMapPlaceId != DateFile.instance.mianPlaceId; } WarehouseItem item = itemCell as WarehouseItem; if (item == null) { Main.Logger.Log("WarehouseItem出错。。。"); return; } ChildData[] childDatas = item.childDatas; for (int i = 0; i < Main.settings.numberOfColumns; i++) { int idx = (index - 1) * Main.settings.numberOfColumns + i; if (i < childDatas.Length) { ChildData childData = childDatas[i]; if (idx < m_data.Length) { int num3 = m_data[idx]; GameObject go = childData.gameObject; if (!go.activeSelf) { go.SetActive(true); } go.name = "ActorItem," + num3; childData.setItem.SetWarehouseItemIcon(num2, num3, int.Parse(DateFile.instance.GetItemDate(num3, 3, true)) != 1 || flag); } else { GameObject go = childData.gameObject; if (go.activeSelf) { go.SetActive(false); } } } else { Main.Logger.Log("数据出错。。。"); } } } else { int num4 = -999; bool cantTake = !Main.settings.remoteWarehouse; if (cantTake) { cantTake = HomeSystem.instance.homeMapPartId != DateFile.instance.mianPartId || HomeSystem.instance.homeMapPlaceId != DateFile.instance.mianPlaceId; } WarehouseItem item = itemCell as WarehouseItem; if (item == null) { Main.Logger.Log("WarehouseItem出错。。。"); return; } ChildData[] childDatas = item.childDatas; for (int i = 0; i < Main.settings.numberOfColumns; i++) { int idx = (index - 1) * Main.settings.numberOfColumns + index - 1 + i; if (i < childDatas.Length) { ChildData childData = childDatas[i]; if (idx < m_data.Length) { int num5 = m_data[idx]; GameObject go = childData.gameObject; if (!go.activeSelf) { go.SetActive(true); } go.name = "WarehouseItem," + num5; childData.setItem.SetWarehouseItemIcon(num4, num5, cantTake); } else { GameObject go = childData.gameObject; if (go.activeSelf) { go.SetActive(false); } } } else { Main.Logger.Log("数据出错。。。"); } } } }
private void ActionCellDrop(DragAndDropParam dragAndDropParam) { // Stop Prev Action StopAllCoroutines(); /// Hot Bar if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelHotBar") { // Drop Cell if (dragAndDropParam.dropCell == null) { return; } // Create Action StartCoroutine(StartAction(0, dragAndDropParam, this.DropCellToHotBar)); } /// Equip from Character Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacter" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacterInventory") { if (dragAndDropParam.dropCell is EquipCell) { // Drop Cell if (dragAndDropParam.dropCell == null || dragAndDropParam.dropCell.baseCell != null) { return; } EquipCell equipCell = dragAndDropParam.dropCell as EquipCell; ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Cell Not Empty if (equipCell.equipType != itemCell.item.itemType || equipCell.item != null) { return; } // Create Action StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.EquipItemFromICharacterInventory)); } } /// Equip from Box Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacter" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelBoxInventory") { if (dragAndDropParam.dropCell is EquipCell) { // Drop Cell if (dragAndDropParam.dropCell == null || dragAndDropParam.dropCell.baseCell != null) { return; } EquipCell equipCell = dragAndDropParam.dropCell as EquipCell; ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Cell Not Empty if (equipCell.equipType != itemCell.item.itemType || equipCell.item != null) { return; } // Create Action StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.EquipItemFromIBoxInventory)); } } /// UnEquip to Character Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacterInventory" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacter") { EquipCell equipCell = dragAndDropParam.dragCell as EquipCell; // Full Inventory if (!CharacterParam.itemInventory.IsAdd(equipCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.UnEquipItemToCharacterInventory)); } /// UnEquip to Box Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelBoxInventory" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacter") { EquipCell equipCell = dragAndDropParam.dragCell as EquipCell; PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>(); // Full Inventory if (!panelBoxInventory.sceneObject.GetItemInventory().IsAdd(equipCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.UnEquipItemToBoxInventory)); } /// Drop from Box Inventory to Character Inventory if (dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelBoxInventory" && dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacterInventory") { ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Full Inventory if (!CharacterParam.itemInventory.IsAdd(itemCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.DropToCharacterInventoryFromBoxInventory)); } /// Drop from Character Inventory to Box Inventory if (dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacterInventory" && dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelBoxInventory") { ItemInventory itemInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>().sceneObject.GetItemInventory(); ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Full Inventory if (!itemInventory.IsAdd(itemCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.DropToBoxinventoryFromCharacterInventory)); } }