private ItemResizePosition GetCurrentResizePosition(Point pos) { ItemResizePosition resizePosition = ItemResizePosition.None; if (ItemRegion != null) { RectangleF rect = ClientRectangle; rect.Size = ItemRegion.GetBounds().Size; //Right if (pos.X >= rect.Width - ResizeBorderWidth) { resizePosition = pos.Y >= rect.Height - ResizeBorderWidth ? ItemResizePosition.BottomRight : ItemResizePosition.Right; } else if (pos.Y >= rect.Height - ResizeBorderWidth) { resizePosition = ItemResizePosition.Bottom; } } return(resizePosition); }
public UnturnedItemDrop(ItemRegion region, ItemData itemData) { m_ItemData = itemData; Item = new UnturnedItem(itemData.item); Position = itemData.point.ToSystemVector(); Region = region; }
// 供GetBackColor(region)、GetTextColor(region)、GetBorderColor(region)调的私有函数 // parameters: // region 枚举值,取哪个区域 // valueStyle 枚举值,取哪种类型的值 // return: // Color对象 Color GetColor(ItemRegion region, ValueStyle valueStyle) { XmlEditor editor = this.m_document; if (editor.VisualCfg == null) { goto END1; } VisualStyle style = editor.VisualCfg.GetVisualStyle(this, region); if (style == null) { goto END1; } if (valueStyle == ValueStyle.BackColor) { return(style.BackColor); } else if (valueStyle == ValueStyle.TextColor) { return(style.TextColor); } else if (valueStyle == ValueStyle.BorderColor) { return(style.BorderColor); } END1: //缺省值 if (valueStyle == ValueStyle.BackColor) { if (region == ItemRegion.Text) { return(editor.BackColorDefaultForEditable); } else if (this is AttrItem) { return(editor.AttrBackColorDefault); } else { return(editor.BackColorDefault); } } else if (valueStyle == ValueStyle.TextColor) { return(editor.TextColorDefault); } else if (valueStyle == ValueStyle.BorderColor) { return(editor.BorderColorDefault); } else { return(Color.Red); } }
// 获取数值 public int GetDigitalValue(ValueStyle valueStyle) { Item item = this.GetItem(); if (item == null) { return(0); } ItemRegion region = GetRegionName(); if (region == ItemRegion.No) { return(0); } if (valueStyle == ValueStyle.LeftBlank) { return(item.GetLeftBlank(region)); } if (valueStyle == ValueStyle.RightBlank) { return(item.GetRightBlank(region)); } if (valueStyle == ValueStyle.TopBlank) { return(item.GetTopBlank(region)); } if (valueStyle == ValueStyle.BottomBlank) { return(item.GetBottomBlank(region)); } if (valueStyle == ValueStyle.TopBorderHeight) { return(item.GetTopBorderHeight(region)); } if (valueStyle == ValueStyle.BottomBorderHeight) { return(item.GetBottomBorderHeight(region)); } if (valueStyle == ValueStyle.LeftBorderWidth) { return(item.GetLeftBorderWidth(region)); } if (valueStyle == ValueStyle.RightBorderWidth) { return(item.GetRightBorderWidth(region)); } return(0); }
public UnturnedItemDrop(byte regionX, byte regionY, ItemData itemData) { m_ItemData = itemData; Item = new UnturnedItem(itemData.item, DestroyAsync); Position = itemData.point.ToSystemVector(); RegionX = regionX; RegionY = regionY; Region = ItemManager.regions[RegionX, RegionY]; }
public static void Untrack(byte x, byte y, int index) { if (!Dedicator.isDedicated) { return; } ItemRegion itemRegion = ItemManager.regions[x, y]; GameObject.Destroy(itemRegion.drops[index].model.gameObject); itemRegion.drops.RemoveAt(index); }
public UnturnedItemDrop(ItemData itemData) { m_ItemData = itemData; Item = new UnturnedItem(itemData.item, DestroyAsync); Position = itemData.point.ToSystemVector(); GetRegion(itemData, out var x, out var y); RegionX = x; RegionY = y; Region = ItemManager.regions[RegionX, RegionY]; }
public Font GetFont() { Item item = this.GetItem(); if (item == null) { return(null); } ItemRegion region = GetRegionName(); return(item.GetFont(region)); }
public static void Reset(byte x, byte y, List <ItemData> data) { ItemRegion itemRegion = ItemManager.regions[x, y]; for (int i = itemRegion.drops.Count - 1; i >= 0; i--) { Untrack(x, y, i); } foreach (ItemData item in data) { Track(item, item.point); } }
public static void Track(ItemData itemData, Vector3 point) { if (!Dedicator.isDedicated) { return; } byte x; byte y; if (Regions.tryGetCoordinate(point, out x, out y)) { Item item = itemData.item; ItemManager.manager.spawnItem(x, y, item.id, item.amount, item.quality, item.state, point, itemData.instanceID); ItemRegion region = ItemManager.regions[x, y]; } }
private void DestroyGraphics() { if (BufferBitmap != null) { BufferBitmap.Dispose(); Buffer.Dispose(); _controlGraphics.Dispose(); ItemRegion.Dispose(); foreach (IItemControl control in ControlsOnScreen.Values) { control.Dispose(); } ControlsOnScreen.Clear(); ControlUnderCursor = null; } }
// 获取颜色 public Color GetColor(ValueStyle valueStyle) { Item item = this.GetItem(); ItemRegion region = GetRegionName(); if (valueStyle == ValueStyle.BackColor) { return(item.GetBackColor(region)); } if (valueStyle == ValueStyle.BorderColor) { return(item.GetBorderColor(region)); } return(Color.Red); // 代表错误 }
public void Execute(IRocketPlayer caller, string[] command) { int itemCount = 0; for (int i = 0; i < ItemManager.ItemRegions.GetLength(0); i++) { for (int j = 0; j < ItemManager.ItemRegions.GetLength(1); j++) { ItemRegion region = ItemManager.ItemRegions[i, j]; foreach (SDG.Unturned.ItemData item in region.items) { item.LastDropped = float.MinValue; item.IsDropped = true; itemCount++; } } } UnturnedChat.Say(caller, U.Translate("command_clear_success", itemCount)); }
// 供GetBackColor(region)、GetTextColor(region)、GetBorderColor(region)调的私有函数 // parameters: // region 枚举值,取哪个区域 // valueStyle 枚举值,取哪种类型的值 // return: // Color对象 Color GetColor(ItemRegion region,ValueStyle valueStyle) { XmlEditor editor = this.m_document; if (editor.VisualCfg == null) goto END1; VisualStyle style = editor.VisualCfg.GetVisualStyle(this,region); if (style == null) goto END1; if (valueStyle == ValueStyle.BackColor ) return style.BackColor ; else if (valueStyle == ValueStyle.TextColor ) return style.TextColor ; else if (valueStyle == ValueStyle.BorderColor ) return style.BorderColor ; END1: //缺省值 if (valueStyle == ValueStyle.BackColor) { if (region == ItemRegion.Text) return editor.BackColorDefaultForEditable; else if (this is AttrItem) return editor.AttrBackColorDefault; else return editor.BackColorDefault; } else if (valueStyle == ValueStyle.TextColor ) { return editor.TextColorDefault; } else if (valueStyle == ValueStyle.BorderColor ) { return editor.BorderColorDefault; } else { return Color.Red; } }
// 得到字体 // parameters: // region 枚举值,哪个区域的字体 // return: // Font对象 public Font GetFont(ItemRegion region) { XmlEditor editor = this.m_document; if (editor.VisualCfg == null) { goto END1; } VisualStyle style = editor.VisualCfg.GetVisualStyle(this, region); if (style == null) { goto END1; } return(style.Font); END1: return(editor.FontTextDefault); }
public Color GetBorderColor(ItemRegion region) { return GetColor(region, ValueStyle.BorderColor ); }
public int GetBottomBorderHeight(ItemRegion region) { return this.GetPixelValue(region,ValueStyle.BottomBorderHeight); }
public int GetRightBorderWidth(ItemRegion region) { return this.GetPixelValue(region,ValueStyle.RightBorderWidth); }
public int GetBottomBlank(ItemRegion region) { return GetPixelValue(region,ValueStyle.BottomBlank ); }
public Color GetTextColor(ItemRegion region) { return GetColor(region,ValueStyle.TextColor); }
// 供尺寸值得调的私有函数. // parameters: // region 枚举值,取哪个区域 // valueStyle 枚举值,取哪种类型的值 int GetPixelValue(ItemRegion region, ValueStyle valueStyle) { XmlEditor editor = this.m_document; if (editor == null) { goto END1; } if (editor.VisualCfg == null) { goto END1; } VisualStyle style = editor.VisualCfg.GetVisualStyle(this, region); if (style == null) { goto END1; } if (valueStyle == ValueStyle.LeftBlank) { return(style.LeftBlank); } else if (valueStyle == ValueStyle.RightBlank) { return(style.RightBlank); } else if (valueStyle == ValueStyle.TopBlank) { return(style.TopBlank); } else if (valueStyle == ValueStyle.BottomBlank) { return(style.BottomBlank); } else if (valueStyle == ValueStyle.TopBorderHeight) { return(style.TopBorderHeight); } else if (valueStyle == ValueStyle.BottomBorderHeight) { return(style.BottomBorderHeight); } else if (valueStyle == ValueStyle.LeftBorderWidth) { return(style.LeftBorderWidth); } else if (valueStyle == ValueStyle.RightBorderWidth) { return(style.RightBorderWidth); } END1: //缺省值 if (valueStyle == ValueStyle.LeftBlank) { if (region == ItemRegion.ExpandAttributes || region == ItemRegion.ExpandContent) { return(2); //? } else { return(0); } } else if (valueStyle == ValueStyle.RightBlank) { if (region == ItemRegion.ExpandAttributes || region == ItemRegion.ExpandContent) { return(2); // ? } else { return(0); } } else if (valueStyle == ValueStyle.TopBlank) { return(0); } else if (valueStyle == ValueStyle.BottomBlank) { return(0); } else if (valueStyle == ValueStyle.TopBorderHeight) { return(-1); } else if (valueStyle == ValueStyle.BottomBorderHeight) { return(-1); } else if (valueStyle == ValueStyle.LeftBorderWidth) { return(-1); } else if (valueStyle == ValueStyle.RightBorderWidth) { return(-1); } return(0); }
public int GetTopBlank(ItemRegion region) { return GetPixelValue(region,ValueStyle.TopBlank ); }
// 供尺寸值得调的私有函数. // parameters: // region 枚举值,取哪个区域 // valueStyle 枚举值,取哪种类型的值 int GetPixelValue(ItemRegion region,ValueStyle valueStyle) { XmlEditor editor = this.m_document; if (editor == null) goto END1; if (editor.VisualCfg == null) goto END1; VisualStyle style = editor.VisualCfg.GetVisualStyle(this,region); if (style == null) goto END1; if (valueStyle == ValueStyle.LeftBlank) return style.LeftBlank ; else if (valueStyle == ValueStyle.RightBlank) return style.RightBlank ; else if (valueStyle == ValueStyle.TopBlank) return style.TopBlank ; else if (valueStyle == ValueStyle.BottomBlank) return style.BottomBlank ; else if (valueStyle == ValueStyle.TopBorderHeight) return style.TopBorderHeight; else if (valueStyle == ValueStyle.BottomBorderHeight) return style.BottomBorderHeight; else if (valueStyle == ValueStyle.LeftBorderWidth) return style.LeftBorderWidth; else if (valueStyle == ValueStyle.RightBorderWidth) return style.RightBorderWidth; END1: //缺省值 if (valueStyle == ValueStyle.LeftBlank ) { if (region == ItemRegion.ExpandAttributes || region == ItemRegion.ExpandContent ) return 2; //? else return 0; } else if (valueStyle == ValueStyle.RightBlank) { if (region == ItemRegion.ExpandAttributes || region == ItemRegion.ExpandContent ) return 2; // ? else return 0; } else if (valueStyle == ValueStyle.TopBlank) return 0; else if (valueStyle == ValueStyle.BottomBlank ) return 0; else if (valueStyle == ValueStyle.TopBorderHeight) { return -1; } else if (valueStyle == ValueStyle.BottomBorderHeight) { return -1; } else if (valueStyle == ValueStyle.LeftBorderWidth) { return -1; } else if (valueStyle == ValueStyle.RightBorderWidth) { return -1; } return 0; }
// 得到字体 // parameters: // region 枚举值,哪个区域的字体 // return: // Font对象 public Font GetFont(ItemRegion region) { XmlEditor editor = this.m_document; if (editor.VisualCfg == null) goto END1; VisualStyle style = editor.VisualCfg.GetVisualStyle (this,region); if (style == null) goto END1; return style.Font ; END1: return editor.FontTextDefault; }
public int GetBottomBorderHeight(ItemRegion region) { return(this.GetPixelValue(region, ValueStyle.BottomBorderHeight)); }
public Color GetBorderColor(ItemRegion region) { return(GetColor(region, ValueStyle.BorderColor)); }
private void RefreshItems() { for (byte x = 0; x < Regions.WORLD_SIZE; x++) { for (byte y = 0; y < Regions.WORLD_SIZE; y++) { ItemRegion currentItemRegion = ItemManager.regions[x, y]; List <ItemData> droppedItems = new List <ItemData>(); if (!Configuration.Instance.clearPlayerItems) { if (currentItemRegion.items.Count > 0) { for (int i = 0; i < currentItemRegion.items.Count; i++) { if (currentItemRegion.items[i].isDropped) { droppedItems.Add(currentItemRegion.items[i]); } } } } List <int> currentRegionSpawnsIndexes = new List <int>(); for (int i = 0; i < LevelItems.spawns[x, y].Count; i++) { currentRegionSpawnsIndexes.Add(i); } ItemManager.askClearRegionItems(x, y); long itemsSpawnedCount = 0; if (!Configuration.Instance.clearPlayerItems) { for (var i = 0; i < droppedItems.Count; i++) { ItemManager.dropItem(droppedItems[i].item, droppedItems[i].point, false, true, false); } } if (currentRegionSpawnsIndexes.Count <= 0) { continue; } while (currentRegionSpawnsIndexes.Count > 0 && (double)LevelItems.spawns[(int)x, (int)y].Count * spawnChance > (double)itemsSpawnedCount) { int randomIndex = UnityEngine.Random.Range(0, currentRegionSpawnsIndexes.Count); ItemSpawnpoint randomSpawn = LevelItems.spawns[x, y][currentRegionSpawnsIndexes[randomIndex]]; currentRegionSpawnsIndexes.RemoveAt(randomIndex); ushort itemId = LevelItems.getItem(randomSpawn); if (itemId == 0) { continue; } var newItem = new Item(itemId, false); ItemManager.dropItem(newItem, randomSpawn.point, false, false, false); itemsSpawnedCount++; } } } }
public int GetTopBlank(ItemRegion region) { return(GetPixelValue(region, ValueStyle.TopBlank)); }
public int GetBottomBlank(ItemRegion region) { return(GetPixelValue(region, ValueStyle.BottomBlank)); }
public int GetRightBorderWidth(ItemRegion region) { return(this.GetPixelValue(region, ValueStyle.RightBorderWidth)); }
public int GetRightBlank(ItemRegion region) { return GetPixelValue(region,ValueStyle.RightBlank ); }
public UnturnedItemDrop(ItemRegion region, ItemDrop itemDrop) { Item = new UnturnedItem(itemDrop.interactableItem.item); Transform = new UnityTransform(itemDrop.model); Region = region; }
public Color GetTextColor(ItemRegion region) { return(GetColor(region, ValueStyle.TextColor)); }