public ObjectSlotsManager(ProcessStream stream, ObjectAssociations objAssoc, ObjectManager objManager, ObjectSlotManagerGui managerGui, MapManager mapManager, MiscManager miscManager) { ObjectAssoc = objAssoc; _stream = stream; _objManager = objManager; ManagerGui = managerGui; _mapManager = mapManager; _miscManager = miscManager; // Add MapToggleModes ManagerGui.MapObjectToggleModeComboBox.DataSource = Enum.GetValues(typeof(MapToggleModeType)); ManagerGui.MapObjectToggleModeComboBox.SelectedItem = MapToggleModeType.Single; // Add SortMethods ManagerGui.SortMethodComboBox.DataSource = Enum.GetValues(typeof(ObjectSlotsManager.SortMethodType)); ManagerGui.SortMethodComboBox.SelectedItem = SortMethodType.ProcessingOrder; // Add LabelMethods ManagerGui.LabelMethodComboBox.DataSource = Enum.GetValues(typeof(ObjectSlotsManager.SlotLabelType)); ManagerGui.LabelMethodComboBox.SelectedItem = SlotLabelType.Recommended; // Create and setup object slots ObjectSlots = new ObjectSlot[Config.ObjectSlots.MaxSlots]; for (int i = 0; i < Config.ObjectSlots.MaxSlots; i++) { var objectSlot = new ObjectSlot(i, this, ManagerGui, new Size(DefaultSlotSize, DefaultSlotSize)); ObjectSlots[i] = objectSlot; objectSlot.Click += (sender, e) => OnClick(sender, e); ManagerGui.FlowLayoutContainer.Controls.Add(objectSlot); } // Change default ChangeSlotSize(DefaultSlotSize); }
protected override void Read(Client psr, NReader rdr) { Time = rdr.ReadInt32(); SlotObject = ObjectSlot.Read(psr, rdr); ItemUsePos = Position.Read(psr, rdr); UseType = rdr.ReadByte(); }
protected override void Read(NReader rdr) { Time = rdr.ReadInt32(); Position = Position.Read(rdr); Obj1 = ObjectSlot.Read(rdr); Obj2 = ObjectSlot.Read(rdr); }
protected override void Read(Client psr, NReader rdr) { Time = rdr.ReadInt32(); Position = Position.Read(psr, rdr); SlotObject1 = ObjectSlot.Read(psr, rdr); SlotObject2 = ObjectSlot.Read(psr, rdr); }
public ObjectSlotsManager(ObjectSlotManagerGui managerGui, TabControl tabControlMain) { ManagerGui = managerGui; // Add SortMethods ManagerGui.SortMethodComboBox.DataSource = Enum.GetValues(typeof(ObjectSlotsManager.SortMethodType)); // Add LabelMethods ManagerGui.LabelMethodComboBox.DataSource = Enum.GetValues(typeof(ObjectSlotsManager.SlotLabelType)); ManagerGui.TabControl.Selected += TabControl_Selected; TabControl_Selected(this, new TabControlEventArgs(ManagerGui.TabControl.SelectedTab, -1, TabControlAction.Selected)); // Create and setup object slots ObjectSlot.tabControlMain = tabControlMain; ObjectSlots = new ObjectSlot[ObjectSlotsConfig.MaxSlots]; for (int i = 0; i < ObjectSlotsConfig.MaxSlots; i++) { var objectSlot = new ObjectSlot(i, this, ManagerGui, new Size(DefaultSlotSize, DefaultSlotSize)); ObjectSlots[i] = objectSlot; objectSlot.Click += (sender, e) => OnSlotClick(sender, e); ManagerGui.FlowLayoutContainer.Controls.Add(objectSlot); } // Change default ChangeSlotSize(DefaultSlotSize); }
public ObjectSlot ClaimEnemySlot(GameObject go, int desiredIndex = -1, bool failIfNotOpen = false) { if (!enemySlots.anyOpenSlots) { return(null); } if (desiredIndex < 0) { desiredIndex = UnityEngine.Random.Range(0, enemySlots.maxSlots); } ObjectSlot slot = null; if (failIfNotOpen) { slot = enemySlots.ClaimSlot(go, desiredIndex); } else { for (int i = 0; i < enemySlots.maxSlots; i++) { var index = (desiredIndex + i) % enemySlots.maxSlots; slot = enemySlots.ClaimSlot(go, index); if (slot) { break; } } } return(slot); }
public void Play(int desiredIndex = -1, bool failIfNotOpen = false) { if (!AssertOwner(Owner.Player, Owner.Enemy)) { return; } ObjectSlot nextSlot = null; if (owner == Owner.Player) { if (!AssertState(State.InHand)) { return; } nextSlot = LaneManager.instance.ClaimPlayerSlot(gameObject); } else { nextSlot = LaneManager.instance.ClaimEnemySlot(gameObject, desiredIndex, failIfNotOpen); } if (nextSlot != null) { AudioManager.instance.PlayCardSound(); OnPlaying(); currSlot = nextSlot; ChangeState(State.Playing); } else { OnNoRoomForCard(); } }
public ObjectSlotsManager(ObjectSlotManagerGui gui, TabControl tabControlMain) { _gui = gui; // Add SortMethods adn LabelMethods _gui.SortMethodComboBox.DataSource = Enum.GetValues(typeof(SortMethodType)); _gui.LabelMethodComboBox.DataSource = Enum.GetValues(typeof(SlotLabelType)); _gui.SelectionMethodComboBox.DataSource = Enum.GetValues(typeof(SelectionMethodType)); _gui.TabControl.Selected += TabControl_Selected; TabControl_Selected(this, new TabControlEventArgs(_gui.TabControl.SelectedTab, -1, TabControlAction.Selected)); // Create and setup object slots ObjectSlots = new List <ObjectSlot>(); foreach (int i in Enumerable.Range(0, ObjectSlotsConfig.MaxSlots)) { var objectSlot = new ObjectSlot(this, i, _gui, new Size(DefaultSlotSize, DefaultSlotSize)); objectSlot.Click += (sender, e) => OnSlotClick(sender, e); ObjectSlots.Add(objectSlot); _gui.FlowLayoutContainer.Controls.Add(objectSlot); } ; SlotLabelsForObjects = new ReadOnlyDictionary <ObjectDataModel, string>(_slotLabels); }
public void MoveToHand() { if (state == State.InHand) { Debug.Log("Cannot move to hand, card is already in hand"); return; } var nextSlot = Hand.instance.ClaimASlot(this); if (nextSlot != null) { switch (state) { case State.InPool: //TODO initialize for moving from pool break; case State.InDeck: break; //TODO initialize for moving from deck default: //Dunno what's going on-- force initial settings break; } currSlot = nextSlot; ChangeState(State.MovingToHand); } else { Debug.LogError("Tried to move to hand but the hand was full!"); Bail(); } }
protected override void Read(ClientProcessor psr, NReader rdr) { Time = rdr.ReadInt32(); Position = Position.Read(rdr); Obj1 = ObjectSlot.Read(rdr); Obj2 = ObjectSlot.Read(rdr); }
protected override void Read(DReader rdr) { Time = rdr.ReadInt32(); Position = Position.Read(rdr); SlotObject1 = ObjectSlot.Read(rdr); SlotObject2 = ObjectSlot.Read(rdr); }
public Node(NodeCommon nodeCommon, ObjectSlot objectSlot, Func <object> recreate, bool isForMinor, Option <DAlterTotalMajorCountToParent> parent) { NodeCommon = nodeCommon; ObjectSlot = objectSlot; Recreate = recreate; IsForMinor = isForMinor; Parent = parent; }
protected override void Read(NReader rdr) { PetTransType = rdr.ReadByte(); PetId1 = rdr.ReadInt32(); PetId2 = rdr.ReadInt32(); ObjectId = rdr.ReadInt32(); SlotObject = ObjectSlot.Read(rdr); PaymentTransType = (CurrencyType)rdr.ReadByte(); }
protected override void Write(Client client, NWriter wtr) { wtr.Write(CommandId); wtr.Write(PetId1); wtr.Write(PetId2); wtr.Write(ObjectId); ObjectSlot.Write(client, wtr); wtr.Write((byte)Currency); }
public void SelectSlotByAddress(uint address) { ObjectSlot slot = ObjectSlots.FirstOrDefault(s => s.CurrentObject.Address == address); if (slot != null) { DoSlotClickUsingInput(slot, false, false, false, null); } }
public void SelectSlotByAddress(uint address) { ObjectSlot slot = ObjectSlots.FirstOrDefault(s => s.CurrentObject.Address == address); if (slot != null) { DoSlotClickUsingSpecifications(slot, ClickType.ObjectClick, false, false, Config.ObjectManager.Tab, null); } }
protected override void Read(Client client, NReader rdr) { CommandId = rdr.ReadByte(); PetId1 = rdr.ReadInt32(); PetId2 = rdr.ReadInt32(); ObjectId = rdr.ReadInt32(); ObjectSlot = ObjectSlot.Read(client, rdr); Currency = (CurrencyType)rdr.ReadByte(); }
private void DoSlotClickUsingInput( ObjectSlot selectedSlot, bool isCtrlKeyHeld, bool isShiftKeyHeld, bool isAltKeyHeld) { ClickType click = GetClickType(isAltKeyHeld); bool shouldToggle = ShouldToggle(isCtrlKeyHeld, isAltKeyHeld); bool shouldExtendRange = isShiftKeyHeld; DoSlotClickUsingSpecifications(selectedSlot, click, shouldToggle, shouldExtendRange); }
private void OnPlaying() { if (currSlot != null) { currSlot.Release(); currSlot = null; } AudioManager.instance.PlayCardSound(); //TODO any inital set or tear down from being in the hand (deregister from input manager) }
public uint?GetSlotAddressFromName(string name) { if (name == null) { return(null); } name = name.ToLower().Trim(); ObjectSlot slot = ObjectSlots.FirstOrDefault(s => s.Text.ToLower() == name); return(slot?.Address); }
public ObjectDataModel GetObjectFromLabel(string name) { if (name == null) { return(null); } name = name.ToLower().Trim(); ObjectSlot slot = ObjectSlots.FirstOrDefault(s => s.Text.ToLower() == name); return(slot?.CurrentObject); }
private void DoSlotClickUsingInput( ObjectSlot selectedSlot, bool isCtrlKeyHeld, bool isShiftKeyHeld, bool isAltKeyHeld, int?numberHeld) { bool isMarking = isAltKeyHeld || numberHeld.HasValue; int? markedColor = isAltKeyHeld ? 10 : numberHeld; ClickType click = GetClickType(isMarking); bool shouldToggle = ShouldToggle(isCtrlKeyHeld, isMarking); bool shouldExtendRange = isShiftKeyHeld; TabPage tabDestination = GetTabDestination(isMarking); DoSlotClickUsingSpecifications(selectedSlot, click, shouldToggle, shouldExtendRange, tabDestination, markedColor); }
protected override void Read(Client client, NReader rdr) { Fuel = ObjectSlot.Read(client, rdr); Slot1 = ObjectSlot.Read(client, rdr); Slot2 = ObjectSlot.Read(client, rdr); Slot3 = ObjectSlot.Read(client, rdr); Slot4 = ObjectSlot.Read(client, rdr); Slot5 = ObjectSlot.Read(client, rdr); Slot6 = ObjectSlot.Read(client, rdr); Slot7 = ObjectSlot.Read(client, rdr); Slot8 = ObjectSlot.Read(client, rdr); Slot9 = ObjectSlot.Read(client, rdr); }
void UpdateMapObject(ObjectSlotData objData, ObjectSlot objSlot, BehaviorCriteria behaviorCriteria) { if (ActiveTab != TabType.Map || !Config.MapManager.IsLoaded) { return; } var objAddress = objData.Address; // Update image var mapObjImage = Config.ObjectAssociations.GetObjectMapImage(behaviorCriteria); var mapObjRotates = Config.ObjectAssociations.GetObjectMapRotates(behaviorCriteria); if (!_mapObjects.ContainsKey(objAddress)) { var mapObj = new MapObject(mapObjImage); mapObj.UsesRotation = mapObjRotates; _mapObjects.Add(objAddress, mapObj); Config.MapManager.AddMapObject(mapObj); } else if (_mapObjects[objAddress].Image != mapObjImage) { Config.MapManager.RemoveMapObject(_mapObjects[objAddress]); var mapObj = new MapObject(mapObjImage); mapObj.UsesRotation = mapObjRotates; _mapObjects[objAddress] = mapObj; Config.MapManager.AddMapObject(mapObj); } if (objData.Behavior == (Config.ObjectAssociations.MarioBehavior & 0x00FFFFFF) + Config.ObjectAssociations.BehaviorBankStart) { _mapObjects[objAddress].Show = false; } else { // Update map object coordinates and rotation var mapObj = _mapObjects[objAddress]; mapObj.Show = SelectedOnMapSlotsAddresses.Contains(objAddress); objSlot.Show = _mapObjects[objAddress].Show; mapObj.X = Config.Stream.GetSingle(objAddress + ObjectConfig.XOffset); mapObj.Y = Config.Stream.GetSingle(objAddress + ObjectConfig.YOffset); mapObj.Z = Config.Stream.GetSingle(objAddress + ObjectConfig.ZOffset); mapObj.IsActive = objData.IsActive; mapObj.Transparent = !mapObj.IsActive; ushort objYaw = Config.Stream.GetUInt16(objAddress + ObjectConfig.YawFacingOffset); mapObj.Rotation = (float)MoreMath.AngleUnitsToDegrees(objYaw); mapObj.UsesRotation = Config.ObjectAssociations.GetObjectMapRotates(behaviorCriteria); } }
public ObjectSlot ClaimASlot(GameObject go) { ObjectSlot freeSlot = null; foreach (var slot in slots) { if (slot.open) { freeSlot = slot; freeSlot.Claim(go); break; } } return(freeSlot); }
public void Discard() { if (!AssertState(State.MovingToPool, State.InPool, State.InLane)) { return; } if (currSlot) { currSlot.Release(); currSlot = null; } //TODO start scaling down to discard size? MoveToDiscard(); }
public ObjectSlot ClaimSlot(GameObject go, int index) { ObjectSlot freeSlot = null; if (index < slots.Count && index >= 0) { var slot = slots[index]; if (slot.open) { freeSlot = slot; freeSlot.Claim(go); } } return(freeSlot); }
public void OnSlotDropAction(DropAction dropAction, ObjectSlot objSlot) { switch (dropAction.Action) { case DropAction.ActionType.Mario: // Move mario to object var objectAddress = objSlot.Address; MarioActions.MoveMarioToObject(_stream, objectAddress); break; case DropAction.ActionType.Object: break; default: return; } }
private void OnSlotClick(object sender, EventArgs e) { // Make sure the tab has loaded if (_gui.TabControl.SelectedTab == null) { return; } ObjectSlot selectedSlot = sender as ObjectSlot; selectedSlot.Focus(); bool isCtrlKeyHeld = KeyboardUtilities.IsCtrlHeld(); bool isShiftKeyHeld = KeyboardUtilities.IsShiftHeld(); bool isAltKeyHeld = KeyboardUtilities.IsAltHeld(); DoSlotClickUsingInput(selectedSlot, isCtrlKeyHeld, isShiftKeyHeld, isAltKeyHeld); }
private void OnSlotClick(object sender, EventArgs e) { // Make sure the tab has loaded if (mainForm.tabControlMain.SelectedTab == null) { return; } ObjectSlot selectedSlot = sender as ObjectSlot; selectedSlot.Focus(); bool isCtrlKeyHeld = KeyboardUtilities.IsCtrlHeld(); bool isShiftKeyHeld = KeyboardUtilities.IsShiftHeld(); bool isAltKeyHeld = KeyboardUtilities.IsAltHeld(); int? numberHeld = KeyboardUtilities.GetCurrentlyInputtedNumber(); DoSlotClickUsingInput(selectedSlot, isCtrlKeyHeld, isShiftKeyHeld, isAltKeyHeld, numberHeld); }
protected override void Read(Client psr, NReader rdr) { SlotObject = ObjectSlot.Read(psr, rdr); }
protected override void Read(Client client, NReader rdr) { Slot = ObjectSlot.Read(rdr); }
protected override void Read(NReader rdr) { Slot = ObjectSlot.Read(rdr); }
protected override void Read(ClientProcessor psr, NReader rdr) { Slot = ObjectSlot.Read(rdr); }