public void SetSlotUiItem(ItemSlot slot, Item item) { UiItem uiItem = Instantiate(uiItemPrefab, slot.transform); slot.uiItem = uiItem; uiItem.Initialize(item); }
public ItemSlotData(UiItem uiItem, SlotTypes slotType, Transform physicalItemLocation, InventoryUi inventoryUi) { this.uiItem = uiItem; this.slotType = slotType; this.physicalItemLocation = physicalItemLocation; this.inventoryUi = inventoryUi; }
private void UiFile_ItemRemoved(UiItem item, UiItem parentItem) { //Remove view UiItemView itemView = dataToViewDict[item]; UiTreeView.NotifyItemRemoved(itemView); itemView.DetachParent(); dataToViewDict.Remove(item); }
public void ClearSlotUiItem(ItemSlot slot) { UiItem item = slot.GetComponentInChildren <UiItem>(); if (item) { Destroy(item.gameObject); } }
private void Awake() { selectedItem = GameObject.FindGameObjectWithTag("SelectedItem").GetComponent <UiItem>(); spriteImage = GetComponent <Image>(); textMeshPro = GetComponentInChildren <TextMeshProUGUI>(); UpdateItem(null, 0); amountItems = 0; }
void Awake() { m_rContainer = GameObject.FindGameObjectWithTag("RecipeContainer").GetComponent <SerializableDictionaryExample>(); cSpell = GameObject.FindGameObjectWithTag("EventSystem").GetComponent <CheckSpell>(); // get AudioManager object audio = GameObject.FindObjectOfType <AudioManager>(); myItem = GameObject.FindObjectOfType <UiItem>(); }
public override void OnStart() { base.OnStart(); targetUi = UiManager.UiDict[targetUiName]; srcPosition = targetUi.RectTransform.anchoredPosition; srcRotation = targetUi.RectTransform.localRotation.z; srcSizeDelta = targetUi.RectTransform.sizeDelta; srcAlpha = targetUi.Alpha; }
private void UiItemListController_RemoveItemButtonClick() { UiItemView[] selectedItems = UiTreeView.SelectedItemSet.Select(item => (UiItemView)item).ToArray(); foreach (UiItemView itemView in selectedItems) { UiItem data = itemView.Data; UiFile.RemoveUiItem(data); } }
private void DetachUiItem() { if (EditingUiItem == null) { return; } this.EditingUiItem = null; EditorViewContext.Children.Clear(); }
public void SelectMenu(params string[] path) { string pathForLog = ""; foreach (var pathitem in path) { pathForLog = String.Concat(pathForLog, $"{pathitem} => "); } LoggerUtil.Info($"Selecting {pathForLog} in {ItemName}"); UiItem.MenuItem(path).Click(); }
internal static void SetUiItemType(UiItem uiItem) { try { uiItem.Type = EnumHelper.GetIdByName <UiItemType>(uiItem.TypeName); } catch (Exception ex) { throw new ArgumentException("\n>> " + TypeName + ".SetUiItemType Error: " + ex.Message); } }
private void AttachUiItem(UiItem uiItem) { DetachUiItem(); EditingUiItem = uiItem; if (uiItem == null) { return; } ValueEditorUtility.CreateValueEditorViews(uiItem, EditorViewContext, ViewportTab.UiItemDetailPanel_UiItemValueChanged); }
private void UiTreeView_ItemMoved(ITreeItem itemView, ITreeFolder oldParentView, ITreeFolder newParentView, int index) { //Data에 적용하기 UiItem item = ((UiItemView)itemView).Data; UiItem newParentItem = ((UiItemView)newParentView).Data; UiItemView oldParentItemView = (oldParentView as UiItemView); if (oldParentItemView != null) { oldParentItemView.Data.RemoveChildItem(item); } newParentItem.InsertChildItem(index, item); ItemMoved?.Invoke(item, newParentItem, oldParentItemView.Data); }
void Start() { uiItem = GetComponent <UiItem>(); FollowCursor[] followCursor = FindObjectsOfType <FollowCursor>(); foreach (FollowCursor item in followCursor) { if (item.tag == "Infopanel") { infoPanel = item.gameObject; tooltipText = item.GetComponentInChildren <TextMeshProUGUI>(); } } }
public override void GetTableUiItems(EjTable ejtable) { base.GetTableUiItems(ejtable); var GoToSave = new UiItem { Name = "محدوده مکانی در نقشه GPS", UiItemType = UiItemType.Link }; GoToSave.CustomUrl = $@"/{CurrentArea}/{CurrentController}/WorkplaceInMap"; // Delete.CustomUrl =$@"/{CurrentArea}/Api/{CurrentController}Api/Delete";; ejtable.UiTableItems.Add(new UiTableItem { EjTable = ejtable, UiItem = GoToSave }); }
private void UiFile_ItemCreated(UiItem item, UiItem parentItem) { UiItemView itemView = new UiItemView(item); if (parentItem == null) { //Create root itemView.SetRootItem(); RootItemView = itemView; UiTreeView.ChildItemCollection.Add(itemView); UiTreeView.ManualRootFolder = itemView; } else { itemView.ParentItem = dataToViewDict[parentItem]; } //Add to collection dataToViewDict.Add(item, itemView); //Register events item.ChildInserted += Data_ChildInserted; item.ChildRemoved += Data_ChildRemoved; void Data_ChildInserted(int index, UiItem childItem) { UiItemView childItemView = dataToViewDict[childItem]; itemView.ChildItemCollection.Insert(index, childItemView); } void Data_ChildRemoved(UiItem childItem, UiItem currentItem) { UiItemView childItemView = dataToViewDict[childItem]; itemView.ChildItemCollection.Remove(childItemView); } }
public override void GetTableUiItems(EjTable ejtable) { var UiItem = new UiItem { Name = "ثبت جدید", UiItemType = UiItemType.Link, CustomUrl = $@"/Absence/ObligatedRange/Index/#/absence/home" }; var delete = new UiItem { Name = "حذف", UiItemType = UiItemType.Delete, CustomUrl = $@"/{CurrentArea}/Api/{CurrentController}Api/Delete" }; ejtable.UiTableItems.Add(new UiTableItem { EjTable = ejtable, UiItem = UiItem }); ejtable.UiTableItems.Add(new UiTableItem { EjTable = ejtable, UiItem = delete }); }
public void OnDrop(PointerEventData eventData) { Draggable draggable = eventData.pointerDrag.GetComponent <Draggable>(); if (draggable && !GetComponentInChildren <Draggable>()) { UiItem uiItem = draggable.GetComponent <UiItem>(); if (uiItem.Item.compatibleSlots.HasFlag(slotType)) { inventoryUi.Inventory.CmdMoveItem( draggable.LastSlot.gameObject, draggable.LastSlot.slotType, gameObject, slotType, uiItem.Item.gameObject); draggable.LastSlot = this; } else { return; } draggable.ReturnParent = transform; } }
public CPropertyGUI(UiItem[][] pList) { //foreach (var lUiItems in pList) //{ // foreach (var lUiItem in lUiItems) // { // print(lUiItem.memberInfo.Name + " " // + lUiItem.uiType.verticalDepth // + lUiItem.uiType.horizontalDepth); // } //} uiList = new IPropertyGUI[pList.Length]; int i = 0; foreach (var lUiItems in pList) { //如果水平方向没有排序,则使用垂直显示,因为已经排序好,所以只用对比始末元素 if (lUiItems[0].uiType.horizontalDepth != lUiItems[lUiItems.Length - 1].uiType.horizontalDepth) uiList[i] = new HorizontalPropertyGUI(lUiItems); else uiList[i] = new VerticalPropertyGUI(lUiItems); ++i; } }
public virtual void GetTableUiItems(EjTable ejtable) { var GoToSave = new UiItem { Name = "ثبت جدید", UiItemType = UiItemType.GoToSave }; var Delete = new UiItem { Name = "حذف", UiItemType = UiItemType.Delete }; var items = new List <UiItem>(); GoToSave.CustomUrl = $@"/{CurrentArea}/{CurrentController}/ForEdit"; // Delete.CustomUrl =$@"/{CurrentArea}/Api/{CurrentController}Api/Delete";; Delete.CustomUrl = $@"/{CurrentArea}/{CurrentController}/Delete";; items.Add(GoToSave); items.Add(Delete); ejtable.UiTableItems.Add(new UiTableItem { EjTable = ejtable, UiItem = GoToSave }); ejtable.UiTableItems.Add(new UiTableItem { EjTable = ejtable, UiItem = Delete }); }
public HorizontalPropertyGUI(UiItem[] pList) { uiItemList = pList; }
public void AnalysisPageLeyout(XmlParam param) { XmlElement xmlRoot = GetXmlElement(param.xmlStr); ItemType type = ItemType.None; UiItem item = null; Page page = new Page(); Dictionary <string, UiItem> Items = new Dictionary <string, UiItem>(); Dictionary <string, UiItem> BtnItems = new Dictionary <string, UiItem>(); //Debug.Log("AnalysisPageLeyout: " + param.xmlStr); if (xmlRoot["rec_list"] != null) { foreach (XmlNode leyout in xmlRoot["rec_list"].ChildNodes) { type = ItemType.None; if (leyout.Attributes["res_file_url"] != null) { type = ItemType.RawImage; } else if (leyout.Attributes["resource_aside"] != null) { type = ItemType.Text; } else if (leyout.Attributes["prod_id"] != null && leyout.Attributes["prod_id"].Value != "0") { type = ItemType.Link; } //Debug.Log(leyout.Attributes["layout_code"].Value); switch (type) { case ItemType.Text: item = new UiItem(type, leyout.Attributes["resource_aside"].Value, leyout.Attributes["layout_code"].Value, leyout.Attributes["layout_id"].Value); //Debug.Log(leyout.Attributes["layout_code"].Value + ": " + leyout.Attributes["resource_aside"].Value); Items.Add(item.leyoutCode, item); break; case ItemType.RawImage: item = new UiItem(type, leyout.Attributes["res_file_url"].Value, leyout.Attributes["layout_code"].Value, leyout.Attributes["layout_id"].Value); //Debug.Log(leyout.Attributes["layout_code"].Value + ": " + leyout.Attributes["res_file_url"].Value); Items.Add(item.leyoutCode, item); break; case ItemType.Link: item = new UiItem(type, leyout.Attributes["prod_id"].Value, leyout.Attributes["layout_code"].Value, leyout.Attributes["layout_id"].Value); //Debug.Log("Link:" + leyout.Attributes["layout_code"].Value + " -> " + leyout.Attributes["prod_id"].Value); BtnItems.Add(item.leyoutCode, item); break; case ItemType.Audio: break; case ItemType.Video: break; case ItemType.None: break; } } } page.Items = Items; page.ButtonItems = BtnItems; page.ModelNumber = int.Parse(param.book.bookInfoDictionary[param.PageID].ModelNummber); //Debug.Log("Nummber = " + page.ModelNumber); page.PageTab = param.book.IdDictionary[param.PageID]; page.ID = param.PageID; page.AudioUrl = param.book.IDList[param.book.IdDictionary[param.PageID]].AudioUrl; page.Name = param.book.IDList[param.book.IdDictionary[param.PageID]].PageName; page.Sequ = param.book.IDList[param.book.IdDictionary[param.PageID]].Ordinal; //Debug.Log(page.PageTab + ":-> " + page.AudioUrl); param.book.PageList.Add(page); //Debug.Log(page.PageTab + "[BtnItemsCount]:" + page.ButtonItems.Count.ToString()); _loadingPageLeyout = false; }
public VerticalPropertyGUI(UiItem[] pList) { uiItemList = pList; }
private void UiOutlinerTab_ItemMoved(UiItem item, UiItem newParentItem, UiItem oldParentItem) { RenderAll(true, true); }
public void EquipPress() { int id = selectedItem.GetItemId(); if( selectedItem.GetType() == UiItem.Type.Equipment ) { EquipmentData item = GameManager.equipmentList.GetEquipment( id ); if( item.type == EquipmentData.Type.Head ) { //GameManager.instance.head = item; GameManager.instance.head = GameManager.equipmentList.GetEquipment( id ); headE = Instantiate( selectedItem, headSlot.position, Quaternion.identity ) as UiItem; headE.transform.parent = headSlot; } else if( item.type == EquipmentData.Type.Body ) { //GameManager.instance.body = item; GameManager.instance.body = GameManager.equipmentList.GetEquipment( id ); bodyE = Instantiate( selectedItem, bodySlot.position, Quaternion.identity ) as UiItem; bodyE.transform.parent = bodySlot; } else if( item.type == EquipmentData.Type.Feet ) { //GameManager.instance.feet = item; GameManager.instance.feet = GameManager.equipmentList.GetEquipment( id ); feetE = Instantiate( selectedItem, feetSlot.position, Quaternion.identity ) as UiItem; feetE.transform.parent = feetSlot; } } else if( selectedItem.GetType() == UiItem.Type.Weapon ) { GameManager.instance.weapon = GameManager.equipmentList.GetWeapon( id ); weapon1E = Instantiate( selectedItem, weapon1Slot.position, Quaternion.identity ) as UiItem; weapon1E.transform.parent = weapon1Slot; } //Debug.Log ("pressedEquip"); }
private void UiFile_ItemRemoved(UiItem item, UiItem parentItem) { RenderAll(true, true); }
public void SelectTabItem(string itemName) { LoggerUtil.Info($"Selecting {itemName} from {UiItem.Name} tab"); UiItem.SelectTabPage(itemName); }
public void Add(UiItem pUiItem) { int lIndex = pUiItem.uiType.verticalDepth; List<UiItem> lList; if (!mData.TryGetValue(lIndex, out lList)) { lList = new List<UiItem>(); mData[lIndex] = lList; } lList.Add(pUiItem); }
private void Start() { uiItem = GetComponent <UiItem>(); }
public UiItemView(UiItem data) : this() { this.Data = data; }
public void ProcessChanges(List <Script> allScripts) { var xml = UiItem.GetAttributeValue <string>(ItemUpdateAttribute) ?? UiItem.GetAttributeValue <string>(ItemAttribute); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); if (Type == "Form event" || Type == "Subgrid event") { if (Action == ScriptAction.Create) { XmlNode eventNode = null; XmlNode eventsNode; if (Event == "ontabstatechange") { var tabNode = doc.SelectSingleNode("//tab[@id='" + AttributeLogicalName + "']"); if (tabNode == null) { throw new Exception($"Unable to find tab Node with id {AttributeLogicalName}"); } eventsNode = tabNode.GetOrCreateNode("events"); eventNode = eventsNode.SelectSingleNode("event[@application='false' and @name='tabstatechange']"); } else { eventsNode = doc.FirstChild.GetOrCreateNode("events"); if (Event == "onchange") { if (Type == "Form event") { eventNode = eventsNode.SelectSingleNode( "event[@application='false' and @name='onchange' and @attribute='" + AttributeLogicalName + "']"); } else { var parts = AttributeLogicalName.Split(':'); eventNode = eventsNode.SelectSingleNode( "event[@application='false' and @name='onchange' and @attribute='" + parts[1] + "' and @control='" + parts[0] + "']"); } } else if (Event == "onload" || Event == "onsave" || Event == "onrecordselect") { if (Type == "Form event") { eventNode = eventsNode.SelectSingleNode( "event[@application='false' and @name='" + Event + "']"); } else { eventNode = eventsNode.SelectSingleNode( "event[@application='false' and @name='" + Event + "' and @control='" + AttributeLogicalName + "']"); } } } if (eventNode == null) { eventNode = eventsNode.AppendNewNode("event", new Dictionary <string, string> { { "name", Event == "ontabstatechange" ? "tabstatechange" : Event }, { "application", "false" }, { "active", "false" } } ); if (Type == "Form event" && Event == "onchange") { eventNode.AddAttribute("attribute", AttributeLogicalName); } if (Type == "Subgrid event") { var parts = AttributeLogicalName.Split(':'); eventNode.AddAttribute("relationship", ""); eventNode.AddAttribute("control", parts[0]); if (Event == "onchange") { eventNode.AddAttribute("attribute", parts[1]); } ; } eventsNode.AppendChild(eventNode); } var handlersNode = eventNode.GetOrCreateNode("Handlers"); handlersNode.AppendNewNodeAtIndex("Handler", new Dictionary <string, string> { { "functionName", MethodCalled }, { "libraryName", Library }, { "handlerUniqueId", Guid.NewGuid().ToString("B").ToLower() }, { "enabled", (Enabled ?? false).ToString().ToLower() }, { "parameters", Parameters }, { "passExecutionContext", (PassExecutionContext ?? false).ToString().ToLower() } }, NewOrder ?? Order); } else { var parts = AttributeLogicalName.Split(':'); var handlerNode = doc.SelectSingleNode("//event[@name='" + Event + (Event == "onchange" ? "' and @attribute='" + (parts.Length > 1 ? parts[1] : AttributeLogicalName) : "") + "'" + (Type == "Subgrid event" ? " and @control='" + parts[0] + "'" : "") + "]/Handlers/Handler[@libraryName='" + Library + "' and @functionName='" + MethodCalled + "']"); if (handlerNode == null) { throw new Exception("Cannot find Handler node"); } if (Action == ScriptAction.Delete) { var handlersNode = handlerNode.ParentNode; var eventNode = handlersNode.ParentNode; var eventsNode = eventNode.ParentNode; if (handlersNode.ChildNodes.Count > 1) { handlersNode.RemoveChild(handlerNode); } else { eventNode.ParentNode.RemoveChild(eventNode); } if (eventsNode.ChildNodes.Count == 0) { eventsNode.ParentNode.RemoveChild(eventsNode); } } else if (Action == ScriptAction.Update) { if (NewEnabled.HasValue) { handlerNode.Attributes["enabled"].Value = NewEnabled.Value ? "true" : "false"; } if (!string.IsNullOrEmpty(NewParameters)) { handlerNode.Attributes["parameters"].Value = NewParameters; } if (!string.IsNullOrEmpty(NewLibrary)) { handlerNode.Attributes["libraryName"].Value = NewLibrary; } if (!string.IsNullOrEmpty(NewMethodCalled)) { handlerNode.Attributes["functionName"].Value = NewMethodCalled; } if (NewPassExecutionContext.HasValue) { handlerNode.Attributes["passExecutionContext"].Value = NewPassExecutionContext.Value ? "true" : "false"; } if (NewOrder.HasValue) { var eventScripts = allScripts.Where(s => s.Type == Type && s.Event == Event && s.UiItem.Id == UiItem.Id && s.AttributeLogicalName == AttributeLogicalName) .OrderBy(s => s.NewOrder ?? s.Order); var parentNode = handlerNode.ParentNode; List <XmlNode> nodes = new List <XmlNode>(); foreach (var eventScript in eventScripts) { var esParts = eventScript.AttributeLogicalName.Split(':'); var node = doc.SelectSingleNode("//event[@name='" + eventScript.Event + (eventScript.Event == "onchange" ? "' and @attribute='" + (esParts.Length > 1 ? esParts[1] : eventScript.AttributeLogicalName) : "") + "'" + (eventScript.Type == "Subgrid event" ? " and @control='" + esParts[0] + "'" : "") + "]/Handlers/Handler[@libraryName='" + eventScript.Library + "' and @functionName='" + eventScript.MethodCalled + "']"); //var node = doc.SelectSingleNode("//event[@name='" + eventScript.Event + (eventScript.Event == "onchange" ? "' and @attribute='" + eventScript.AttributeLogicalName : "") + "']/Handlers/Handler[@libraryName='" + // eventScript.Library + // "' and @functionName='" + eventScript.MethodCalled + "']"); if (node == null) { continue; } nodes.Add(node); parentNode.RemoveChild(node); } foreach (var node in nodes) { parentNode.AppendChild(node); } } } } } else if (Type == "Form Library") { if (Action == ScriptAction.Create) { var librariesNode = doc.FirstChild.GetOrCreateNode("formLibraries"); librariesNode.AppendNewNodeAtIndex("Library", new Dictionary <string, string> { { "name", Library }, { "libraryUniqueId", Guid.NewGuid().ToString("B").ToLower() }, }, NewOrder ?? Order); } else { var node = doc.FirstChild.SelectSingleNode("formLibraries/Library[@name = '" + Library + "']"); if (node == null) { throw new Exception("Unable to find Library node"); } if (Action == ScriptAction.Update) { if (!string.IsNullOrEmpty(NewLibrary)) { node.Attributes["name"].Value = NewLibrary; } if (NewOrder.HasValue) { var eventScripts = allScripts.Where(s => s.Type == Type && s.UiItem.Id == UiItem.Id) .OrderBy(s => s.NewOrder ?? s.Order); var parentNode = node.ParentNode; List <XmlNode> tempNodes = new List <XmlNode>(); foreach (var eventScript in eventScripts) { var tempNode = doc.FirstChild.SelectSingleNode("formLibraries/Library[@name = '" + eventScript.Library + "' or @name='" + eventScript.NewLibrary + "']"); if (tempNode == null) { continue; } tempNodes.Add(tempNode); parentNode.RemoveChild(tempNode); } foreach (var tempNode in tempNodes) { parentNode.AppendChild(tempNode); } } } else if (Action == ScriptAction.Delete) { var parentNode = node.ParentNode; parentNode.RemoveChild(node); if (parentNode.ChildNodes.Count == 0) { parentNode.ParentNode.RemoveChild(parentNode); } } } } else if (Type == "Homepage Grid event") { if (Action == ScriptAction.Create) { XmlNode eventNode = null; XmlNode eventsNode = doc.FirstChild.GetOrCreateNode("events"); if (Event == "onchange") { eventNode = eventsNode.SelectSingleNode( "event[@application='false' and @name='onchange' and @attribute='" + AttributeLogicalName + "']"); } else if (Event == "onsave" || Event == "onrecordselect") { eventNode = eventsNode.SelectSingleNode( "event[@application='false' and @name='" + Event + "']"); } if (eventNode == null) { eventNode = eventsNode.AppendNewNode("event", new Dictionary <string, string> { { "name", Event.ToLower() }, { "application", "false" }, { "active", "false" }, { "control", "Grids" }, { "relationship", "" } } ); if (Event == "onchange") { eventNode.AddAttribute("attribute", AttributeLogicalName); } } var handlersNode = eventNode.GetOrCreateNode("Handlers"); handlersNode.AppendNewNodeAtIndex("Handler", new Dictionary <string, string> { { "functionName", MethodCalled }, { "libraryName", Library }, { "handlerUniqueId", Guid.NewGuid().ToString("B").ToLower() }, { "enabled", (Enabled ?? false).ToString().ToLower() }, { "parameters", Parameters }, { "passExecutionContext", (PassExecutionContext ?? false).ToString().ToLower() } }, NewOrder ?? Order ); } else { var handlerNode = doc.SelectSingleNode("//event[@name='" + Event + (Event == "onchange" ? "' and @attribute='" + AttributeLogicalName : "") + "']/Handlers/Handler[@libraryName='" + Library + "' and @functionName='" + MethodCalled + "']"); if (handlerNode == null) { throw new Exception("Cannot find Handler node"); } if (Action == ScriptAction.Delete) { var handlersNode = handlerNode.ParentNode; var eventNode = handlersNode.ParentNode; var eventsNode = eventNode.ParentNode; if (handlersNode.ChildNodes.Count > 1) { handlersNode.RemoveChild(handlerNode); } else { eventNode.ParentNode.RemoveChild(eventNode); } if (eventsNode.ChildNodes.Count == 0) { eventsNode.ParentNode.RemoveChild(eventsNode); } } else if (Action == ScriptAction.Update) { if (NewEnabled.HasValue) { handlerNode.Attributes["enabled"].Value = NewEnabled.Value ? "true" : "false"; } if (!string.IsNullOrEmpty(NewParameters)) { handlerNode.Attributes["parameters"].Value = NewParameters; } if (!string.IsNullOrEmpty(NewLibrary)) { handlerNode.Attributes["libraryName"].Value = NewLibrary; } if (!string.IsNullOrEmpty(NewMethodCalled)) { handlerNode.Attributes["functionName"].Value = NewMethodCalled; } if (NewPassExecutionContext.HasValue) { handlerNode.Attributes["passExecutionContext"].Value = NewPassExecutionContext.Value ? "true" : "false"; } if (NewOrder.HasValue) { var eventScripts = allScripts.Where(s => s.Type == Type && s.Event == Event && s.UiItem.Id == UiItem.Id && s.AttributeLogicalName == AttributeLogicalName) .OrderBy(s => s.NewOrder ?? s.Order); var parentNode = handlerNode.ParentNode; List <XmlNode> nodes = new List <XmlNode>(); foreach (var eventScript in eventScripts) { var node = doc.SelectSingleNode("//event[@name='" + eventScript.Event + (eventScript.Event == "onchange" ? "' and @attribute='" + eventScript.AttributeLogicalName : "") + "']/Handlers/Handler[@libraryName='" + eventScript.Library + "' and @functionName='" + eventScript.MethodCalled + "']"); if (node == null) { continue; } nodes.Add(node); parentNode.RemoveChild(node); } foreach (var node in nodes) { parentNode.AppendChild(node); } } } } } else if (Type == "Homepage Grid Library") { if (Action == ScriptAction.Create) { var formLibrariesNode = doc.FirstChild.GetOrCreateNode("formLibraries"); formLibrariesNode.AppendNewNodeAtIndex("Library", new Dictionary <string, string> { { "name", Library }, { "libraryUniqueId", Guid.NewGuid().ToString("B").ToLower() } }, NewOrder ?? Order ); } else { var node = doc.SelectSingleNode("//Library[@name = '" + Library + "']"); if (node == null) { throw new Exception("Unable to find Library node"); } if (Action == ScriptAction.Update) { if (!string.IsNullOrEmpty(NewLibrary)) { node.Attributes["name"].Value = NewLibrary; } if (NewOrder.HasValue) { var eventScripts = allScripts.Where(s => s.Type == Type && s.UiItem.Id == UiItem.Id) .OrderBy(s => s.NewOrder ?? s.Order); var parentNode = node.ParentNode; List <XmlNode> tempNodes = new List <XmlNode>(); foreach (var eventScript in eventScripts) { var tempNode = doc.FirstChild.SelectSingleNode("//Library[@name = '" + eventScript.Library + "' or @name='" + eventScript.NewLibrary + "']"); if (tempNode == null) { continue; } tempNodes.Add(tempNode); parentNode.RemoveChild(tempNode); } foreach (var tempNode in tempNodes) { parentNode.AppendChild(tempNode); } } } else if (Action == ScriptAction.Delete) { var parentNode = node.ParentNode; parentNode.RemoveChild(node); if (parentNode.ChildNodes.Count == 0) { parentNode.ParentNode.RemoveChild(parentNode); } } } } else if (Type == "Grid Icon") { var node = doc.DocumentElement.SelectSingleNode("row/cell[@name='" + AttributeLogicalName + "']"); if (node == null) { throw new Exception($"Unable to find cell node for attribute {AttributeLogicalName}"); } if (Action == ScriptAction.Update || Action == ScriptAction.Create) { if (!string.IsNullOrEmpty(NewLibrary)) { if (node.Attributes["imageproviderwebresource"] == null) { node.AddAttribute("imageproviderwebresource", $"$webresource:{NewLibrary}"); } else { node.Attributes["imageproviderwebresource"].Value = $"$webresource:{NewLibrary}"; } } if (!string.IsNullOrEmpty(NewMethodCalled)) { if (node.Attributes["imageproviderfunctionname"] == null) { node.AddAttribute("imageproviderfunctionname", NewMethodCalled); } else { node.Attributes["imageproviderfunctionname"].Value = NewMethodCalled; } } } else if (Action == ScriptAction.Delete) { node.Attributes.Remove(node.Attributes["imageproviderwebresource"]); node.Attributes.Remove(node.Attributes["imageproviderfunctionname"]); } } else { return; } UiItem[ItemUpdateAttribute] = doc.OuterXml; }
public void SelectPress( GameObject item ) { selectedItem = item.GetComponent<UiItem>(); //Debug.Log( selectedItem.name ); }