private void OnSkillChanged(SkillSlot slot) { this.icon.sprite = Resources.Load <Sprite>(Slot.Skill.Icon); this.icon.enabled = !Slot.Skill.IsEmpty(); this.weaponBorder.gameObject.SetActive(Slot.SkillType == SkillType.Weapon); this.ultimateBorder.gameObject.SetActive(Slot.Skill.Rarity?.Type == RarityType.Legendary); this.draggableSkill.Change(slot.Skill); if (slot.Skill.GetSkills().Count > 0) { this.skillMenu.gameObject.SetActive(true); this.skillMenu.Refresh(slot.Skill.GetSkills()); } else { this.skillMenu.gameObject.SetActive(false); } if (slot.Skill.IsOnCooldown()) { ShowCooldown(); SetCooldown(slot.Skill.RemainingCooldown, slot.Skill.Cooldown); } else { HideCooldown(); } MaybeMarkAsUnavailable(); }
public void Initialize(SkillSlot slot) { this.slot = slot; this.slot.SkillChanged += OnSkillChanged; OnSkillChanged(this.slot); }
bool checkActiveSkill(Monster mon, SkillSlot ss) { if (mon.isPlayerSide && mon.monsterUISlotIndex > -1) { if (activeSkillDuration > 0) { return(UIPlay.getUnitSlot(mon.monsterUISlotIndex).checkActiveSkillDuration()); } else { return(UIPlay.getUnitSlot(mon.monsterUISlotIndex).unitSlot.canUseOneShotUnitSkill); } } else if (mon.aiUnitSlot != null) { if (activeSkillDuration > 0) { return(mon.aiUnitSlot.checkActiveSkillDuration()); } else { return(mon.aiUnitSlot.canUseOneShotUnitSkill); } } return(false); }
public void updateTalentSkillCD(Player curPlayer) { if (((curPlayer != null) && (curPlayer.Captain != 0)) && (curPlayer.Captain.handle.SkillControl != null)) { SkillSlot slot = curPlayer.Captain.handle.SkillControl.SkillSlotArray[5]; if (slot == null) { this.talentSkill.CustomSetActive(false); } else { if (!string.IsNullOrEmpty(slot.SkillObj.IconName)) { this.talentSkillImage.SetSprite(CUIUtility.s_Sprite_Dynamic_Skill_Dir + slot.SkillObj.IconName, Singleton <CUIManager> .GetInstance().GetForm(BattleStatView.s_battleStateViewUIForm), true, false, false); } this.talentSkill.CustomSetActive(true); if (slot.CurSkillCD > 0) { this.talentSkillCD.text = SimpleNumericString.GetNumeric(Mathf.FloorToInt(((float)slot.CurSkillCD) * 0.001f)); this.talentSkillImage.color = CUIUtility.s_Color_Grey; } else { this.talentSkillCD.text = string.Empty; this.talentSkillImage.color = CUIUtility.s_Color_Full; } } } }
private static void SkillFuncChangeSkillCDImpl(ref SSkillFuncContext inContext, int changeType, int slotMask, int value) { PoolObjHandle <ActorRoot> inTargetObj = inContext.inTargetObj; if (inTargetObj != 0) { SkillComponent skillControl = inTargetObj.handle.SkillControl; if (skillControl != null) { SkillSlot slot = null; for (int i = 0; i < 7; i++) { if (((((slotMask == 0) && (i != 0)) && ((i != 4) && (i != 5))) || ((slotMask & (((int)1) << i)) > 0)) && (skillControl.TryGetSkillSlot((SkillSlotType)i, out slot) && (slot != null))) { if (changeType == 0) { slot.ChangeSkillCD(value); } else { slot.ChangeMaxCDRate(value); } } } } } }
// Use this for initialization void Start() { /* Initialises all Skill Slots of Character */ skillSlots = new SkillSlot[4]; // Set to 4 Skill Slots /* Retrieves and initialises the Skill Data source */ this.skillDataSource = this.gameObject.GetComponent <SkillData>(); /* Retrieves and initialises the Skill Info Box */ this.skillInfoBoxObject = GameObject.Find("SkillInfo"); for (int i = 0; i < this.skillSlots.Length; i++) { skillSlots[i] = new SkillSlot(this.skillSlotObjects[i], this.skillLocked, false); // Initially, all Skill Slots are disabled this.skillInfoObjects[i].text = ""; // Empty Skill Info for disabled Skill Slots } /* Retrieves the number of Skills available */ this.setCharSkillsNum(this.skillDataSource.getNumStoredSkills()); /* Initialises all Skills available to the Character */ charSkills = new CharSkill[this.getCharSkillsNum()]; /* Hides the Skill Info Box initially */ this.skillInfoBoxObject.SetActive(false); }
private void SetKnownSkills() { foreach (var skill in player.knownSkills) { SkillSlot skillSlot = Instantiate(skillPrefab, availableSkillsList.transform).GetComponent <SkillSlot>(); //Set icon foreach (var skillIcon in skillIcons) { if (skillIcon.skillID == skill.SkillID) { skillSlot.icon = skillIcon.GetComponent <Image>(); skillSlot.GetComponentInChildren <Image>().sprite = skillSlot.icon.sprite; } } skillSlot.GetComponent <Button>().interactable = true; skillSlot.OnSkillClicked += KnownSkillClicked; skillSlot.skill = skill; Skill newSkill = skillSlot.skill; newSkill.SkillID = skill.SkillID; newSkill.SkillName = skill.SkillName; newSkill.SkillType = skill.SkillType; newSkill.DamageModifier = skill.DamageModifier; newSkill.EnergyCost = skill.EnergyCost; } }
void Start() { button = GetComponent <Button>(); skillSlot = transform.GetComponentInParent <SkillSlot>(); playerInfo = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInfo>(); playerAttack = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAttack>(); }
public void SwitchActor(ref PoolObjHandle <ActorRoot> actor) { if (actor != this._curActor) { this._curActor = actor; SkillSlot[] skillSlotArray = actor.handle.SkillControl.SkillSlotArray; for (int i = 0; (i < this._skillItems.Length) && ((i + 1) < skillSlotArray.Length); i++) { SkillSlotType type = (SkillSlotType)(i + 1); SkillSlot slot = skillSlotArray[i + 1]; GameObject obj2 = this._skillItems[i]; if (obj2 != null) { if (slot != null) { obj2.CustomSetActive(true); this._skillIcons[i].SetSprite(CUIUtility.s_Sprite_Dynamic_Skill_Dir + slot.SkillObj.IconName, Singleton <CBattleSystem> .GetInstance().WatchFormScript, true, false, false); this._skillLevelRoots[i].CustomSetActive((type >= SkillSlotType.SLOT_SKILL_1) && (type <= SkillSlotType.SLOT_SKILL_3)); this.ValidateLevel(type); this.ValidateCD(type); } else { obj2.CustomSetActive(false); } } } } }
public MsgRemove(SkillSlot slot, CharacterBody target, float cooldown, int stock) { _slot = slot; _target = target; _cooldown = cooldown; _stock = stock; }
public static SkillFamily GetSkillFamily(GameObject prefab, SkillSlot slot) { SkillLocator skillLocator = prefab.GetComponent <SkillLocator>(); if (skillLocator) { switch (slot) { case SkillSlot.Primary: return(skillLocator.primary.skillFamily); case SkillSlot.Secondary: return(skillLocator.secondary.skillFamily); case SkillSlot.Utility: return(skillLocator.utility.skillFamily); case SkillSlot.Special: return(skillLocator.special.skillFamily); default: return(skillLocator.primary.skillFamily); } } return(null); }
public void UnEquip(SkillSlot slot) { var plr = _character.CharacterManager.Player; if (plr.Room != null && plr.RoomInfo.State != PlayerState.Lobby) // Cant change items while playing { throw new CharacterException("Can't change items while playing"); } PlayerItem item; switch (slot) { case SkillSlot.Skill: item = _items[(int)slot]; if (item != null) { _character.NeedsToSave = true; _items[(int)slot] = null; } break; default: throw new CharacterException("Invalid slot: " + slot); } plr.Session.Send(new SUseItemAckMessage { CharacterSlot = _character.Slot, ItemId = item?.Id ?? 0, Action = UseItemAction.UnEquip, EquipSlot = (byte)slot }); }
public void RequestUseSkill(eSkillSlotType slotType) { InputModel.instance.SendStopMove(null, false); if (slotType == eSkillSlotType.SLOT_SKILL_0) { CSkillButtonManager skillButtonManager = CBattleSystem.instance.GetSkillButtonManager(); skillButtonManager.SendUseCommonAttack(0, 0u); skillButtonManager.SendUseCommonAttack(1, 0u); } else if (slotType == eSkillSlotType.SLOT_SKILL_4) { CSkillButtonManager skillButtonManager = CBattleSystem.instance.GetSkillButtonManager(); skillButtonManager.RequestUseSkillSlot(slotType, 1); } else { SkillSlot slot = m_wrapper.actor.pSkillCtrl.GetSkillSlot(slotType); if (slot.SkillObj.AppointType == SkillRangeAppointType.Pos) { slot.skillIndicator.SetRobotSkillUsePosition(); } m_wrapper.actor.pSkillCtrl.RequestUseSkillSlot(slotType); } // RealUseSkill(slotType); }
private void SetEquippedSkills() { foreach (var skill in player.equippedSkills) { SkillSlot skillSlot = Instantiate(skillPrefab, equippedSkillsList.transform).GetComponent <SkillSlot>(); //Set icon foreach (var skillIcon in skillIcons) { if (skillIcon.skillID == skill.SkillID) { skillSlot.icon = skillIcon.GetComponent <Image>(); skillSlot.GetComponentInChildren <Image>().sprite = skillSlot.icon.sprite; } } skillSlot.skill = skill; Skill newSkill = skillSlot.skill; newSkill.SkillID = skill.SkillID; newSkill.SkillName = skill.SkillName; newSkill.SkillType = skill.SkillType; newSkill.DamageModifier = skill.DamageModifier; newSkill.EnergyCost = skill.EnergyCost; playerEquippedSkills.Add(skillSlot); } }
public void updateTalentSkillCD(Player curPlayer, CUIFormScript parentFormScript) { if (curPlayer == null || !curPlayer.Captain || curPlayer.Captain.get_handle().SkillControl == null) { return; } SkillSlot skillSlot = curPlayer.Captain.get_handle().SkillControl.SkillSlotArray[5]; if (skillSlot == null) { this.talentSkill.CustomSetActive(false); } else { if (!string.IsNullOrEmpty(skillSlot.SkillObj.IconName)) { this.talentSkillImage.SetSprite(CUIUtility.s_Sprite_Dynamic_Skill_Dir + skillSlot.SkillObj.IconName, parentFormScript, true, false, false, false); } this.talentSkill.CustomSetActive(true); if (skillSlot.CurSkillCD > 0) { this.talentSkillCD.text = SimpleNumericString.GetNumeric(Mathf.FloorToInt((float)skillSlot.CurSkillCD * 0.001f)); this.talentSkillImage.color = CUIUtility.s_Color_Grey; } else { this.talentSkillCD.text = string.Empty; this.talentSkillImage.color = CUIUtility.s_Color_Full; } } }
public override void ChangeSlot(ButtonSlotBase sourceSlot) { if (sourceSlot == null) { return; } SkillSlot sourceSkillSlot = sourceSlot.GetComponent <SkillSlot>(); // Reset Icon Color. sourceSkillSlot.isIconColorResetTrigger = true; isIconColorResetTrigger = true; Sprite sourceIcon = sourceSkillSlot.icon.sprite; Skill sourceSkill = sourceSkillSlot.skill; sourceSkillSlot.AddSkill(this.icon.sprite, this.skill); AddSkill(sourceIcon, sourceSkill); // 若起始選取的技能欄位是快捷鍵,則同步更新戰鬥畫面上的UI技能欄 if (slotBeginDrag.slotType == SlotType.MenuHotKey) { MenuSkillSlot menuSkillSlot = slotBeginDrag.GetComponent <MenuSkillSlot>(); menuSkillSlot.linkSkillSlotOnCombatUI.AddSkill(sourceSlot.icon.sprite, sourceSkillSlot.skill); menuSkillSlot.linkSkillSlotOnCombatUI.isIconColorResetTrigger = true; } }
/// <summary> /// Keeps track of last non-null interacted slots. /// </summary> /// <param name="obj">Clicked slot.</param> public virtual void OnSkillClick(GameObject obj) { if (!skillIsDragged && MouseData.skillInterfaceMouseIsOver != null && MouseData.skillSlotHoveredOver != null) { lastSkillSlot = MouseData.skillInterfaceMouseIsOver.skillsOnInterface[MouseData.skillSlotHoveredOver]; } }
public bool RegisterScepterSkill(SkillDef replacingDef, string targetBodyName, SkillSlot targetSlot, SkillDef targetVariantDef) { if (replacingDef == null) { ClassicItemsPlugin._logger.LogError("Can't register a null scepter skill"); return(false); } if (targetVariantDef == null) { ClassicItemsPlugin._logger.LogError($"Can't register scepter skill {replacingDef.skillNameToken} to null target variant"); return(false); } var existing = scepterReplacers.Find(x => x.bodyName == targetBodyName && (x.slotIndex != targetSlot || x.targetDef == targetVariantDef)); if (existing != null) { if (allow3POverride) { ClassicItemsPlugin._logger.LogMessage($"{targetBodyName}/{targetSlot}/{targetVariantDef.skillNameToken}: overriding existing replacer {existing.replDef.skillNameToken} with {replacingDef.skillNameToken}"); scepterReplacers.Remove(existing); } else { ClassicItemsPlugin._logger.LogError($"A scepter skill already exists for {targetBodyName}/{targetSlot}/{targetVariantDef.skillNameToken}; can't add multiple for different slots nor for the same variant (attemping to add {replacingDef.skillNameToken})"); return(false); } } ClassicItemsPlugin._logger.LogDebug($"{targetBodyName}/{targetSlot}/{targetVariantDef.skillNameToken}: Added override to {replacingDef.skillNameToken}"); scepterReplacers.Add(new ScepterReplacer { bodyName = targetBodyName, slotIndex = targetSlot, targetDef = targetVariantDef, replDef = replacingDef }); scepterSlots[targetBodyName] = targetSlot; return(true); }
void Start() { CharacterStatus stat = GetComponent <CharacterStatus>(); KeyCode[] codes; string Name; if (stat.Controller == gameManager.CHALLANGER) { Name = "Challanger"; } else { Name = "Champion"; } UserKeyData.ins.SettingKey(stat.Controller, GameData.ins.OnePlayer ? 1 : 2); codes = UserKeyData.ins.GetKeyData(Name); SkillSlot sk = this; SkillList.ins.AddingDefaultSkill(ref sk); SkillList.ins.Skill_DefaultPassive(ref sk); SetItem(Item.GetItem(UseItem)); SetItem(Item.GetItem(EqulpmentItem)); for (int i = 0; i < SlotLength; i++) { SlotList[i].key = codes[i]; if (SlotList[i] != null) { SlotList[i].SetOrder(stat.Controller); } } }
public override void Process(Action _action, Track _track) { base.Process(_action, _track); PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId); if (!actorHandle) { return; } SkillSlot skillSlot = actorHandle.get_handle().SkillControl.GetSkillSlot(this.slotType); if (skillSlot != null) { if (this.clear) { skillSlot.NextSkillTargetIDs.Clear(); } else { PoolObjHandle <ActorRoot> actorHandle2 = _action.GetActorHandle(this.nextSkillTargetID); if (!actorHandle2) { return; } if (skillSlot.NextSkillTargetIDs.IndexOf(actorHandle2.get_handle().ObjID) < 0) { skillSlot.NextSkillTargetIDs.Add(actorHandle2.get_handle().ObjID); } } } }
private void RefreshSkillTab() { Debug.Log("Refresh Skill Tab for " + unitId); skillSlot_1 = skillSlotContainer.Find("Skill_1").GetComponent <SkillSlot>(); if (unitSkills.unitSkill_1) { skillSlot_1.skill = unitSkills.unitSkill_1; skillSlot_1.transform.Find("Image").gameObject.SetActive(true); skillSlot_1.transform.Find("Image").GetComponent <Image>().sprite = unitSkills.unitSkill_1.sprite; } skillSlot_2 = skillSlotContainer.Find("Skill_2").GetComponent <SkillSlot>(); if (unitSkills.unitSkill_2) { skillSlot_2.skill = unitSkills.unitSkill_2; skillSlot_2.transform.Find("Image").gameObject.SetActive(true); skillSlot_2.transform.Find("Image").GetComponent <Image>().sprite = unitSkills.unitSkill_2.sprite; } skillSlot_3 = skillSlotContainer.Find("Skill_3").GetComponent <SkillSlot>(); if (unitSkills.unitSkill_3) { skillSlot_3.skill = unitSkills.unitSkill_3; skillSlot_3.transform.Find("Image").gameObject.SetActive(true); skillSlot_3.transform.Find("Image").GetComponent <Image>().sprite = unitSkills.unitSkill_3.sprite; } }
public void AddMagic(ClientMagic magic) { SkillSlot slot = Instantiate(SkillSlotPrefab, ContentOject.transform).GetComponent <SkillSlot>(); skillSlots.Add(slot); slot.Magic = magic; }
public override void Leave(Action _action, Track _track) { base.Leave(_action, _track); this.targetActor = _action.GetActorHandle(this.targetId); if (!this.targetActor) { if (ActionManager.Instance.isPrintLog) { } return; } this.skillControl = this.targetActor.handle.SkillControl; if (this.skillControl == null) { if (ActionManager.Instance.isPrintLog) { } return; } SkillSlot skillSlot = null; if (!this.useSlotType) { this.StartSkillContextCD(_action, ref skillSlot); } else { this.StartSkillSlotCD(ref skillSlot); } if (skillSlot != null && this.bAbortReduce && _track.curTime <= base.End && !_track.Loop) { skillSlot.ChangeSkillCD(this.abortReduceTime); } }
public void UpdateSkills(CharacterSkills skills) { // Remove skill slots foreach (SkillSlot slot in slots) { Destroy(slot.gameObject); } slots.Clear(); // Add skill slots foreach (Skill skill in skills.Skills) { GameObject slot; if (skill is MagicSkill) { slot = Instantiate(skillSlotPrefab, magicSkillsPanel); } else { slot = Instantiate(skillSlotPrefab, weaponSkillsPanel); } SkillSlot skillSlot = slot.GetComponent <SkillSlot>(); skillSlot.Skill = skill; if (skills.GetActiveSkills().Contains(skill)) { skillSlot.IsActive = true; } slots.Add(skillSlot); } }
private void StartSkillSlotCD(ref SkillSlot slot) { if (this.skillControl.TryGetSkillSlot(this.slotType, out slot) && slot != null) { slot.StartSkillCD(); } }
public void SwitchActor(ref PoolObjHandle <ActorRoot> actor) { if (actor == this._curActor) { return; } this._curActor = actor; SkillSlot[] skillSlotArray = actor.get_handle().SkillControl.SkillSlotArray; int num = 0; while (num < this._skillItems.Length && num + 1 < skillSlotArray.Length) { SkillSlotType skillSlotType = num + SkillSlotType.SLOT_SKILL_1; SkillSlot skillSlot = skillSlotArray[num + 1]; GameObject gameObject = this._skillItems[num]; if (gameObject) { if (skillSlot != null) { gameObject.CustomSetActive(true); this._skillIcons[num].SetSprite(CUIUtility.s_Sprite_Dynamic_Skill_Dir + skillSlot.SkillObj.IconName, Singleton <CBattleSystem> .GetInstance().WatchFormScript, true, false, false, false); this._skillLevelRoots[num].CustomSetActive(skillSlotType >= SkillSlotType.SLOT_SKILL_1 && skillSlotType <= SkillSlotType.SLOT_SKILL_3); this.ValidateLevel(skillSlotType); this.ValidateCD(skillSlotType); } else { gameObject.CustomSetActive(false); } } num++; } }
public void ValidateSkill(SkillSlotType slot, PoolObjHandle <ActorRoot> _curActor) { if (!_curActor) { return; } int num = slot - SkillSlotType.SLOT_SKILL_1; if (this._skillGos == null || this._skillIcons == null) { return; } if (num < 0 || num > _curActor.handle.SkillControl.SkillSlotArray.Length - 1 || num > this._skillGos.Length - 1 || num > this._skillIcons.Length - 1) { return; } SkillSlot skillSlot = _curActor.handle.SkillControl.SkillSlotArray[(int)slot]; GameObject gameObject = this._skillGos[num]; if (gameObject != null) { gameObject.CustomSetActive(true); } this._skillIcons[num].SetSprite(CUIUtility.s_Sprite_Dynamic_Skill_Dir + skillSlot.SkillObj.IconName, Singleton <CBattleSystem> .GetInstance().WatchFormScript, true, false, false, false); }
private void CleanupSlot(SkillSlot slot) { slot.Skill.CooldownStarted -= OnSkillCooldownStarted; slot.Skill.CooldownUpdated -= OnSkillCooldownUpdated; slot.Skill.CooldownFinished -= OnSkillCooldownFinished; slot.ChangeSkill(slot.SkillType == SkillType.Weapon ? GetDefaultWeaponSkill() : Skill.Empty); }
private static void Swap(SkillSlot slotA, SkillSlot slotB) { var temp = slotA.Skill; slotA.ChangeSkill(slotB.Skill); slotB.ChangeSkill(temp); }
/// <summary> /// Attempts to look up a name in the BodyCatalog, then find the SkillFamily instance used for one of its slots (by slot enum type). Returns null on failure. /// </summary> /// <param name="bodyName">The body name to search for. Case sensitive.</param> /// <param name="slot">The skillslot name to search for.</param> /// <returns>The resultant SkillFamily if lookup was successful, null otherwise.</returns> public static SkillFamily FindSkillFamilyFromBody(string bodyName, SkillSlot slot) { var targetBodyIndex = BodyCatalog.FindBodyIndex(bodyName); if (targetBodyIndex == BodyIndex.None) { AncientScepterMain._logger.LogError($"FindSkillFamilyFromBody: Couldn't find body with name {bodyName}"); return(null); } var allSlots = BodyCatalog.GetBodyPrefabSkillSlots(targetBodyIndex); var skLoc = BodyCatalog.GetBodyPrefab(targetBodyIndex).GetComponentInChildren <SkillLocator>(); if (!skLoc) { AncientScepterMain._logger.LogError($"FindSkillFamilyFromBody: Body with name {bodyName} has no SkillLocator"); return(null); } foreach (var skillInstance in BodyCatalog.GetBodyPrefabSkillSlots(targetBodyIndex)) { var targetSlot = skLoc.FindSkillSlot(skillInstance); if (targetSlot == slot) { return(skillInstance.skillFamily); } } AncientScepterMain._logger.LogError($"FindSkillFamilyFromBody: Body with name {bodyName} has no skill in slot {slot}"); return(null); }
public void Refresh(SkillKey skill, SkillSlot slot, float progress) { progress = Mathf.Max(0, progress); var timing = CalculateTiming(progress); RefreshSlots(slot); RefreshCurrentSlot(slot, timing); RefreshGlow(timing); RefreshSkill(skill, timing); }
// Use this for initialization void Start () { current = this; }
private void RefreshSlots(SkillSlot slot) { var slotIdx = slot.ToIndex(); for (int i = 0; i != SPRPG.Const.SkillSlotSize; ++i) _slots[i].gameObject.SetActive(i == slotIdx); }
private void RefreshCurrentSlot(SkillSlot slot, float timing) { var slotImage = _slots[slot.ToIndex()]; slotImage.SetAlpha(timing); }
public CommandSet AddCommandSet(string name, int capacity, bool autoFire, E_CommandConsume consumeType, CommandSet pipe) { CommandSet ret = null; if (consumeType == E_CommandConsume.ItemSlot) { ret = new ItemSlot(name, pipe); } else if (consumeType == E_CommandConsume.None) { ret = new ConsumableCommandSet(capacity, autoFire, false, pipe); } else if (consumeType == E_CommandConsume.Skill) { ret = new SkillSlot(pipe); } if (ret != null) { commandQueue.Add(name, ret); } return ret; }
private void OnSkillStart(Character character, SkillSlot skillSlot, SkillActor skillActor) { _view.PlaySkillStart(skillActor.Data); }