public static void Draw <T>(IList <T> list, ItemName <T> itemName, ItemContent <T> itemContent = null, OnItemAdd onItemAdd = null, ItemContent <T> buttonsContentOverride = null, ItemContent <T> itemStartUI = null) { if (itemContent != null) { DrawFoldout(list, itemName, itemContent, buttonsContentOverride, itemStartUI); } else { DrawLabel(list, itemName, buttonsContentOverride, itemStartUI); } if (onItemAdd != null) { using (new SA_GuiBeginVertical()) { GUILayout.Space(-7); using (new SA_GuiBeginHorizontal()) { EditorGUILayout.Space(); bool add = GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(24)); if (add) { onItemAdd(); return; } GUILayout.Space(5); } } } }
public static void Draw <T>(IList <T> list, ItemName <T> itemName, ItemContent <T> itemContent = null, OnItemAdd onItemAdd = null) { if (onItemAdd != null) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); bool add = GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(20)); if (add) { onItemAdd(); return; } GUILayout.Space(5); EditorGUILayout.EndHorizontal(); } if (itemContent != null) { DrawFoldout(list, itemName, itemContent); } else { DrawLabel(list, itemName); } }
private void Clear_Click(object sender, RoutedEventArgs e) { FriendInfoList.Clear(); GroupInfoList.Clear(); DiscussionInfoList.Clear(); ItemContent.Clear(); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetItemContent retourne : /// la ligne associée à son id (iContentID) si celui-ci est spécifié /// la ligne la plus récemment modifiée associée à l'Item (itemId) /// </summary> /// <remarks> /// </remarks> /// <param name="itemId">l'ID de l'Item (FilInfo)</param> /// <param name="iContentID"></param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public ItemContent GetItemContent(int itemId, int iContentID = -1) { ItemContent t = null; try { if (MVCModuleBase.StringToInt(itemId.ToString()) > 0) { if (MVCModuleBase.StringToInt(iContentID.ToString()) > 0) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository <ItemContent>(); t = rep.GetById(iContentID, itemId); } } else { t = GetItemsContent(itemId).OrderByDescending(x => x.ModifDate).First(); } } } catch (Exception ex) { Exceptions.LogException(ex); } return(t); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetItemsToView charge les éléments du module à afficher filtrer sur la date de publication, la publication. /// C'est le num de version le plus grand de l'élément qui est chargé. /// Le tri s'effectue en fonction du paramètre SDFilInfo_Settings.sItemOrdre. /// </summary> /// <remarks> /// </remarks> /// <param name="ModuleId">ID de l'item </param> /// <param name="sOrder"></param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public IEnumerable <ItemContent> GetItemsToView(int ModuleId, string sOrder = "ASC") { IEnumerable <ItemContent> ts; List <ItemContent> tl = null; ItemContent t = null; StringBuilder sSQL = new StringBuilder(); using (IDataContext ctx = DataContext.Instance()) { IEnumerable <Item> its = ItemManager.Instance.GetItems( ItemManager.Instance.GetItemsSQLRequest( (sOrder.Equals("ASC", StringComparison.InvariantCultureIgnoreCase) ? "GetActiveItemsOrderByDateDePubASC" : "GetActiveItemsOrderByDateDePubDESC")) , ModuleId ); foreach (var it in its ?? Enumerable.Empty <Item>()) { t = ctx.ExecuteSingleOrDefault <ItemContent>(CommandType.Text, GetItemContentSQLRequest("GetItemsToView"), it.ItemId); if (tl == null) { tl = new List <ItemContent>(); } tl.Add(t); } ts = (IEnumerable <ItemContent>)tl; } return(ts ?? Enumerable.Empty <ItemContent>()); }
public void init(ItemContent content, int capacity) { this.content = new ItemContent(); this.currentlyHold = content.Count; content.CopyTo(this.content); this.capacity = capacity; }
/// <summary> /// Get played media index in the play list. /// </summary> /// <returns></returns> int GetPlayedMediaIndex() { if (this.listWindow == null) { return(this.PlayedMediaIndex); } else { if (this.listWindow.PlayedMediaItem != null) { ItemContent playedIc = this.listWindow.PlayedMediaItem.Content as ItemContent; if (playedIc != null) { for (int i = 0; i < this.listWindow.ListItems.Count; i++) { System.Windows.Controls.ListViewItem lvi = this.listWindow.ListItems[i] as System.Windows.Controls.ListViewItem; ItemContent ic = lvi.Content as ItemContent; if (ic.Code == playedIc.Code && ic.Name == playedIc.Name) { return(i); } } } //return this.listWindow.ListItems.IndexOf(this.listWindow.PlayedMediaItem); } return(-1); } }
public void LoadPlayList(ItemCollection items) { items.Clear(); string sql = @"select * from PlayLists where IsEnabled=1 and cast(GETDATE() as time(7)) between BeginTime and EndTime and (DeptId is null or DeptId = (select Value from NameCode where Type='LocalDept')) order by Code"; DataSet ds = SelectRows(sql); foreach (DataRow dr in ds.Tables[0].Rows) { ListViewItem lvi = new ListViewItem(); ItemContent itemContent = new ItemContent(); itemContent.Name = dr["Name"].ToString(); itemContent.MediaType = MediaType.NotPlayed; itemContent.Code = dr["Code"].ToString(); //itemContent.BeginTime = dr["BeginTime"].ToString(); //itemContent.EndTime = dr["EndTime"].ToString(); lvi.Content = itemContent; lvi.Tag = Path.Combine(this.libraryDirectory, itemContent.Name); items.Add(lvi); } }
private void OpenBox(GameSession session, ItemContent content) { // Currency if (content.Id.ToString().StartsWith("9")) { switch (content.Id) { case 90000001: // Meso session.Player.Wallet.Meso.Modify(content.Amount); break; case 90000004: // Meret case 90000011: // Meret case 90000015: // Meret case 90000016: // Meret session.Player.Wallet.Meret.Modify(content.Amount); break; } } // Items else { Item item = new Item(content.Id) { Amount = content.Amount }; InventoryController.Add(session, item, true); } }
/// <summary> /// Adds the update story. /// </summary> /// <param name="category">The category.</param> /// <param name="content">The content.</param> /// <returns>ItemContent.</returns> public ItemContent AddUpdateStory(Category category, ItemContent content) { using (var scope = provider.CreateScope()) { return(scope.ServiceProvider.GetService <DbContext>() .AddOrUpdate(content, w => w.CreatedBy == content.CreatedBy && w.Title == content.Title)); } }
/// ----------------------------------------------------------------------------- /// <summary> /// DeleteItemContent supprime une ligne à la table MVCTest_Items_Content /// </summary> /// <remarks> /// </remarks> /// <param name = "t">la ligne à supprimer</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public void DeleteItemContent(ItemContent t) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository <ItemContent>(); rep.Delete(t); } }
public void AddContent(ItemContent con) { var eve = con.Item.userEvent; eve.PointerDown = HeadPointDown; eve.Drag = HeadDrag; eve.DragEnd = HeadDragEnd; control.AddContent(con); }
public Menu(IEnumerable <string> items, bool isInputMenu) // Itererar över elementet { Items = items.ToArray(); // Gör om till en array for (int i = 0; i < Items.Count; i++) { ItemContent.Add(""); } this.isInputMenu = isInputMenu; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/>. /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { // TODO: Create an appropriate data model for your problem domain to replace the sample data. var item = await DataSource.GetItemAsync((string)e.NavigationParameter); this.DefaultViewModel["Item"] = item; ItemContent.Navigate(new Uri("ms-appx-web:///" + item.DataPath)); }
public ItemContent(ItemContent toCopy) { myName = toCopy.myName; myType = toCopy.myType; mySubType = toCopy.mySubType; myDescription = toCopy.myDescription; unlocked = toCopy.unlocked; goldValue = toCopy.goldValue; improved = toCopy.improved; cursed = toCopy.cursed; equipConstraint = toCopy.equipConstraint; nbHands = toCopy.nbHands; faceNames = toCopy.faceNames; faceValues = toCopy.faceValues; faceEffects = toCopy.faceEffects; faceEffectsValues = toCopy.faceEffectsValues;// Careful with those lists... target = toCopy.target; damageReduction = toCopy.damageReduction; effect = toCopy.effect; effectValues = toCopy.effectValues; effectRange = toCopy.effectRange; }
public static Item CreateItem(int id, string createdBy, Category category, ItemContent itemContent) { return(new Item { Id = id, CreatedBy = createdBy, Category = category, ItemContent = itemContent }); }
public static Item CreateItem(int id, string createdBy, Category category, ItemContent itemContent ) { return new Item { Id = id, CreatedBy = createdBy, Category = category, ItemContent = itemContent }; }
public static Item CreateItem(int id, string createdBy, Category category, ItemContent itemContent) { return new Item { Id = id, CreatedBy = createdBy, Category = category, ItemContent = itemContent, CreatedDate = System.DateTime.Now }; }
private void ItemContent_Navigating(object sender, NavigatingCancelEventArgs e) { if (e.Uri == null || e.Uri.ToString().Contains("msdn")) { return; } var page = FindPage(_root, e.Uri.ToString()); e.Cancel = true; ItemContent.NavigateToString(page); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="Common.NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { var item = await DataSource.GetItemAsync((string)e.NavigationParameter); this.DefaultViewModel["Item"] = item; //ItemContent.Navigate(new Uri("ms-appx-web:///Htmls/cc.html")); ItemContent.Navigate(new Uri("ms-appx-web:///" + item.DataPath)); // TODO: Assign a bindable group to this.DefaultViewModel["Group"] // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"] // TODO: Assign the selected item to this.flipView.SelectedItem }
private void Start() { if (this.content == null) { //to be load later this.currentlyHold = 0; this.content = new ItemContent(); this.capacity = 10; } else { this.currentlyHold = this.content.Count; } }
public void CreateListItem(Wedge wedge) { var item = Instantiate(listItemPrefab); item.transform.SetParent(content.transform, false); ItemContent newItemContent = new ItemContent(item.transform); newItemContent.ContentImage = Instantiate(wedge.Image); newItemContent.contentText.text = wedge.Value.ToString(); newItemContent.headerText.text = wedge.Name; items.Add(newItemContent); }
/// <summary> /// 标签页排列 /// </summary> /// <param name="obj"></param> public void OrderHeadLabel(ItemContent ic) { var w = ic.Label.data.sizeDelta.x; ic.Item.data.sizeDelta.x = w + 48; ic.Back.data.sizeDelta.x = w + 48; ic.Close.data.localPosition.x = w * 0.5f; ic.Item.IsChanged = true; ic.Back.IsChanged = true; ic.Close.IsChanged = true; if (control.panel != null) { control.panel.IsChanged = true; } }
public void CreateListItem(string title = "Title") { if (title.ToLower().Equals("id") || title.ToLower().Equals("") || title.ToLower().Replace("\"", "").Equals("id")) { return; } var item = Instantiate(listItemPrefab); item.transform.SetParent(content.transform, false); ItemContent newItemContent = new ItemContent(item.transform); newItemContent.headerText.text = title; items.Add(newItemContent); }
private static void DrawLabel <T>(IList <T> list, ItemName <T> itemName, ItemContent <T> buttonsContentOverride = null, ItemContent <T> itemStartUI = null) { int indentLevel = EditorGUI.indentLevel; int space = 10; if (indentLevel >= 1) { space += EditorGUI.indentLevel * 10; } EditorGUI.indentLevel = 0; foreach (var item in list) { using (new SA_GuiBeginHorizontal()) { GUILayout.Space(space); using (new SA_GuiBeginVertical(SA_Skin.BoxStyle)) { using (new SA_GuiBeginHorizontal()) { if (itemStartUI != null) { itemStartUI.Invoke(item); } EditorGUILayout.SelectableLabel(itemName(item), GUILayout.Height(16)); if (buttonsContentOverride != null) { buttonsContentOverride.Invoke(item); } else { bool ItemWasRemoved = DrawButtons(item, list); if (ItemWasRemoved) { return; } } } } } } EditorGUI.indentLevel = indentLevel; }
public static void GiveItem(GameSession session, ItemContent content) { Random rng = new Random(); // Currency if (content.Id.ToString().StartsWith("9")) { switch (content.Id) { case 90000001: // Meso session.Player.Wallet.Meso.Modify(rng.Next(content.MinAmount, content.MaxAmount)); break; case 90000004: // Meret case 90000011: // Meret case 90000015: // Meret case 90000016: // Meret session.Player.Wallet.Meret.Modify(rng.Next(content.MinAmount, content.MaxAmount)); break; } } // Items else { Item item = new Item(content.Id) { Amount = rng.Next(content.MinAmount, content.MaxAmount), Rarity = content.Rarity, Enchants = content.EnchantLevel, }; item.Stats = new ItemStats(item); InventoryController.Add(session, item, true); if (content.Id2 != 0) { item = new Item(content.Id2) { Amount = rng.Next(content.MinAmount, content.MaxAmount), Rarity = content.Rarity, }; item.Stats = new ItemStats(item); InventoryController.Add(session, item, true); } } }
public Item(ItemContent content) { myInfo = new ItemContent(content); myDice = new Dice(myInfo.faceNames, myInfo.faceValues, myInfo.faceEffects, myInfo.faceEffectsValues); myDice.myItem = this; if (myDice.myFaces.Count == 0) { myDice = null; } if (myInfo.effect != null) { myEffects.Add(new Effect(myInfo.effect, -1, myInfo.effectRange, myInfo.effectValues)); } myInfo.improved = 0; }
public void InitializeLoot(Character monster) { followerTab.SetActive(false); GameObject.Find("Background").GetComponent <LoreHandler>().ExecuteFromTrigger("Kill_" + monster.myInfo.myName, followerTab); List <Item> choices = new List <Item>(); if (forceLoot == null || forceLoot == "") { myLootDiceDisplayer.DisplayDice(lootDice); List <DiceFace> selected = lootDice.rollDistinctFaces(monster.myInfo.lootChoices); foreach (DiceFace aFace in selected) { Item newItem = null; switch (aFace.faceName) { case "GOLD": ItemContent content = new ItemContent(); content.myName = "Gold"; content.goldValue = monster.myInfo.lootValue; newItem = new Item(content); break; case "ITEM": newItem = SpawnRandomItem((monster.myInfo.myRarity == " - Champion") ? "Rare" : "Common"); newItem.SetOwner(thePlayer); break; } if (newItem.myInfo.myType == "Weapon" && Random.Range(0f, 1f) < 0.1f) { newItem.SetCurse(); } choices.Add(newItem); } } else { Item newItem = new Item(allItems[forceLoot]); newItem.SetOwner(thePlayer); choices.Add(newItem); forceLoot = null; } myLootChoiceDisplayer.DisplayItemCollection(choices); }
public ItemContent AddContent(string name) { var item = HGUIManager.GameBuffer.Clone(control.Item).GetComponent <UIElement>(); ItemContent con = new ItemContent(); con.Parent = control; con.Item = item; item.RegEvent <UserEvent>(); item.userEvent.PointerDown = HeadPointDown; item.userEvent.Drag = HeadDrag; item.userEvent.DragEnd = HeadDragEnd; item.userEvent.DataContext = con; var content = UICreator.CreateElement(Vector3.zero, Vector2.zero, "Content", control.Content.transform); content.marginType = MarginType.Margin; con.Content = content; con.Back = item.transform.Find("Image").GetComponent <HImage>(); con.Label = item.transform.Find("Text").GetComponent <HText>(); var txt = con.Label.GetComponent <HText>(); txt.Text = name; Vector2 v = txt.SizeDelta; txt.GetPreferredWidth(ref v, name); con.Back.SizeDelta = item.SizeDelta = new Vector2(v.x + 40, v.y); var clo = item.transform.Find("Close"); if (clo != null) { con.Close = clo.GetComponent <UIElement>(); con.Close.RegEvent <UserEvent>(); con.Close.userEvent.Click = CloseClick; con.Close.userEvent.DataContext = con; clo.localPosition = new Vector3(v.x * 0.5f + 8, 0, 0); } control.AddContent(con); return(con); }
/// <summary> /// Load play list from xml. /// </summary> public void LoadPlayList(ItemCollection items, string playListFileName) { items.Clear(); if (!File.Exists(this.GetPlayListPath(playListFileName))) { return; } //items.Clear(); XmlDocument doc = new XmlDocument(); doc.Load(this.GetPlayListPath(playListFileName)); XmlNodeList nodes = doc.GetElementsByTagName(Library.mediaTagName); foreach (XmlNode node in nodes) { ListViewItem lvi = new ListViewItem(); ItemContent itemContent = new ItemContent(); itemContent.Name = node.Attributes[Library.mediaNameAttributeName].Value; itemContent.Time = node.Attributes[Library.mediaTimeAttributeName].Value; string mediaType = node.Attributes[Library.mediaTypeAttributeName].Value; if (String.IsNullOrEmpty(mediaType)) { itemContent.MediaType = MediaType.NotPlayed; } else { itemContent.MediaType = (MediaType)Enum.Parse(typeof(MediaType), mediaType); } itemContent.Resolution = node.Attributes[Library.mediaResolutionAttributeName].Value; lvi.Content = itemContent; lvi.Tag = node.Attributes[Library.mediaFileAttributeName].Value; items.Add(lvi); } }
public ItemContent AddContent(string name) { ModelElement item = new ModelElement(); item.Load(control.Item.ModData); ItemContent con = new ItemContent(); con.Parent = control; con.Item = item; item.RegEvent <EventCallBack>(); item.baseEvent.PointerDown = HeadPointDown; item.baseEvent.Drag = HeadDrag; item.baseEvent.DragEnd = HeadDragEnd; item.baseEvent.DataContext = con; var t = ModelElement.CreateNew(name); t.data.SizeScale = true; t.data.marginType = MarginType.Margin; con.Content = t; con.Back = item.Find("Back"); con.Label = item.Find("Label"); var txt = con.Label.GetComponent <TextElement>(); txt.text = name; txt.AsyncGetTextSizeX((o, e) => { o.model.data.sizeDelta = e; OrderHeadLabel(con); }); con.Close = item.Find("Close"); if (con.Close != null) { con.Close.RegEvent <EventCallBack>(); con.Close.baseEvent.Click = CloseClick; con.Close.baseEvent.DataContext = con; } control.AddContent(con); return(con); }
public void CreateListItem(string title = "Title", string value = "Enter value") { if (title != null) { if (title.ToLower().Equals("id")) { return; } } var item = Instantiate(listItemPrefab); item.transform.SetParent(content.transform, false); ItemContent newItemContent = new ItemContent(item.transform); newItemContent.headerText.text = title; newItemContent.inputField.text = value; items.Add(newItemContent); }
public static Item CreateItem(string createdBy, Category category, ItemContent itemContent) { return CreateItem(-1, createdBy, category, itemContent); }