public static ChatEvent HoverShowItem(SlotItem item) { return new ChatEvent() { Action = "show_item", Value = "{id:" + item.ItemID + ",Damage:" + item.Uses + ",Count:" + item.Count + "}", }; }
public static void GetRules(Client c) { var si = new SlotItem(BlockID.BookAndQuill, 1, 0); si.Data = Content; var s = new SetSlot(0, 36, si); c.Queue.Queue(s); }
//unconditional emptying out public virtual void EmptySlot() { if (filledItem!=null) { MapManager.main.GetTown().TakeStashItem(filledItem.assignedItem); //{PartyManager.mainPartyManager.RemoveItems(filledItem.assignedItem);} } filledItem=null; }
protected override void Parse(EndianBinaryReader r) { WindowID = r.ReadByte(); Slot = r.ReadInt16(); RightClick = r.ReadSByte(); ActionID = r.ReadInt16(); Shift = r.ReadSByte(); Item = SlotItem.Read(r); }
public void SetTarget(SlotItem.Type target) { for (int i = 0; i < slotItems.Count; i++) { if (slotItems[i].IsTarget(targetIndex)) { targetItem = slotItems[i].transform; } } STOP_ROUND_COUNT = UnityEngine.Random.Range(5, 8); startCount = true; }
public void OnEndDrag(PointerEventData eventData) { if (draggable) { GetComponent<CanvasGroup>().blocksRaycasts=true; transform.SetParent(currentSlot.transform,false); transform.position=transform.parent.position; itemBeingDragged=null; } }
public void OnBeginDrag(PointerEventData eventData) { if (draggable) { itemBeingDragged=this; //makes sure OnDrop fires correctly for all objects GetComponent<CanvasGroup>().blocksRaycasts=false; transform.SetParent(transform.GetComponentInParent<Canvas>().transform,false);//PartyStatusCanvasHandler.main.transform); } }
public override bool CheckItem(SlotItem newSlotItem) { bool allowItem = false; if (newSlotItem.currentSlot.GetType() != this.GetType()) { //check if type is appropriate if (newSlotItem.assignedItem.GetType().BaseType == typeof(Weapon)) allowItem = true; } return allowItem; }
public override bool CheckItem(SlotItem newSlotItem) { bool assignItem=false; if (newSlotItem.currentSlot.GetType()!=this.GetType()) { //The PickUpItem check adds the item to the party member on True by itself if (InventoryScreenHandler.mainISHandler.selectedMember.CanPickUpItem()) {assignItem=true;} } return assignItem; }
public ShipSlot(SlotItem item, int maximum, int current) { if (item == null) { this.Item = SlotItem.Dummy; } else { this.Item = item; } this.Maximum = maximum; this.Current = current; }
public override bool CheckItem(SlotItem newSlotItem) { bool allowItem=false; if (newSlotItem.currentSlot.GetType()!=this.GetType()) { //check if type is appropriate if (newSlotItem.assignedItem.GetType().BaseType==typeof(RangedWeapon)) { //check if party member can equip (prevents equpping multiple flashlights or armor vests //InventoryScreenHandler.mainISHandler.selectedMember.EquipWeapon(newSlotItem.assignedItem as Weapon); allowItem=true; } } return allowItem; }
public override bool CheckItem(SlotItem newSlotItem) { bool allowItem=false; if (newSlotItem.currentSlot.GetType()!=this.GetType()) { //check if type is appropriate if (newSlotItem.assignedItem.GetType().BaseType==typeof(MeleeWeapon)) { //check if party member can equip (prevents equpping multiple flashlights or armor vests allowItem=true; } } return allowItem; }
//for items being dropped in with the mouse (public to allow overlaid SlotItems to pass it on if they block the raycast public void ItemDroppedIn(SlotItem newSlotItem) { //check if item applies to this slot if (CheckItem(newSlotItem)) { SlotItem oldItem=filledItem; InventorySlot oldSlot=newSlotItem.currentSlot; oldSlot.EmptySlot(); //remove current item and fill in new item EmptySlot(); RegisterNewItem(newSlotItem); //If slot previously had an item in it - swap to other slot if (oldItem!=null) {oldSlot.ItemSwapped(oldItem);} //Update armor/damage/other stats on inventory screen //InventoryScreenHandler.mainISHandler.RefreshInventoryItems(); if (EItemDropped != null) EItemDropped(); } }
public USlot(SlotItem slot) { this.slot = slot; InitializeComponent(); this.Height = 20; if (slot.item.dataitemtype == DS.DataItemType.SONG) { this.slotsong = new USlotSong(slot); /*Grid g = (Grid)this.Content; g.Children.Add(slotsong); Grid.SetRow(slotsong,1);*/ this.Content = slotsong; this.Height = this.slotsong.Height; } else if (slot.item.dataitemtype == DS.DataItemType.SYNC) { DataSyncItem sync = (DataSyncItem)slot.item; this.uisync = new USlotSync(sync.synctype, sync.scheduleddatetime, slot.uniqID); /*Grid g = (Grid)this.Content; g.Children.Add(slotsong); Grid.SetRow(slotsong,1);*/ this.Content = uisync; this.Height = this.uisync.Height; } else if (slot.item.dataitemtype == DS.DataItemType.LOGNOTE && slot.item.label.IndexOf("CONTENTSEQUENCE")==0) { this.uicontent = new USlotContent(slot); /*Grid g = (Grid)this.Content; g.Children.Add(slotsong); Grid.SetRow(slotsong,1);*/ this.Content = uicontent; this.Height = this.uicontent.Height; } }
//see if the new item can currently be filled into this slot, if yes - return true public virtual bool CheckItem(SlotItem newSlotItem) { bool assignItem=false; //Check if item has no slot from which it came, or the slot is of a different type from Inventory if (newSlotItem.currentSlot==null) {assignItem=true;} else {if (newSlotItem.currentSlot.GetType()!=this.GetType()) {assignItem=true;}} /* if (assignItem) { //this makes common inventory slots act as both common party inventory outside encounters and encounter floor within if (EncounterCanvasHandler.main.encounterOngoing) { EncounterCanvasHandler encounterManager=EncounterCanvasHandler.main; EncounterRoom affectedRoom=EncounterCanvasHandler.main.currentEncounter .encounterMap[EncounterCanvasHandler.main.memberCoords[InventoryScreenHandler.mainISHandler.selectedMember]]; affectedRoom.AddFloorItem(newSlotItem.assignedItem); //.encounterMap[encounterManager.memberCoords[InventoryScreenHandler.mainISHandler.selectedMember]].AddFloorItem(newSlotItem.assignedItem);//floorItems.Add(newSlotItem.assignedItem); }//.encounterFloor.Add(newSlotItem.assignedItem);} else {PartyManager.mainPartyManager.partyInventory.Add(newSlotItem.assignedItem);} }*/ return assignItem; }
public ShipStatusEquipment() { InitializeComponent(); SlotList = new SlotItem[6]; for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i] = new SlotItem(); } SlotSize = 0; base.Font = new Font( "Meiryo UI", 10, FontStyle.Regular, GraphicsUnit.Pixel ); _aircraftColorDisabled = Color.FromArgb( 0xAA, 0xAA, 0xAA ); _aircraftColorLost = Color.FromArgb( 0xFF, 0x00, 0xFF ); _aircraftColorDamaged = Color.FromArgb( 0xFF, 0x00, 0x00 ); _aircraftColorFull = Color.FromArgb( 0x00, 0x00, 0x00 ); _invalidSlotColor = Color.FromArgb( 0x40, 0xFF, 0x00, 0x00 ); _showAircraft = true; _overlayAircraft = false; _slotMargin = 3; }
public ShipStatusEquipment() { InitializeComponent(); SlotList = new SlotItem[6]; for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i] = new SlotItem(); } SlotSize = 0; _onMouse = false; base.Font = new Font( "Meiryo UI", 10, FontStyle.Regular, GraphicsUnit.Pixel ); _aircraftColorDisabled = Color.FromArgb( 0xAA, 0xAA, 0xAA ); _aircraftColorLost = Color.FromArgb( 0xFF, 0x00, 0xFF ); _aircraftColorDamaged = Color.FromArgb( 0xFF, 0x00, 0x00 ); _aircraftColorFull = Color.FromArgb( 0x00, 0x00, 0x00 ); _equipmentLevelColor = Color.FromArgb( 0x00, 0x66, 0x66 ); _aircraftLevelColorLow = Color.FromArgb( 0x66, 0x99, 0xEE ); _aircraftLevelColorHigh = Color.FromArgb( 0xFF, 0xAA, 0x00 ); _invalidSlotColor = Color.FromArgb( 0x40, 0xFF, 0x00, 0x00 ); _invalidSlotBrush = new SolidBrush( _invalidSlotColor ); _showAircraft = true; _overlayAircraft = false; _levelVisibility = LevelVisibilityFlag.Both; _slotMargin = 3; _aircraftMargin = 3; Disposed += ShipStatusEquipment_Disposed; }
/// <summary> /// スロット情報を設定します。主に味方艦用です。 /// </summary> /// <param name="ship">当該艦船。</param> public void SetSlotList( ShipData ship ) { int slotCount = Math.Max( ship.SlotSize + ( ship.IsExpansionSlotAvailable ? 1 : 0 ), 4 ); IsExpansionSlotAvailable = ship.IsExpansionSlotAvailable; if ( SlotList.Length != slotCount ) { SlotList = new SlotItem[slotCount]; for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i] = new SlotItem(); } } for ( int i = 0; i < Math.Min( slotCount, 5 ); i++ ) { var eq = ship.SlotInstance[i]; SlotList[i].EquipmentID = eq != null ? eq.EquipmentID : -1; SlotList[i].AircraftCurrent = ship.Aircraft[i]; SlotList[i].AircraftMax = ship.MasterShip.Aircraft[i]; SlotList[i].Level = eq != null ? eq.Level : 0; SlotList[i].AircraftLevel = eq != null ? eq.AircraftLevel : 0; } if ( ship.IsExpansionSlotAvailable ) { var eq = ship.ExpansionSlotInstance; SlotList[ship.SlotSize].EquipmentID = eq != null ? eq.EquipmentID : -1; SlotList[ship.SlotSize].AircraftCurrent = SlotList[ship.SlotSize].AircraftMax = 0; SlotList[ship.SlotSize].Level = eq != null ? eq.Level : 0; SlotList[ship.SlotSize].AircraftLevel = eq != null ? eq.AircraftLevel : 0; } SlotSize = ship.SlotSize + ( ship.IsExpansionSlotAvailable ? 1 : 0 ); PropertyChanged(); }
public void SpawnSlots() { Clear(); for (int i = 0; i < StaticValues.Recipe.Count; i++) { GameObject obj = null; bool canSpawn = false; switch (GetComponentInParent <WorkshopPanel>().SelectWorkshop) { case WorkshopPanel.e_SelectWorkshop.Blacksmith: Highlights.SetActive(true); switch (Category) { case MarketplacePanel.Item_Category.All: switch (StaticValues.Recipe[i].Reward.Category) { case ItemCategory.Weapon: case ItemCategory.Rune: case ItemCategory.Armor: case ItemCategory.Accessories: case ItemCategory.Component: canSpawn = true; break; case ItemCategory.Throw: IThrow iThrow = StaticValues.Items.Throws[StaticValues.Recipe[i].Reward.ID]; if (iThrow.AttackElement == Elements.Physical) { canSpawn = true; } break; } break; case MarketplacePanel.Item_Category.Equipments: switch (StaticValues.Recipe[i].Reward.Category) { case ItemCategory.Weapon: case ItemCategory.Rune: case ItemCategory.Armor: case ItemCategory.Accessories: canSpawn = true; break; case ItemCategory.Throw: IThrow iThrow = StaticValues.Items.Throws[StaticValues.Recipe[i].Reward.ID]; if (iThrow.AttackElement == Elements.Physical) { canSpawn = true; } break; } break; case MarketplacePanel.Item_Category.Materials: if (StaticValues.Recipe[i].Reward.Category == ItemCategory.Component) { canSpawn = true; } break; } break; case WorkshopPanel.e_SelectWorkshop.Herbalist: Highlights.SetActive(false); if (StaticValues.Recipe[i].Reward.Category == ItemCategory.Consume) { canSpawn = true; } if (StaticValues.Recipe[i].Reward.Category == ItemCategory.Throw) { IThrow iThrow = StaticValues.Items.Throws[StaticValues.Recipe[i].Reward.ID]; if (iThrow.AttackElement != Elements.Physical) { canSpawn = true; } } break; } if (canSpawn) { obj = Instantiate(PrefabSlot, Destiny.transform, true); obj.GetComponent <Slot>().Type = SlotType.Workshop; Item item = SetItem(StaticValues.Recipe[i].Reward); SlotItem slot = new SlotItem(item, StaticValues.Recipe[i].Reward.amount); obj.GetComponent <Slot>().SetSlot(slot); obj.GetComponent <Workshop_SlotRecipe>().Recipe = StaticValues.Recipe[i]; Slots.Add(obj); } } }
protected override void RegisterNewItem(SlotItem newSlotItem) { AssignItem(newSlotItem); InventoryScreenHandler.mainISHandler.selectedMember.EquipWeapon(newSlotItem.assignedItem as Weapon); }
protected override void Parse(EndianBinaryReader r) { WindowID = r.ReadByte(); Slot = r.ReadInt16(); Item = SlotItem.Read(r); }
private void ShipStatusEquipment_Paint(object sender, PaintEventArgs e) { Rectangle basearea = new Rectangle(Padding.Left, Padding.Top, Width - Padding.Horizontal, Height - Padding.Vertical); //e.Graphics.DrawRectangle( Pens.Magenta, basearea.X, basearea.Y, basearea.Width - 1, basearea.Height - 1 ); ImageList eqimages = ResourceManager.Instance.Equipments; TextFormatFlags textformat = GetTextFormat(); TextFormatFlags textformatLevel = TextFormatFlags.NoPadding; if (!OverlayAircraft) { textformatLevel |= TextFormatFlags.Top | TextFormatFlags.Right; } else { textformatLevel |= TextFormatFlags.Top | TextFormatFlags.Left; } // 艦載機スロット表示の予測サイズ(2桁) Size sz_eststr = EstimatedSlotSizeCache; // スロット1つ当たりのサイズ(右の余白含む) Size sz_unit = new Size(eqimages.ImageSize.Width + SlotMargin, eqimages.ImageSize.Height); if (ShowAircraft || LevelVisibility != LevelVisibilityFlag.Invisible) { if (!OverlayAircraft) { sz_unit.Width += sz_eststr.Width; } sz_unit.Height = Math.Max(sz_unit.Height, sz_eststr.Height); } for (int slotindex = 0; slotindex < SlotList.Length; slotindex++) { SlotItem slot = SlotList[slotindex]; Image image = null; if (slotindex >= SlotSize && slot.EquipmentID != -1) { //invalid! e.Graphics.FillRectangle(_invalidSlotBrush, new Rectangle(basearea.X + sz_unit.Width * slotindex, basearea.Y, sz_unit.Width, sz_unit.Height)); } if (slot.EquipmentID == -1) { if (slotindex < SlotSize) { //nothing image = eqimages.Images[(int)ResourceManager.EquipmentContent.Nothing]; } else { //locked image = eqimages.Images[(int)ResourceManager.EquipmentContent.Locked]; } } else { int imageID = slot.EquipmentIconID; if (imageID <= 0 || (int)ResourceManager.EquipmentContent.Locked <= imageID) { imageID = (int)ResourceManager.EquipmentContent.Unknown; } image = eqimages.Images[imageID]; } if (image != null) { Rectangle imagearea = new Rectangle(basearea.X + sz_unit.Width * slotindex, basearea.Y, eqimages.ImageSize.Width, eqimages.ImageSize.Height); e.Graphics.DrawImage(image, imagearea); //e.Graphics.DrawRectangle( Pens.Magenta, basearea.X + sz_unit.Width * slotindex, basearea.Y, eqimages.ImageSize.Width, eqimages.ImageSize.Height ); } Color aircraftColor = AircraftColorDisabled; bool drawAircraftSlot = ShowAircraft; if (slot.EquipmentID != -1) //装備有 { if (Calculator.IsAircraft(slot.EquipmentID, true)) //装備有り、艦載機の場合 { if (slot.AircraftMax == 0) { aircraftColor = AircraftColorDisabled; } else if (slot.AircraftCurrent == 0) { aircraftColor = AircraftColorLost; } else if (slot.AircraftCurrent < slot.AircraftMax) { aircraftColor = AircraftColorDamaged; } else { aircraftColor = AircraftColorFull; } } else { if (slot.AircraftMax == 0) { drawAircraftSlot = false; } } } else if (slot.AircraftMax == 0) { drawAircraftSlot = false; } if (drawAircraftSlot) { Rectangle textarea = new Rectangle(basearea.X + sz_unit.Width * slotindex, basearea.Y - AircraftMargin - 1, sz_unit.Width - SlotMargin, sz_unit.Height + AircraftMargin * 2); //e.Graphics.DrawRectangle( Pens.Cyan, textarea ); if (OverlayAircraft) { //e.Graphics.FillRectangle( _overlayBrush, new Rectangle( textarea.X, textarea.Y, sz_eststr.Width, sz_eststr.Height ) ); e.Graphics.FillRectangle(_overlayBrush, textarea); } else { if (slot.AircraftCurrent < 10) { //1桁なら画像に近づける textarea.Width -= sz_eststr.Width / 2 - 1; } else if (slot.AircraftCurrent >= 100) { //3桁以上ならオーバーレイを入れる Size sz_realstr = TextRenderer.MeasureText(slot.AircraftCurrent.ToString(), Font, new Size(int.MaxValue, int.MaxValue), textformat); sz_realstr.Width -= (int)(Font.Size / 2.0); e.Graphics.FillRectangle(_overlayBrush, new Rectangle( textarea.X + sz_unit.Width - sz_realstr.Width - SlotMargin, textarea.Bottom - sz_realstr.Height + AircraftMargin, sz_realstr.Width, sz_realstr.Height)); } } TextRenderer.DrawText(e.Graphics, slot.AircraftCurrent.ToString(), Font, textarea, aircraftColor, textformat); } if ((slot.AircraftLevel > 0 || slot.Level > 0) && LevelVisibility != LevelVisibilityFlag.Invisible) { //Rectangle textarea = new Rectangle( basearea.X + sz_unit.Width * slotindex, basearea.Y - ( AircraftMargin + SlotMargin ), sz_unit.Width - AircraftMargin, sz_unit.Height + 7 ); Rectangle textarea = new Rectangle(basearea.X + sz_unit.Width * slotindex, basearea.Y - AircraftMargin - 1, sz_unit.Width - SlotMargin, sz_unit.Height + AircraftMargin * 2); //e.Graphics.DrawRectangle( Pens.Cyan, textarea ); if (slot.AircraftLevel > 0 && !(slot.Level > 0 && (LevelVisibility == LevelVisibilityFlag.LevelPriority ^ _onMouse)) && LevelVisibility != LevelVisibilityFlag.LevelOnly) { string leveltext; Color levelcol; if (slot.AircraftLevel <= 3) { levelcol = AircraftLevelColorLow; } else { levelcol = AircraftLevelColorHigh; } switch (slot.AircraftLevel) { case 1: leveltext = "|"; break; case 2: leveltext = "||"; break; case 3: leveltext = "|||"; break; case 4: leveltext = "/"; break; case 5: leveltext = "//"; break; case 6: leveltext = "///"; break; case 7: leveltext = ">>"; break; default: leveltext = "x"; break; } TextRenderer.DrawText(e.Graphics, leveltext, Font, textarea, levelcol, textformatLevel); } if (slot.Level > 0 && !(slot.AircraftLevel > 0 && (LevelVisibility == LevelVisibilityFlag.AircraftLevelPriority ^ _onMouse)) && LevelVisibility != LevelVisibilityFlag.AircraftLevelOnly) { TextRenderer.DrawText(e.Graphics, slot.Level >= 10 ? "★" : "+" + slot.Level, Font, textarea, EquipmentLevelColor, textformatLevel); } } } }
public void SetItem(SlotItem _item) { item = _item; }
// Start is called before the first frame update void Start() { parentItem = this.transform.parent.gameObject.GetComponent <SlotItem>(); }
/// <summary> /// 개수에 의한 추가 수치를 계산합니다. /// </summary> /// <param name="item"></param> /// <returns></returns> internal static SlotItemStat GetImprovementBonus(this SlotItem item) { var output = new SlotItemStat(); var id = item.Info.Id; var sqLevel = Math.Sqrt(item.Level); var level = item.Level; switch (item.Info.IconType) { // 전투기 계열 (대공 x0.2) - 함상전투기, 수상전투기, 국지전투기, 육군전투기 case SlotItemIconType.Fighter: case SlotItemIconType.SeaplaneFighter: case SlotItemIconType.InterceptorFighter: case SlotItemIconType.LandBasedFighter: output.AA = level * 0.2; break; // 폭격기 (대공 x0.25) - 아직까진 개수 되는 것이 폭전밖에 없으므로 대충 작성 case SlotItemIconType.DiveBomber: output.AA = level * 0.25; break; // 정찰기 (색적 √x1.2) case SlotItemIconType.ReconPlane: output.LoS = sqLevel * 1.2; break; // 소구경 주포, 중구경 주포 (화력, 명중 √x1.0) case SlotItemIconType.MainCanonLight: case SlotItemIconType.MainCanonMedium: output.Firepower = sqLevel * 1.0; output.Hit = sqLevel * 1.0; break; // 대구경 주포 (화력 √x1.5, 야전화력 √x1.0, 명중 √x1.0) case SlotItemIconType.MainCanonHeavy: output.Firepower = sqLevel * 1.5; output.NightFirepower = sqLevel * 1.0; output.Hit = sqLevel * 1.0; break; // 부포 (화력, 명중 √x1.0) - 노란색 아이콘 case SlotItemIconType.SecondaryCanon: // 15.5cm 삼연장포(부포), 15.5cm 삼연장부포改 // 화력 x0.3, 야전 화력 √x1.0 if (new int[] { 12, 234 }.Contains(id)) { output.Firepower = level * 0.3; output.NightFirepower = sqLevel * 1.0; output.Hit = sqLevel * 1.0; } // 그 외 부포 else { // 화력, 명중 √x1.0 output.Firepower = sqLevel * 1.0; output.Hit = sqLevel * 1.0; } break; // 고각포 (화력, 명중 √x1.0, 대공 √x0.7, 함대방공 √x3.0) case SlotItemIconType.HighAngleGun: // 12.7cm 연장고각포, 8cm 고각포, 8cm 고각포改+증설기총 // 화력 x0.2, 야전화력 √x1.0, 대공 √x0.7, 함대방공 √x2.0 if (new int[] { 10, 66, 220 }.Contains(id)) { output.Firepower = level * 0.2; output.NightFirepower = sqLevel * 1.0; output.AA = sqLevel * 0.7; output.FleetAA = sqLevel * 2.0; } // 그 외 고각포 else { output.Firepower = sqLevel * 1.0; output.Hit = sqLevel * 1.0; output.AA = sqLevel * 0.7; output.FleetAA = sqLevel * 3.0; } break; // 어뢰 (뇌장 √x1.2, 야전 화력 √x1.0, 뇌격 명중 √x2.0) case SlotItemIconType.Torpedo: output.Torpedo = sqLevel * 1.2; output.NightFirepower = sqLevel * 1.0; output.TorpedoHit = sqLevel * 2.0; break; // 전파탐신기 // - 대공전탐: 색적 √x1.25, 명중 √x1.0, 함대방공 √x1.5 // - 대수상전탐: 색적 √x1.0, 명중 √x2.0 // - 잠수함전탐: ??? case SlotItemIconType.Rader: // 잠수함전탐 // ??? if (new int[] { 210, 211 }.Contains(id)) { } // 대공전탐 // 색적 √x1.25, 명중 √x1.0, 함대방공 √x1.5 else if (new int[] { 27, 30, 32, 89, 106, 124, 142, 278, 279 }.Contains(id)) { output.LoS = sqLevel * 1.25; output.Hit = sqLevel * 1.0; output.FleetAA = sqLevel * 1.5; } // 대수상전탐 // 색적 √x1.0, 명중 √x2.0 else { output.LoS = sqLevel * 1.0; output.Hit = sqLevel * 2.0; } break; // 소나 (화력 √x0.75, 대잠 √x6÷9, 대잠 명중 √x1.3, 뇌격 명중 √x1.5) case SlotItemIconType.Soner: output.Firepower = sqLevel * 0.75; output.ASW = sqLevel * 6.0 / 9.0; output.ASWHit = sqLevel * 1.3; output.TorpedoHit = sqLevel * 1.5; break; // 폭뢰/폭뢰투사기 // - 폭뢰: 대잠 √x6÷9 // - 폭뢰투사기: 대잠 √x6÷9, 화력 √x0.75 case SlotItemIconType.ASW: // 폭뢰 // 대잠 √x6÷9 if (new int[] { 226, 227 }.Contains(id)) { output.ASW = sqLevel * 6.0 / 9.0; } // 폭뢰투사기 // 대잠 √x6÷9, 화력 √x0.75 else { output.Firepower = sqLevel * 0.75; output.ASW = sqLevel * 6.0 / 9.0; } break; // 철갑탄 (화력, 명중 √x1.0) case SlotItemIconType.APShell: output.Firepower = sqLevel * 1.0; output.Hit = sqLevel * 1.0; break; // 대공기총 (대공 √x0.7, 화력 √x1.0, 뇌장 √x1.2, 뇌장 명중 ???) case SlotItemIconType.AAGun: output.Firepower = sqLevel * 1.0; output.AA = sqLevel * 0.7; output.Torpedo = sqLevel * 1.2; break; // 고사장치 (화력 √x1.0, 명중 √x1.0, 대공 √x0.7, 함대방공 √x2.0) case SlotItemIconType.AntiAircraftFireDirector: output.Firepower = sqLevel * 1.0; output.Hit = sqLevel * 1.0; output.AA = sqLevel * 0.7; output.FleetAA = sqLevel * 2.0; break; // 기관부강화 (회피 √x1.5) case SlotItemIconType.EngineImprovement: output.Evade = sqLevel * 1.5; break; // 증설벌지 // - 중형벌지 : 장갑 x0.2 // - 대형벌지 : 장갑 x0.3 case SlotItemIconType.AntiTorpedoBulge: // 중형벌지 // 장갑 x0.2 if (new int[] { 72, 203 }.Contains(id)) { output.Armor = level * 0.2; } // 대형벌지 // 장갑 x0.3 else { output.Armor = level * 0.3; } break; // 탐조등 (화력 √x1.0, 피탄확률 ???, 적 컷인 확률 ???) case SlotItemIconType.Searchlight: output.Firepower = sqLevel * 1.0; break; // 수상폭격기 (폭장 x0.2, 색적 √x1.15) // 수상정찰기 (색적 √x1.2) case SlotItemIconType.ReconSeaplane: // 수상폭격기 // 폭장 x0.2, 색적 √x1.15 if (new int[] { 26, 79, 237 }.Contains(id)) { output.Bomb = level * 0.2; output.LoS = sqLevel * 1.15; } // 수상정찰기 // 색적 √x1.2 else { output.LoS = sqLevel * 1.2; } break; // 상륙정, 내화정 (화력 √x1.0) // - 대발동정: 원정 보수 x0.05, 포대 특효 x0.04 // - 대발동정(육전대): 원정 보수 x0.02, 포대 특효 x0.044 // - 특대발동정: 원정 보수 x0.05 // - 2식 내화정: 원정 보수 x0.01, 포대 특효 x0.08 case SlotItemIconType.LandingCraft: case SlotItemIconType.AmphibiousLandingCraft: output.Firepower = sqLevel * 1.0; // 대발동정 // 원정 보수 x0.05, 포대 특효 x0.04 if (id == 68) { output.ExpeditionBonus = level * 0.05; output.TurrentEfficacy = level * 0.04; } // 대발동정(육전대) // 원정 보수 x0.02, 포대 특효 x0.044 else if (id == 166) { output.ExpeditionBonus = level * 0.02; output.TurrentEfficacy = level * 0.044; } // 특대발동정 // 원정 보수 x0.05 else if (id == 193) { output.ExpeditionBonus = level * 0.05; } // 2식 내화정 // 원정 보수 x0.01, 포대 특효 x0.08 else if (id == 167) { output.ExpeditionBonus = level * 0.01; output.TurrentEfficacy = level * 0.08; } break; } return(output); }
/// <summary> /// 熟練度による制空能力ボーナス最大値を計算します。 /// </summary> /// <param name="slotItem">対空能力を持つ装備。</param> /// <param name="onslot">搭載数。</param> /// <returns></returns> private static double CalcMaxAirecraftAdeptBonus(this SlotItem slotItem, int onslot) => onslot < 1 ? 0 : slotItem.CalcAirecraftAdeptBonusOfType() + slotItem.CalcMaxInternalAirecraftAdeptBonus();
/// <summary> /// 各表記熟練度に対応した艦載機内部熟練度ボーナスの最小値を計算します。 /// </summary> /// <param name="slotItem"></param> /// <returns></returns> private static double CalcMinInternalAirecraftAdeptBonus(this SlotItem slotItem) { return(slotItem.Info.IsAirSuperiorityFighter ? Math.Sqrt((slotItem.Adept != 0 ? (slotItem.Adept - 1) * 15 + 10 : 0) / 10d) : 0); }
void CreateUpgrade() { for (int i = 0; i < TypeUpgrade.Count; i++) { bool canSpawn = true; switch (TypeUpgrade[i]) { case ICamp.Type_Camp.FieldHospital: if (StaticValues.Camp.upgrades.FieldHospital >= 5) { canSpawn = false; } break; case ICamp.Type_Camp.Herbalist: if (StaticValues.Camp.upgrades.Herbalist >= 5) { canSpawn = false; } break; case ICamp.Type_Camp.Lumberjack: if (StaticValues.Camp.upgrades.Lumberjack >= 5) { canSpawn = false; } break; case ICamp.Type_Camp.Magazine: if (StaticValues.Camp.upgrades.Magazine >= 5) { canSpawn = false; } break; case ICamp.Type_Camp.Recruit: if (StaticValues.Camp.upgrades.Recruit >= 5) { canSpawn = false; } break; case ICamp.Type_Camp.Tents: if (StaticValues.Camp.upgrades.Tents >= 5) { canSpawn = false; } break; case ICamp.Type_Camp.Workshop: if (StaticValues.Camp.upgrades.Workshop >= 5) { canSpawn = false; } break; } if (canSpawn) { ICamp upgrade = new ICamp(TypeUpgrade[i]); SlotItem item = new SlotItem(upgrade, 1); ShopItems.Items.Add(item); } } }
public void ExportNewAddedShipAndSlotitem(string server, out Dictionary <string, List <Ship> > _exportedShips, out List <SlotItem> _exportedSlotItems) { _exportedShips = new Dictionary <string, List <Ship> >(); _exportedSlotItems = new List <SlotItem>(); _exportedShips["ship"] = new List <Ship>(); _exportedShips["abyssal"] = new List <Ship>(); _exportedShips["limited"] = new List <Ship>(); foreach (var ship in m_newAddedMasterShips.Values) { if (_exportedShips["abyssal"].Exists(s => s.Name.Equals(ship.Name))) { continue; } Ship exportShip = new Ship(); exportShip.ID = ship.ID; exportShip.AlbumNo = ship.AlbumNo; exportShip.Name = ship.Name; exportShip.Introduction = ship.MessageGet; exportShip.IsAbyssal = ship.IsAbyssalShip; exportShip.IsLimitedIllustration = ship.ID >= 825; exportShip.HitPoint = string.Format("{0}/{1}({2})", ship.HPMin, ship.HPMax, ship.HPMaxMarried); exportShip.Firepower = string.Format("{0}/{1}", ship.FirepowerMin, ship.FirepowerMax); exportShip.Torpedo = string.Format("{0}/{1}", ship.TorpedoMin, ship.TorpedoMax); exportShip.AntiAir = string.Format("{0}/{1}", ship.AAMin, ship.AAMax); exportShip.Armor = string.Format("{0}/{1}", ship.ArmorMin, ship.ArmorMax); exportShip.Luck = string.Format("{0}/{1}", ship.LuckMin, ship.LuckMax); exportShip.Speed = ship.Speed <= 5 ? (ship.Speed == 0 ? "陸上基地" : "低速") : "高速"; // 0=陸上基地, 5=低速, 10=高速 exportShip.EquipmentSlot = ship.SlotSize; exportShip.AircraftSlot = string.Format("[{0}][{1}][{2}][{3}]", ship.Aircraft[0], ship.Aircraft[1], ship.Aircraft[2], ship.Aircraft[3]); exportShip.AircraftTotal = ship.AircraftTotal; exportShip.RemodelLv = ship.RemodelAfterLevel; exportShip.RemodelSteel = ship.RemodelSteel; exportShip.RemodelAmmo = ship.RemodelAmmo; exportShip.IllustrationSwfLink = string.Format(SHIP_SWF_URL, server, ship.ResourceName); Utils.Log(string.Format("New Ship: {0}", exportShip.Name), "KCDatabase"); if (exportShip.IsAbyssal) { _exportedShips["abyssal"].Add(exportShip); } else if (exportShip.IsLimitedIllustration) { _exportedShips["limited"].Add(exportShip); } else { _exportedShips["ship"].Add(exportShip); } } foreach (var item in m_newAddedEquipmentDataMaster.Values) { SlotItem exportSlotItem = new SlotItem(); exportSlotItem.ID = item.ID; exportSlotItem.AlbumNo = item.AlbumNo; exportSlotItem.Name = item.Name; exportSlotItem.Introduction = item.Message; exportSlotItem.IsAbyssal = item.IsAbyssalEquipment; exportSlotItem.Firepower = item.Firepower; exportSlotItem.Torpedo = item.Torpedo; exportSlotItem.Bombing = item.Bomber; exportSlotItem.AntiAir = item.AA; exportSlotItem.AntiSub = item.ASW; exportSlotItem.Armor = item.Armor; exportSlotItem.Accuracy = item.Accuracy; exportSlotItem.Evasion = item.Evasion; exportSlotItem.LineOfSight = item.LOS; exportSlotItem.Range = item.Range; exportSlotItem.AircraftCost = item.AircraftCost; exportSlotItem.AircraftDistance = item.AircraftDistance; if (!exportSlotItem.IsAbyssal) { exportSlotItem.ItemIllustrateLinks = new List <string>() { string.Format(SLOTITM_CARD_URL, server, exportSlotItem.ID), string.Format(SLOTITM_ITEM_UP_URL, server, exportSlotItem.ID), string.Format(SLOTITM_ITEM_ON_URL, server, exportSlotItem.ID), string.Format(SLOTITM_CHARACTER_URL, server, exportSlotItem.ID), }; } Utils.Log(string.Format("New Equipment: {0}", exportSlotItem.Name), "KCDatabase"); _exportedSlotItems.Add(exportSlotItem); } }
public BoardSymbol(int columnID, SlotItem slotItem) { this.columnID = columnID; this.slotItem = slotItem; }
/// <summary> /// スロット情報を設定します。主に演習の敵艦用です。 /// </summary> /// <param name="shipID">艦船ID。</param> /// <param name="slot">装備スロット。</param> public void SetSlotList( int shipID, int[] slot ) { ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID]; int slotLength = slot != null ? slot.Length : 0; if ( SlotList.Length != slotLength ) { SlotList = new SlotItem[slotLength]; for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i] = new SlotItem(); } } for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i].EquipmentID = slot[i]; SlotList[i].AircraftCurrent = ship.Aircraft[i]; SlotList[i].AircraftMax = ship.Aircraft[i]; SlotList[ship.SlotSize].Level = SlotList[ship.SlotSize].AircraftLevel = 0; } SlotSize = ship != null ? ship.SlotSize : 0; PropertyChanged(); }
public abstract bool Predicate(SlotItem item);
public PlayerDat(Tag tag) { if (tag == null) { tc = new TagCompound(); return; } tc = (TagCompound)tag; foreach (var tp in tc.CompoundList) { Tag v = tp.Value; switch (tp.Key) { case "SleepTimer": SleepTimer = v.Short; break; case "Motion": Motion [0] = ((TagList<TagDouble>)v) [0].Double; Motion [1] = ((TagList<TagDouble>)v) [1].Double; Motion [2] = ((TagList<TagDouble>)v) [2].Double; break; case "OnGround": OnGround = v.Byte; break; case "HurtTime": HurtTime = v.Short; break; case "Health": Health = v.Short; break; case "Dimension": Dimension = v.Int; break; case "Air": Air = v.Short; break; case "Inventory": if (v is TagList<TagCompound>) { foreach (TagCompound ti in ((TagList<TagCompound>)v)) { byte slot = ti ["Slot"].Byte; SlotItem item = new SlotItem((BlockID)ti ["id"].Short, ti ["Count"].Byte, ti ["Damage"].Short); if (100 <= slot && slot < 104) { InventoryWear [slot - 100] = item; } if (80 <= slot && slot < 84) { InventoryCraft [slot - 80] = item; } if (0 <= slot && slot < 36) { Inventory [slot] = item; } } } else if ((v is TagList<TagByte>) == false) { Console.Error.WriteLine("Player.dat: WARNING: No inventory"); Console.Error.WriteLine("Inventory: " + v.GetType() + "\t" + v); } break; case "Pos": Pos.X = ((TagList<TagDouble>)v) [0].Double; Pos.Y = ((TagList<TagDouble>)v) [1].Double; Pos.Z = ((TagList<TagDouble>)v) [2].Double; break; case "AttackTime": AttackTime = v.Short; break; case "Sleeping": Sleeping = v.Byte; break; case "Fire": Fire = v.Short; break; case "FallDistance": FallDistance = v.Float; break; case "Rotation": Rotation [0] = ((TagList<TagFloat>)v) [0].Float; Rotation [1] = ((TagList<TagFloat>)v) [1].Float; break; case "DeathTime": DeathTime = v.Short; break; case "SpawnX": if (Spawn == null) Spawn = new CoordInt(); Spawn.X = v.Int; break; case "SpawnY": if (Spawn == null) Spawn = new CoordInt(); Spawn.Y = v.Int; break; case "SpawnZ": if (Spawn == null) Spawn = new CoordInt(); Spawn.Z = v.Int; break; case "foodExhaustionLevel": foodExhaustionLevel = v.Float; break; case "foodTickTimer": foodTickTimer = v.Int; break; case "foodSaturationLevel": foodSaturationLevel = v.Float; break; case "foodLevel": foodLevel = v.Int; break; case "XpLevel": XpLevel = v.Int; break; case "XpTotal": XpTotal = v.Int; break; case "Xp": //not used anymore //Debug.Assert (false); Xp = v.Int; break; case "XpP": XpP = v.Float; break; case "playerGameType": playerGameType = v.Int; break; case "abilities": //TODO: booleans //flying, instabuild, mayfly, invulnerable break; case "EnderItems": //A list break; case "Attributes": //A list break; case "SelectedItemSlot": //integer break; case "UUIDLeast"://long break; case "UUIDMost"://long break; case "HealF"://float break; case "AbsorptionAmount"://float break; case "SpawnForced": //bool break; case "Score": //int break; case "PortalCooldown": //int break; case "Invulnerable": //bool break; #if DEBUG default: Console.WriteLine("Unknown: " + tp.Key + ": " + v); throw new NotImplementedException(); #endif } } }
public SlotItemViewModel(SlotItem item) { this.SlotItem = item; this.Info = SlotItem.Info; }
public void Clear() { item = null; }
public PlayerDat(Tag tag) { if (tag == null) { tc = new TagCompound(); return; } tc = (TagCompound)tag; foreach (var tp in tc.CompoundList) { Tag v = tp.Value; switch (tp.Key) { case "SleepTimer": SleepTimer = v.Short; break; case "Motion": Motion [0] = ((TagList <TagDouble>)v) [0].Double; Motion [1] = ((TagList <TagDouble>)v) [1].Double; Motion [2] = ((TagList <TagDouble>)v) [2].Double; break; case "OnGround": OnGround = v.Byte; break; case "HurtTime": HurtTime = v.Short; break; case "Health": Health = v.Short; break; case "Dimension": Dimension = v.Int; break; case "Air": Air = v.Short; break; case "Inventory": if (v is TagList <TagCompound> ) { foreach (TagCompound ti in ((TagList <TagCompound>)v)) { byte slot = ti ["Slot"].Byte; SlotItem item = new SlotItem((BlockID)ti ["id"].Short, ti ["Count"].Byte, ti ["Damage"].Short); if (100 <= slot && slot < 104) { InventoryWear [slot - 100] = item; } if (80 <= slot && slot < 84) { InventoryCraft [slot - 80] = item; } if (0 <= slot && slot < 36) { Inventory [slot] = item; } } } else if ((v is TagList <TagByte>) == false) { Console.Error.WriteLine("Player.dat: WARNING: No inventory"); Console.Error.WriteLine("Inventory: " + v.GetType() + "\t" + v); } break; case "Pos": Pos.X = ((TagList <TagDouble>)v) [0].Double; Pos.Y = ((TagList <TagDouble>)v) [1].Double; Pos.Z = ((TagList <TagDouble>)v) [2].Double; break; case "AttackTime": AttackTime = v.Short; break; case "Sleeping": Sleeping = v.Byte; break; case "Fire": Fire = v.Short; break; case "FallDistance": FallDistance = v.Float; break; case "Rotation": Rotation [0] = ((TagList <TagFloat>)v) [0].Float; Rotation [1] = ((TagList <TagFloat>)v) [1].Float; break; case "DeathTime": DeathTime = v.Short; break; case "SpawnX": if (Spawn == null) { Spawn = new CoordInt(); } Spawn.X = v.Int; break; case "SpawnY": if (Spawn == null) { Spawn = new CoordInt(); } Spawn.Y = v.Int; break; case "SpawnZ": if (Spawn == null) { Spawn = new CoordInt(); } Spawn.Z = v.Int; break; case "foodExhaustionLevel": foodExhaustionLevel = v.Float; break; case "foodTickTimer": foodTickTimer = v.Int; break; case "foodSaturationLevel": foodSaturationLevel = v.Float; break; case "foodLevel": foodLevel = v.Int; break; case "XpLevel": XpLevel = v.Int; break; case "XpTotal": XpTotal = v.Int; break; case "Xp": //not used anymore //Debug.Assert (false); Xp = v.Int; break; case "XpP": XpP = v.Float; break; case "playerGameType": playerGameType = v.Int; break; case "abilities": //TODO: booleans //flying, instabuild, mayfly, invulnerable break; case "EnderItems": //A list break; case "Attributes": //A list break; case "SelectedItemSlot": //integer break; case "UUIDLeast": //long break; case "UUIDMost": //long break; case "HealF": //float break; case "AbsorptionAmount": //float break; case "SpawnForced": //bool break; case "Score": //int break; case "PortalCooldown": //int break; case "Invulnerable": //bool break; #if DEBUG default: Console.WriteLine("Unknown: " + tp.Key + ": " + v); throw new NotImplementedException(); #endif } } }
public void ClearItem() { item = null; }
protected override void Parse(EndianBinaryReader r) { EID = ReadVarInt(r); Slot = r.ReadInt16(); Item = SlotItem.Read(r); }
public SetSlot(byte window, short slot, SlotItem item) { this.WindowID = window; this.Slot = slot; this.Item = item; }
public Tag ExportTag() { tc ["SleepTimer"] = new TagShort(SleepTimer); TagList <TagDouble> motion = new TagList <TagDouble>(); motion [0] = new TagDouble(Motion [0]); motion [1] = new TagDouble(Motion [1]); motion [2] = new TagDouble(Motion [2]); tc ["Motion"] = motion; tc ["OnGround"] = new TagByte() { Byte = OnGround }; tc ["HurtTime"] = new TagShort(HurtTime); tc ["Health"] = new TagShort(Health); tc ["Dimension"] = new TagInt(Dimension); tc ["Air"] = new TagShort(Air); if (tc ["Inventory"] is TagList <TagCompound> == false) { tc ["Inventory"] = new TagList <TagCompound>(); } TagList <TagCompound> inv = tc ["Inventory"] as TagList <TagCompound>; for (byte n = 0; n < 104; n++) { SlotItem item = null; if (n < 36) { item = Inventory [n]; } if (n >= 80 && n < 84) { item = InventoryCraft [n - 80]; } if (n >= 100) { item = InventoryWear [n - 100]; } TagCompound ti = null; //Find slot item foreach (TagCompound itc in inv) { if (itc ["Slot"].Byte == n) { ti = itc; break; } } if (item == null) { if (ti != null) { inv.Remove(ti); } continue; } if (ti == null) { ti = new TagCompound(); inv.Add(ti); } ti ["id"] = new TagShort((short)item.ItemID); ti ["Damage"] = new TagShort((short)item.Uses); ti ["Count"] = new TagByte((byte)item.Count); ti ["Slot"] = new TagByte(n); } inv.Sort((x, y) => x ["Slot"].Byte - y ["Slot"].Byte); TagList <TagDouble> p = new TagList <TagDouble>(); p [0] = new TagDouble(Pos.X); p [1] = new TagDouble(Pos.Y); p [2] = new TagDouble(Pos.Z); tc ["Pos"] = p; tc ["AttackTime"] = new TagShort(AttackTime); tc ["Sleeping"] = new TagByte(Sleeping); tc ["Fire"] = new TagShort(Fire); tc ["FallDistance"] = new TagFloat(FallDistance); TagList <TagFloat> rot = new TagList <TagFloat>(); rot [0] = new TagFloat(Rotation [0]); rot [1] = new TagFloat(Rotation [1]); tc ["Rotation"] = rot; tc ["DeathTime"] = new TagShort(DeathTime); if (Spawn != null) { tc ["SpawnX"] = new TagInt(Spawn.X); tc ["SpawnY"] = new TagInt(Spawn.Y); tc ["SpawnZ"] = new TagInt(Spawn.Z); } tc ["foodExhaustionLevel"] = new TagFloat(foodExhaustionLevel); tc ["foodTickTimer"] = new TagInt(foodTickTimer); tc ["foodSaturationLevel"] = new TagFloat(foodSaturationLevel); tc ["foodLevel"] = new TagInt(foodLevel); tc ["XpLevel"] = new TagInt(XpLevel); tc ["XpTotal"] = new TagInt(XpTotal); tc ["Xp"] = new TagInt(Xp); tc ["playerGameType"] = new TagInt(playerGameType); return(tc); }
protected override void Prepare(EndianBinaryWriter w) { w.Write((byte)WindowID); w.Write((short)Slot); SlotItem.Write(w, Item); }
public void UpdatePrimaryItems(Entity character) { IMenuItem item = (IMenuItem)character.InventoryItem; if (item != null) { arrowItem = new Grenade(currentLevel.RenderManager.TextureCache.GetResource(item.Texture)); arrowItem.IsPrimary = true; hudElements[FindPrimary()] = new WeaponSlot(arrowItem, blank); } }
//리스트에 아이템 추가 (인덱스 직접 설정, 저장소 불러오기 용도) public void Add(SlotItem item, int index) { item.Tab = this; ItemTable[index] = item; item.Index = index; }
private static void TakeOff(SlotItem slotItem, PersonageModel personage) { G.self.user_inventory.Increase(slotItem.Asset.Classname); personage.TakeOffItem(slotItem); }
public void Dispose() { this.slot = null; this.slotsong = null; }
public static void UpgradeCamp(SlotItem item) { ICamp upgrade = (ICamp)item.item; switch (upgrade.TypeCamp) { case ICamp.Type_Camp.FieldHospital: if (StaticValues.Camp.upgrades.FieldHospital < 5) { StaticValues.Camp.upgrades.FieldHospital++; } break; case ICamp.Type_Camp.Herbalist: if (StaticValues.Camp.upgrades.Herbalist < 5) { StaticValues.Camp.upgrades.Herbalist++; StaticValues.WorkshopPoints.Herbalist.Add(0); } break; case ICamp.Type_Camp.Lumberjack: if (StaticValues.Camp.upgrades.Lumberjack < 5) { StaticValues.Camp.upgrades.Lumberjack++; } break; case ICamp.Type_Camp.Magazine: if (StaticValues.Camp.upgrades.Magazine < 5) { StaticValues.Camp.upgrades.Magazine++; StaticValues.InvMagazine.Capacity(); } break; case ICamp.Type_Camp.Recruit: if (StaticValues.Camp.upgrades.Recruit < 5) { StaticValues.Camp.upgrades.Recruit++; } break; case ICamp.Type_Camp.Tents: if (StaticValues.Camp.upgrades.Tents < 5) { StaticValues.Camp.upgrades.Tents++; StaticValues.Camp.UnitMax = 5 + 5 * StaticValues.Camp.upgrades.Tents; } break; case ICamp.Type_Camp.Workshop: if (StaticValues.Camp.upgrades.Workshop < 5) { StaticValues.Camp.upgrades.Workshop++; StaticValues.WorkshopPoints.Blacksmith.Add(0); } break; } StaticValues.Money -= item.amount * item.item.Value; }
/// <param name='slot'> /// Hand=0, Foot=1 ... Head=4 /// </param> public EntityEquipment(int eid, int slot, SlotItem item) { this.EID = eid; this.Slot = (short)slot; this.Item = item; }
public void AddSlotItem(SlotItem slotItem) { slotItem.transform.SetParent(parentObject.transform); currentSlotItems.Add(slotItem); }
private void AddSlot() { if (_slots.Count != pnlSlots.Children.Count) { throw new ApplicationException(string.Format("The list and panel are out of sync. list={0}, panel={1}", _slots.Count.ToString(), pnlSlots.Children.Count.ToString())); } SlotItem slot = new SlotItem(); // Border slot.Border = new Border() { Width = 120, Height = 120, Margin = new Thickness(2) }; // Text slot.Text = new OutlinedTextBlock() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Text = "", StrokeThickness = 2, FontFamily = _font.Value, FontSize = 60, FontWeight = FontWeights.Bold, Effect = new BlurEffect() { Radius = 3 } // this gets changed based on whether the slot is empty or not }; // Viewport Camera slot.Camera = new PerspectiveCamera() { Position = new Point3D(0, 0, 1), LookDirection = new Vector3D(0, 0, -1), UpDirection = new Vector3D(0, 1, 0), FieldOfView = 45d }; // Viewport Lights Color ambient, front, back; InventoryItem.GetLightColors(out ambient, out front, out back, _lightColor); slot.WeaponAmbientLight = new AmbientLight(ambient); slot.WeaponFrontLight = new DirectionalLight(front, new Vector3D(1, -1, -1)); slot.WeaponBackLight = new DirectionalLight(back, new Vector3D(-1, 1, 1)); Model3DGroup lightsGeometry = new Model3DGroup(); lightsGeometry.Children.Add(slot.WeaponAmbientLight); lightsGeometry.Children.Add(slot.WeaponFrontLight); lightsGeometry.Children.Add(slot.WeaponBackLight); //slot.Light = new PointLight() //{ // Color = Colors.Transparent, // Position = new Point3D(0,0,0), // Range = 0 //}; //lightsGeometry.Children.Add(slot.Light); // Viewport slot.Viewport = new Viewport3D(); slot.Viewport.Camera = slot.Camera; slot.Viewport.Children.Add(new ModelVisual3D() { Content = lightsGeometry }); Grid grid = new Grid(); grid.Children.Add(slot.Text); grid.Children.Add(slot.Viewport); slot.Border.Child = grid; _slots.Add(slot); pnlSlots.Children.Add(slot.Border); }
void Init() { Transform grid = transform.Find("container/grid"); Transform unit = grid.Find("item"); unit.gameObject.SetActive(false); for (int i = 0; i < 9; i++) { Transform trans = Instantiate(unit); trans.SetParent(grid, false); trans.localScale = Vector3.one; trans.gameObject.SetActive(true); SlotItem item = new SlotItem { icon = trans.Find("icon").GetComponent <RawImage>(), select = trans.Find("select").gameObject, count = trans.Find("Text").GetComponent <TextMeshProUGUI>(), damageObj = trans.Find("damage_bg").gameObject, damage = trans.Find("damage_bg/damage").GetComponent <RawImage>(), }; item.icon.gameObject.SetActive(false); item.select.SetActive(false); item.damageObj.SetActive(false); itemList[i] = item; } survival = transform.Find("container/survival"); Transform heartGrid = survival.Find("health_grid"); Transform heartUnit = heartGrid.Find("heart_bg_unit"); for (int i = 0; i < 10; i++) { Transform heartTrans = Instantiate(heartUnit); heartTrans.SetParent(heartGrid, false); heartTrans.localScale = Vector3.one; SlotUnit heart = new SlotUnit { full = heartTrans.Find("heart").GetComponent <Image>(), half = heartTrans.Find("heart_half").GetComponent <Image>(), }; heartList[i] = heart; } heartUnit.gameObject.SetActive(false); Transform meatGrid = survival.Find("meat_grid"); Transform meatUnit = meatGrid.Find("meat_bg_unit"); for (int i = 0; i < 10; i++) { Transform meatTrans = Instantiate(meatUnit); meatTrans.SetParent(meatGrid, false); meatTrans.localScale = Vector3.one; SlotUnit meat = new SlotUnit { full = meatTrans.Find("meat").GetComponent <Image>(), half = meatTrans.Find("meat_half").GetComponent <Image>(), }; meatList[i] = meat; } meatUnit.gameObject.SetActive(false); level = survival.Find("level").GetComponent <TextMeshProUGUI>(); exp = survival.Find("exp_bg/exp").GetComponent <Image>(); }
public WeaponSlot AddWeaponSlot(SlotItem item) { WeaponSlot slot = new WeaponSlot(item, outline); HudElements.Add(slot); currentSlots++; return slot; }
public PresetShipData() { this.ShipId = -1; this.Slots = new SlotItem[0]; this.ExSlot = null; }
private static double GetLevelCoefficient(SlotItem item) { switch (item.Info.Type) { case SlotItemType.水上偵察機: return Math.Sqrt(item.Level) * 1.2; case SlotItemType.小型電探: case SlotItemType.大型電探: case SlotItemType.大型電探_II: return Math.Sqrt(item.Level) * 1.25; default: return 0; } }
private void ShipStatusEquipment_Paint(object sender, PaintEventArgs e) { e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; Rectangle basearea = new Rectangle(Padding.Left, Padding.Top, Width - Padding.Horizontal, Height - Padding.Vertical); //e.Graphics.DrawRectangle( Pens.Magenta, basearea.X, basearea.Y, basearea.Width - 1, basearea.Height - 1 ); ImageList eqimages = ResourceManager.Instance.Equipments; TextFormatFlags textformatBottomRight = GetBaseTextFormat() | TextFormatFlags.Bottom | TextFormatFlags.Right; TextFormatFlags textformatTopLeft = GetBaseTextFormat() | TextFormatFlags.Top | TextFormatFlags.Left; TextFormatFlags textformatTopRight = GetBaseTextFormat() | TextFormatFlags.Top | TextFormatFlags.Right; LayoutParam.UpdateParameters(e.Graphics, basearea.Size, Font); for (int slotindex = 0; slotindex < SlotList.Length; slotindex++) { SlotItem slot = SlotList[slotindex]; Image image = null; var origin = new Point(basearea.X + LayoutParam.SlotUnitSize.Width * slotindex, basearea.Y); if (slotindex >= SlotSize && slot.EquipmentID != -1) { //invalid! e.Graphics.FillRectangle(_invalidSlotBrush, new Rectangle(origin, LayoutParam.SlotUnitSize)); } if (slot.EquipmentID == -1) { if (slotindex < SlotSize) { //nothing image = eqimages.Images[(int)ResourceManager.EquipmentContent.Nothing]; } else { //locked image = eqimages.Images[(int)ResourceManager.EquipmentContent.Locked]; } } else { int imageID = slot.EquipmentIconID; if (imageID <= 0 || (int)ResourceManager.EquipmentContent.Locked <= imageID) { imageID = (int)ResourceManager.EquipmentContent.Unknown; } image = eqimages.Images[imageID]; } Rectangle imagearea = new Rectangle(origin.X, origin.Y + (LayoutParam.SlotUnitSize.Height - LayoutParam.ImageSize.Height) / 2, LayoutParam.ImageSize.Width, LayoutParam.ImageSize.Height); if (image != null) { e.Graphics.DrawImage(image, imagearea); } Color aircraftColor = AircraftColorDisabled; bool drawAircraftSlot = ShowAircraft; if (slot.AircraftMax == 0) { if (slot.Equipment?.IsAircraft ?? false) { aircraftColor = AircraftColorDisabled; } else { drawAircraftSlot = false; } } else if (slot.AircraftCurrent == 0) { aircraftColor = AircraftColorLost; } else if (slot.AircraftCurrent < slot.AircraftMax) { aircraftColor = AircraftColorDamaged; } else if (!(slot.Equipment?.IsAircraft ?? false)) { aircraftColor = AircraftColorDisabled; } else { aircraftColor = AircraftColorFull; } // 艦載機数描画 if (drawAircraftSlot) { Rectangle textarea = new Rectangle(origin.X + LayoutParam.ImageSize.Width, origin.Y + LayoutParam.InfoAreaSize.Height * 3 / 4 - LayoutParam.Digit2Size.Height / 2, LayoutParam.InfoAreaSize.Width, LayoutParam.Digit2Size.Height); //e.Graphics.DrawRectangle( Pens.Cyan, textarea ); if (slot.AircraftCurrent < 10) { //1桁なら画像に近づける textarea.Width -= LayoutParam.Digit2Size.Width / 2; } else if (slot.AircraftCurrent >= 100) { //3桁以上ならオーバーレイを入れる Size sz_realstr = TextRenderer.MeasureText(e.Graphics, slot.AircraftCurrent.ToString(), Font, new Size(int.MaxValue, int.MaxValue), textformatBottomRight); textarea.X -= sz_realstr.Width - textarea.Width; textarea.Width = sz_realstr.Width; e.Graphics.FillRectangle(_overlayBrush, textarea); aircraftColor = (aircraftColor == AircraftColorFull) ? SystemColors.ControlText : aircraftColor; } TextRenderer.DrawText(e.Graphics, slot.AircraftCurrent.ToString(), Font, textarea, aircraftColor, textformatBottomRight); } // 改修レベル描画 if (slot.Level > 0) { if (LevelVisibility == LevelVisibilityFlag.LevelOnly || LevelVisibility == LevelVisibilityFlag.Both || LevelVisibility == LevelVisibilityFlag.AircraftLevelOverlay || (LevelVisibility == LevelVisibilityFlag.LevelPriority && (!_onMouse || slot.AircraftLevel == 0)) || (LevelVisibility == LevelVisibilityFlag.AircraftLevelPriority && (_onMouse || slot.AircraftLevel == 0))) { TextRenderer.DrawText(e.Graphics, slot.Level >= 10 ? "★" : "+" + slot.Level, Font, new Rectangle(origin.X + LayoutParam.ImageSize.Width, origin.Y + LayoutParam.InfoAreaSize.Height * 1 / 4 - LayoutParam.Digit2Size.Height / 2, LayoutParam.InfoAreaSize.Width, LayoutParam.Digit2Size.Height), EquipmentLevelColor, textformatTopRight); } } // 艦載機熟練度描画 if (slot.AircraftLevel > 0) { if (LevelVisibility == LevelVisibilityFlag.AircraftLevelOnly || LevelVisibility == LevelVisibilityFlag.Both || (LevelVisibility == LevelVisibilityFlag.AircraftLevelPriority && (!_onMouse || slot.Level == 0)) || (LevelVisibility == LevelVisibilityFlag.LevelPriority && (_onMouse || slot.Level == 0))) { // 右上に描画 if (ShowAircraftLevelByNumber) { var area = new Rectangle(origin.X + LayoutParam.ImageSize.Width, origin.Y + LayoutParam.InfoAreaSize.Height * 1 / 4 - LayoutParam.Digit2Size.Height / 2, LayoutParam.InfoAreaSize.Width, LayoutParam.Digit2Size.Height); TextRenderer.DrawText(e.Graphics, slot.AircraftLevel.ToString(), Font, area, GetAircraftLevelColor(slot.AircraftLevel), textformatTopRight); } else { var area = new Rectangle(origin.X + LayoutParam.ImageSize.Width, origin.Y, LayoutParam.ImageSize.Width, LayoutParam.ImageSize.Height); e.Graphics.DrawImage(ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.AircraftLevelTop0 + slot.AircraftLevel], area); } } else if (LevelVisibility == LevelVisibilityFlag.AircraftLevelOverlay) { // 左上に描画 if (ShowAircraftLevelByNumber) { var area = new Rectangle(origin.X, origin.Y, LayoutParam.Digit2Size.Width / 2, LayoutParam.Digit2Size.Height); e.Graphics.FillRectangle(_overlayBrush, area); TextRenderer.DrawText(e.Graphics, slot.AircraftLevel.ToString(), Font, area, GetAircraftLevelColor(slot.AircraftLevel), textformatTopLeft); } else { e.Graphics.FillRectangle(_overlayBrush, new Rectangle(origin.X, origin.Y, LayoutParam.ImageSize.Width, LayoutParam.ImageSize.Height / 2)); e.Graphics.DrawImage(ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.AircraftLevelTop0 + slot.AircraftLevel], new Rectangle(origin, LayoutParam.ImageSize)); } } } } }
/// <summary> /// スロット情報を設定します。主に敵艦用です。 /// </summary> /// <param name="ship">当該艦船。</param> public void SetSlotList( ShipDataMaster ship ) { if ( SlotList.Length != ship.Aircraft.Count ) { SlotList = new SlotItem[ship.Aircraft.Count]; for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i] = new SlotItem(); } } for ( int i = 0; i < SlotList.Length; i++ ) { SlotList[i].EquipmentID = ship.DefaultSlot == null ? -1 : ( ship.DefaultSlot.Count < i ? ship.DefaultSlot[i] : -1 ); SlotList[i].AircraftCurrent = SlotList[i].AircraftMax = ship.Aircraft[i]; SlotList[ship.SlotSize].Level = SlotList[ship.SlotSize].AircraftLevel = 0; } SlotSize = ship.SlotSize; PropertyChanged(); }
private void OnTakeOffItem(SlotItem slotItem) { TakeOffItem(slotItem); }
private void OnPutOnItem(SlotItem slotItem) { PutOnItem(slotItem); }
private static void VirtualClient_ItemSlotChangedCallback(VirtualClient virtualClient, byte window, UInt16 slot, SlotItem slotItem) { if (!(window == 1 && slot == 0)) { return; } itemStats = slotItem.ItemStats; timer.Stop(); timer.Start(); }
public OnairEventArgs(SlotItem slot) { this.onairslot = slot; }
private void ShipStatusEquipment_Paint(object sender, PaintEventArgs e) { Rectangle basearea = new Rectangle(Padding.Left, Padding.Top, Width - Padding.Horizontal, Height - Padding.Vertical); //e.Graphics.DrawRectangle( Pens.Magenta, basearea.X, basearea.Y, basearea.Width - 1, basearea.Height - 1 ); ImageList eqimages = ResourceManager.Instance.Equipments; TextFormatFlags textformat = TextFormatFlags.NoPadding; if (!OverlayAircraft) { textformat |= TextFormatFlags.Bottom | TextFormatFlags.Right; } else { textformat |= TextFormatFlags.Top | TextFormatFlags.Left; } // 艦載機スロット表示の予測サイズ(2桁) Size sz_eststr = TextRenderer.MeasureText("99", Font, new Size(int.MaxValue, int.MaxValue), textformat); sz_eststr.Width -= (int)(Font.Size / 2.0); // スロット1つ当たりのサイズ(右の余白含む) Size sz_unit = new Size(eqimages.ImageSize.Width + SlotMargin, eqimages.ImageSize.Height); if (ShowAircraft) { if (!OverlayAircraft) { sz_unit.Width += sz_eststr.Width; } sz_unit.Height = Math.Max(sz_unit.Height, sz_eststr.Height); } for (int slotindex = 0; slotindex < SlotList.Length; slotindex++) { SlotItem slot = SlotList[slotindex]; Image image = null; if (slotindex >= SlotSize && slot.EquipmentID != -1) { //invalid! using (SolidBrush b = new SolidBrush(InvalidSlotColor)) { e.Graphics.FillRectangle(b, new Rectangle(basearea.X + sz_unit.Width * slotindex, basearea.Y, sz_unit.Width, sz_unit.Height)); } } if (slot.EquipmentID == -1) { if (slotindex < SlotSize) { //nothing image = eqimages.Images[(int)ResourceManager.EquipmentContent.Nothing]; } else { //locked image = eqimages.Images[(int)ResourceManager.EquipmentContent.Locked]; } } else { int imageID = slot.EquipmentIconID; if (imageID <= 0 || (int)ResourceManager.EquipmentContent.Locked <= imageID) { imageID = (int)ResourceManager.EquipmentContent.Unknown; } image = eqimages.Images[imageID]; } if (image != null) { Rectangle imagearea = new Rectangle(basearea.X + sz_unit.Width * slotindex, basearea.Y, eqimages.ImageSize.Width, eqimages.ImageSize.Height); e.Graphics.DrawImage(image, imagearea); } Color aircraftColor = AircraftColorDisabled; bool drawAircraftSlot = ShowAircraft; if (slot.EquipmentID != -1) { if (Calculator.IsAircraft(slot.EquipmentID, true)) { if (slot.AircraftMax == 0) { aircraftColor = AircraftColorDisabled; } else if (slot.AircraftCurrent == 0) { aircraftColor = AircraftColorLost; } else if (slot.AircraftCurrent < slot.AircraftMax) { aircraftColor = AircraftColorDamaged; } else { aircraftColor = AircraftColorFull; } } else { if (slot.AircraftMax == 0) { drawAircraftSlot = false; } } } else if (slot.AircraftMax == 0) { drawAircraftSlot = false; } if (drawAircraftSlot) { Rectangle textarea = new Rectangle(basearea.X + sz_unit.Width * slotindex, basearea.Y, sz_unit.Width - SlotMargin, sz_unit.Height); if (OverlayAircraft) { using (SolidBrush b = new SolidBrush(Color.FromArgb(0x80, 0xFF, 0xFF, 0xFF))) { e.Graphics.FillRectangle(b, new Rectangle(textarea.X, textarea.Y, sz_eststr.Width, sz_eststr.Height)); } } else { if (slot.AircraftCurrent < 10) { //1桁なら画像に近づける textarea.Width -= sz_eststr.Width / 2 - 1; } else if (slot.AircraftCurrent >= 100) { //3桁以上ならオーバーレイを入れる Size sz_realstr = TextRenderer.MeasureText(slot.AircraftCurrent.ToString(), Font, new Size(int.MaxValue, int.MaxValue), textformat); sz_realstr.Width -= (int)(Font.Size / 2.0); using (SolidBrush b = new SolidBrush(Color.FromArgb(0x80, 0xFF, 0xFF, 0xFF))) { e.Graphics.FillRectangle(b, new Rectangle( textarea.X + sz_unit.Width - sz_realstr.Width, textarea.Y + sz_unit.Height - sz_realstr.Height, sz_realstr.Width, sz_realstr.Height)); } } } TextRenderer.DrawText(e.Graphics, slot.AircraftCurrent.ToString(), Font, textarea, aircraftColor, textformat); } } }