public void CastSkill(SkillButton button) { if (button.Type == SkillButton.Types.SUMMONMINION) { SpawnMinion(button.Index); } }
void PopulateList() { //FlushOldButtons(); List <muhSkills> CurrentPlayerSkills; List <string> SkillNameCorrect = new List <string>(); List <string> SkillCostCorrect = new List <string>(); List <Button.ButtonClickedEvent> SkillMethodActivate = new List<Button.ButtonClickedEvent>(); CurrentPlayerSkills = GameManager.instance.GetSkills(); for (int i = 0;i<CurrentPlayerSkills.Count;i++){ SkillNameCorrect.Add(CurrentPlayerSkills[i].ToString()); SkillCostCorrect.Add (" Cost: "+Skill.FromListOfSkills(CurrentPlayerSkills[i]).EnergyCost.ToString()); //Debug.Log(Skill.FromListOfSkills(CurrentPlayerSkills[i]).SkillEvent); SkillMethodActivate.Add (Skill.FromListOfSkills(CurrentPlayerSkills[i]).SkillEvent); // Debug.Log(" Cost: "+Skill.FromListOfSkills(CurrentPlayerSkills[i]).EnergyCost.ToString()); } SkillButton[] myButtonList = new SkillButton[CurrentPlayerSkills.Count]; int kkk=0; foreach (var SkillButton in myButtonList){ GameObject newButton = Instantiate (sampleButton)as GameObject; SampleButton button = newButton.GetComponent<SampleButton>(); button.SkillName.text = SkillNameCorrect[kkk]; button.EnergyCost.text = SkillCostCorrect[kkk]; //Debug.Log("my Event: "+SkillMethodActivate[kkk]); //button.eventos = SkillMethodActivate[kkk]; button.button.onClick = SkillMethodActivate[kkk]; newButton.transform.SetParent(contentPanel); kkk++; } }
private SkillButton InstantiateRectTransform(SkillButton a_RectTransform, Vector3 a_Position) { SkillButton skillButton = Instantiate(a_RectTransform); skillButton.GetComponent <RectTransform>().SetParent(transform, false); skillButton.transform.SetAsFirstSibling(); skillButton.transform.localPosition += a_Position; return(skillButton); }
public bool clickSkill(SkillButton button) { skilltree.skills[button.skillLevel] = new Skill(button.skillType); SkillButton[] buttons = skillTreeButtons.GetComponentsInChildren<SkillButton>(); foreach (SkillButton b in buttons) { if(b.skillLevel == button.skillLevel && b.selected == false) { b.disableClick(); } } saveSkillsToDisk(); return true; }
// Use this for initialization private void Start() { m_HUD = Instantiate(m_HUDPrefab); m_HUD.transform.SetParent(m_BackgroundUI.transform, false); m_HUD.transform.SetAsLastSibling(); m_HUD.parent = FindObjectOfType <Player>().unit; if (m_SkillButtonPrefab.GetComponent <RectTransform>() == null) { return; } List <IUsesSkills> skillUsers = FindObjectsOfType <GameObject>(). Where( x => x.GetComponent <IControllable>() != null && x.GetComponent <IControllable>().controllerType == ControllerType.User && x.GetComponent <IUsesSkills>() != null). Select(x => x.GetComponent <IUsesSkills>()). ToList(); skillUsers.Sort((a, b) => a.unitName.CompareTo(b.unitName)); int numOfSkills = 0; foreach (IUsesSkills skillUser in skillUsers) { numOfSkills += skillUser.skills.Count - 1; } int k = 0; for (int i = 0; i < skillUsers.Count; i++) { for (int j = 0; j < skillUsers[i].skills.Count; j++) { SkillButton skillButton = InstantiateRectTransform( m_SkillButtonPrefab, new Vector3( k * 70 + i * 100 - (numOfSkills * 70 + (skillUsers.Count - 1) * 100) / 2, 0, 0)); skillButton.parent = skillUsers[i]; skillButton.skillIndex = j; skillButton.sprite = skillUsers[i].skills[j].skillData.sprite; m_SkillButtons.Add(skillButton); k++; } k--; } }
void spawnNewSkillButton(Skill skill) { var newButton = Instantiate(buttonPrefab); SkillButton skillButton = newButton.GetComponent <SkillButton>(); skillButton.setSkill(skill); skillButton.setCallback(() => callSkill(skill)); newButton.transform.SetParent(buttonContainer.transform); newButton.transform.localScale = new Vector3(1, 1, 1); skillButton.setButtonIndex(System.Array.IndexOf(currentSkills, skill)); skillButton.transform.position = new Vector3(skillButton.transform.position.x, skillButton.transform.position.y, -5); }
void setSkillViewAge(Skill skill) { foreach (Transform child in buttonContainer.transform) { SkillButton sb = child.GetComponent <SkillButton>(); if (sb != null && sb.skill != null && sb.skill == skill) { var x = ((Time.time - skill.startedTime) - (skill.timeUntilDisappearSec * 0.5f)) / (skill.timeUntilDisappearSec * 0.5f); sb.setAge(x); } } }
public void setSelectedSkill(SkillButton selectedSkill) { if (this.selectedSkill != null) { this.selectedSkill.Deselected(); } this.selectedSkill = selectedSkill; if (selectedChar != null && this.selectedSkill != null) { DoSkill(); } }
private void AssingSkillsToButtons() { for (int i = 0; i <= 2; i++) { SkillButton skillbutton = GameManager.Instance.skillButtons[i]; Skill skill = currentCritter.skillList.Skills[i]; skillbutton.onSkill = null; skillbutton.skillName.text = skill.GetSkillName; skillbutton.skillDescription.text = skill.GetDescription; skillbutton.onSkill += skill.OnSkill; } }
public void AddSkill(SkillConfig skillConfig) { SkillButton sb = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.SkillButton].AllocateGameObject <SkillButton>(SkillButtonContainer); sb.Initialize(skillConfig, false, () => { if (GameStateManager.Instance.GetState() == GameState.Playing) { LevelManager.Instance.CurrentSelectedSkillKey = skillConfig.SkillKey; } }); SkillButtonDict.Add(skillConfig.SkillKey, sb); }
public void SelectSkill(SkillButton skillObject) { //Deselect Old if (SelectedSkill != null) { SelectedSkill.SelectedIndicatior.enabled = false; } //Select new skillObject.SelectedIndicatior.enabled = true; ShowSkillInfo(skillObject.Skill); SelectedSkill = skillObject; }
public override void _Ready() { slots = new SkillButton[TOTAL_SPELLS]; for (int k = 0; k < TOTAL_SPELLS; k++) { SkillButton skill = GetNode <SkillButton>("Skill-" + (k + 1)); Godot.Collections.Array bind = Global.ArrayFrom(k); skill.Connect("pressed", this, nameof(on_SkillActivated), bind); skill.Connect("mouse_entered", this, nameof(on_SkillHovered), bind); skill.Connect("mouse_exited", this, nameof(on_SkillUnHovered), bind); slots[k] = skill; } }
public void SelectSkill(SkillButton btn) { if (list[btn.idx].locked) { return; } for (var i = 0; i < buttons.Length; i++) { buttons[i].selected = false; } btn.selected = true; selected = btn; }
//public static void Main(string[] args) //{ public void Start() { //androidPlugin = GameObject.Find("NetworkManager").GetComponent<AndroidPlugin>(); Debug.Log("네트워크 스크립트"); //joy = GameObject.Find("JoystickBackGround").GetComponent<JoyStick>(); Debug.Log("네트워크 스크립트2"); singleton = this; player = GameObject.FindWithTag("Player").GetComponent <Transform>(); playerAni = GameObject.FindWithTag("Player").GetComponent <PlayerAni>(); player2 = GameObject.FindWithTag("RemotePlayer").GetComponent <Transform>(); remoteAni = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteAni>(); //rigidboby = GameObject.FindWithTag("RemotePlayer").GetComponent<Rigidbody>(); //myId = androidPlugin.text; //myId = "Nova"; //myTeam = "1"; //myId = "Nova"; //Debug.Log("내 아이디: "+ myId); //Connected(); //Send(myId + "," + "myTeamCall"); //ConnectToTcpServer(); //clientSocket.Close(); //myId = PlayerPrefs.GetString("myId"); exampleClass = GameObject.Find("IDManager").GetComponent <ExampleClass>(); myId = exampleClass.myId; Debug.Log("Unity Network Script myId: " + myId); //Connected(); //Send(myId); //ConnectToTcpServer(); playerFsm = GameObject.FindWithTag("RemotePlayer").GetComponent <PlayerFSM>(); playerFsm2 = GameObject.FindWithTag("Player").GetComponent <PlayerFSM2>(); remoteFSM = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteFSM>(); monsterFSM = GameObject.Find("Spider").GetComponent <MonsterFSM>(); Connected(); Send(myId); ConnectToTcpServer(); skillOne = GameObject.Find("TaiLungSpell1").GetComponent <SkillButton>(); //StartCoroutine(PlayerSet()); }
/// 给自己添加buff public void add2me(SkillButton sb) { Buff buff = new Buff(); if (sb.skillName.Equals("水晶盾")) { // 增加100力量的buff buff.type = "str"; buff.num = 100; } // 增加buff属性 addBuff(buff); buffList.Add(buff); }
private void onBattleEuipFormClose(CUIEvent uiEvent) { if (!this.IsBattleEquipGuideComplete()) { CSkillButtonManager cSkillButtonManager = (Singleton <CBattleSystem> .GetInstance().FightForm != null) ? Singleton <CBattleSystem> .GetInstance().FightForm.m_skillButtonManager : null; if (cSkillButtonManager != null) { SkillButton button = cSkillButtonManager.GetButton(SkillSlotType.SLOT_SKILL_9); PlayerKDA hostKDA = Singleton <BattleStatistic> .GetInstance().m_playerKDAStat.GetHostKDA(); if (hostKDA == null) { return; } bool flag = false; ListView <HeroKDA> .Enumerator enumerator = hostKDA.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.get_Current().Equips.Length > 0) { flag = true; break; } } if (button != null && button.m_button.activeSelf && flag) { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(FightForm.s_skillBtnFormPath); if (form != null) { Transform transform = form.GetWidget(27).transform.FindChild("Panel_Guide"); if (transform != null) { transform.gameObject.CustomSetActive(true); CUITimerScript component = transform.FindChild("Timer").GetComponent <CUITimerScript>(); component.ResetTime(); component.ReStartTimer(); CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { masterRoleInfo.SetClientBits(6, true, true); } } } } } } }
public bool clickSkill(SkillButton button) { skilltree.skills[button.skillLevel] = new Skill(button.skillType); SkillButton[] buttons = skillTreeButtons.GetComponentsInChildren <SkillButton>(); foreach (SkillButton b in buttons) { if (b.skillLevel == button.skillLevel && b.selected == false) { b.disableClick(); } } saveSkillsToDisk(); return(true); }
public void saveSkillButton(SkillButton skillButton) { string key = skillButton.SkillName; PlayerPrefs.SetInt(key + "_level", skillButton.level); if (skillButton.isPurchase) { PlayerPrefs.SetInt(key + "_purchase", 1); } else { PlayerPrefs.SetInt(key + "_purchase", 0); } }
void Start() { for (int i = 0; i < skills.Length; i++) { skills[i].transform = transform; skills[i].Init(); GameEvents.On("Skill" + i.ToString(), skills[i].Cast); Button btn = SkillButton.GetButton(i); Image btnImage = btn.GetComponent <Image>(); btnImage.sprite = skills[i].image; btnImage.color = Color.white; } GameEvents.On("PlayerTick", CastSkillsInQueue); }
public void AddClick(BasicEntity entity) { List <ComponentType> m_components = entity.GetComponent <AbilityComponent>().m_temporaryAbility; for (int i = 0; i < m_components.Count && m_components[i] != ComponentType.Input; i++) { ComponentType item = m_components[i]; GameObject skillButton = new GameObject((i + 1).ToString()); skillButton.transform.SetParent(gameObject.transform); skillButton.gameObject.transform.position = backGround.transform.GetChild(i).position; Button button = skillButton.AddComponent <Button>(); SkillButton skill = skillButton.AddComponent <SkillButton>(); switch (item) { case ComponentType.CheerUp: { skillButton.AddComponent <Image>().sprite = Resources.Load <Sprite>("CheerUp"); break; } case ComponentType.Move: { skillButton.AddComponent <Image>().sprite = Resources.Load <Sprite>("Move"); break; } case ComponentType.Attack: { skillButton.AddComponent <Image>().sprite = Resources.Load <Sprite>("Attack"); break; } case ComponentType.Knock: { skillButton.AddComponent <Image>().sprite = Resources.Load <Sprite>("Knock"); break; } } if (entity.GetComponent <AbilityComponent>().m_coldDown.ContainsKey(item)) { skillButton.GetComponent <Image>().color = Color.black; } skillButton.transform.localScale = Vector3.one; button.onClick.AddListener(delegate() { skill.OnClick(); }); } }
public void AddSkill(SkillConfig skillConfig) { SkillButton sb = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.SkillButton].AllocateGameObject <SkillButton>(SkillButtonContainer); sb.Initialize(skillConfig, true, () => { LevelManager.Instance.CurrentCoin -= skillConfig.CoinCost; RemoveSkill(skillConfig.SkillKey); StartCoroutine(ClientUtils.UpdateLayout((RectTransform)SkillButtonContainer.transform)); LevelManager.Instance.AddSkill(skillConfig.SkillKey); RefreshAllSkillsAffordable(); }); StartCoroutine(ClientUtils.UpdateLayout((RectTransform)SkillButtonContainer.transform)); SkillButtonDict.Add(skillConfig.SkillKey, sb); }
public void RemoveSkill(object x) { SkillButton skillButton = (SkillButton)x; if (skillButton == LeftButtonSkill) { player.OnLeftClickSkill = null; } if (skillButton == RightButtonSkill) { player.OnRightClickSkill = null; player.ActiveSkill = null; } skillButton.Remove(); skillButton.Show(); }
public void loadSkillButton(SkillButton skillButton) { string key = skillButton.SkillName; skillButton.level = PlayerPrefs.GetInt(key + "_level", 0); if (PlayerPrefs.GetInt(key + "_purchase") == 1) { skillButton.isPurchase = true; } else { skillButton.isPurchase = false; } }
public void SetGrid() { Debug.Log("HI"); DestroyGrid(); foreach (var item in player.Skills) { Debug.Log("HI"); SkillButton button = Instantiate(perhub); button.SetPlayer(player); button.Set(item, false); button.transform.SetParent(grid.transform, false); button.transform.localPosition = new Vector3(button.transform.localPosition.x, button.transform.localPosition.y, 0); button.OnClick += OnSkillClick; //Debug.LogWarning(button.transform.position.z); skills.Add(button); } }
public SkillButton CreateSkillButton(Bitmap normal, Bitmap hover, Bitmap clicked, string name) { SkillButton button = new SkillButton(); button.Name = name; button.SetButtonImages(normal, hover, clicked); //button.BackgroundImageLayout = ImageLayout.Stretch; //button.FlatStyle = FlatStyle.Flat; //button.FlatAppearance.BorderSize = 0; //button.FlatAppearance.CheckedBackColor = Color.Black; //button.FlatAppearance.MouseDownBackColor = Color.Black; //button.FlatAppearance.MouseOverBackColor = Color.Black; return(button); }
private void addSkillToUnitUI(Skill skill) { Debug.Log("Adding " + skill.Name + " to the UI"); GameObject skillBtn = (GameObject)GameObject.Instantiate(Resources.Load("SkillBtn")); skillBtn.transform.SetParent(UnitSkills.transform); skillBtn.transform.Find("Label").GetComponent <Text>().text = skill.Name; SkillButton skillButton = skillBtn.GetComponent <SkillButton>(); if (skillButton != null) { skillButton.skill = skill; skillButton.controller = this.controller; } }
public void Setup(Battler _focus) { focus = _focus; nameTag.text = focus.name; //Attacks foreach (BattleSkill i in focus.attacks) { SkillButton newButton = Instantiate(skillButtonPrefab); newButton.transform.SetParent(attacks.transform); newButton.attack = i; //attackButtons.Add(newButton); } //Specials foreach (BattleSkill i in focus.specials) { SkillButton newButton = Instantiate(skillButtonPrefab); newButton.transform.SetParent(specials.transform); newButton.attack = i; //attackButtons.Add(newButton); } //Items foreach (BattleItem i in focus.items) { ItemButton newButton = Instantiate(itemButtonPrefab); newButton.transform.SetParent(items.transform); newButton.item = i; //attackButtons.Add(newButton); } // Test /*foreach (BattleAction i in focus.allActions.Where(x => x is BattleSkill)) * { * SkillButton newButton = Instantiate(skillButtonPrefab); * newButton.transform.SetParent(items.transform); * * newButton.attack = (i as BattleSkill); * //attackButtons.Add(newButton); * }*/ /*if (focus.rank == 0 && manager.GetPlayersInRank(0).Count <= 1) * { * strategyButtons[0].GetComponent<Image>().color = Color.grey; * }*/ }
// Use this for initialization void Start() { m_State = BoxState.FALL; m_CurTime = 0; GameObject gc = GameObject.FindGameObjectWithTag("GameController"); m_BG = gc.GetComponent <BoxGenerator>(); m_SkillBt = GetSkillButton(m_Type); //init coordinate Vector2 pos = new Vector2(transform.localPosition.x, transform.localPosition.y); Coord2D coord = m_BG.PosToCoord(pos); SetCoord(coord); m_InfoBar = GameObject.FindGameObjectWithTag("InfoBar").GetComponent <InfoBar>(); }
void removeSkillButton(Skill skill) { GameObject deleteme = null; foreach (Transform child in buttonContainer.transform) { SkillButton sb = child.GetComponent <SkillButton>(); if (sb != null && sb.skill != null && sb.skill == skill) { deleteme = child.gameObject; } } if (deleteme != null) { Destroy(deleteme); Debug.Log("Button was removed " + skill.name); } }
//为啥技能int和 string这么转换, 后面需要看视频研究下 public int GetCurrentSkillCode(SkillButton button, int currentCode) { Debug.Log("GetCurrentSkillCode:" + button + ";" + currentCode); int code = (int)button; if (currentCode < 0) { Debug.LogError("SkillCode不能小于0"); } else if (currentCode == 0) { currentCode = code; } else { currentCode = currentCode * 10 + code; } return(currentCode); }
private void ShowSkillButtonFlowEffect(bool show) { if (Singleton <CBattleSystem> .GetInstance().FightForm == null || Singleton <CBattleSystem> .GetInstance().FightForm.m_skillButtonManager == null) { return; } CSkillButtonManager skillButtonManager = Singleton <CBattleSystem> .GetInstance().FightForm.m_skillButtonManager; SkillSlotType skillSlotType; if (skillButtonManager.HasMapSlectTargetSkill(out skillSlotType)) { SkillButton button = skillButtonManager.GetButton(skillSlotType); if (button != null && button.m_button != null) { skillButtonManager.SetButtonFlowLight(button.m_button, show); } } }
public bool checkClicked(int skillType) { for (int a = 0; a != transform.childCount; ++a) { SkillButton button = transform.GetChild(a).GetComponent <SkillButton>(); if (button.skillType == skillType) { if (button.skillCount == button.skillCountMax) { return(true); } else { return(false); } } } return(false); }
public void CastSkill(SkillButton skill_index, RayHitInfo hit_info) { if (equip_skills[(int)skill_index].IsOnCooldown()) { StartCoroutine(SkillOnCDDisplay()); return; } if (cast_timer > 0) { Debug.Log("Already casting a skill"); } else { if (equip_skills[(int)skill_index].cast_time_mult == 0) { cast_timer = 0; } else { cast_timer = 1 / (equip_skills[(int)skill_index].cast_time_mult * attack_speed.Buffed_value); } if (CharacterController.instance.SpendResource(equip_skills[(int)skill_index].cost)) { CharacterController.instance.move_controller.StopMovement(); if (cast_timer != 0) { pc_animator.SetInteger("Weapon", 1); pc_animator.speed = 1 / cast_timer; pc_animator.SetTrigger("AttackTrigger"); is_attacking = true; } equip_skills[(int)skill_index].CastSkill(GetCastInfo(transform.position, hit_info.hit_point)); transform.rotation = Quaternion.LookRotation(hit_info.hit_point - (transform.position + Vector3.up * 1.5f), Vector3.up); } else { StartCoroutine(SkillNoMoreManaDisplay()); } } }
void OnEnable() { var mc = GameObject.Find("MainCanvas"); toolTipObj = mc.transform.Find("SkillPanel/ToolTip").gameObject; // Gets Reference to the ToolTip texts. toolTipDscrpt = toolTipObj.transform.FindChild("Description").gameObject.GetComponent<Text>(); toolTipFstLbl = toolTipObj.transform.FindChild("FirstLabel").gameObject.GetComponent<Text>(); toolTipSndLbl = toolTipObj.transform.FindChild("SecondLabel").gameObject.GetComponent<Text>(); toolTipThdLbl = toolTipObj.transform.FindChild("ThirdLabel").gameObject.GetComponent<Text>(); toolTipFstAtt = toolTipObj.transform.FindChild("FirstAttribute").gameObject.GetComponent<Text>(); toolTipSndAtt = toolTipObj.transform.FindChild("SecondAttribute").gameObject.GetComponent<Text>(); toolTipThdAtt = toolTipObj.transform.FindChild("ThirdAttribute").gameObject.GetComponent<Text>(); LastUse = float.MinValue; // CreateUI if (SkillButtonPrefab != null) { var skillBar = GameObject.Find("SkillBar"); var button = Instantiate(SkillButtonPrefab); var showCallback = button.GetComponent<EventTrigger>().triggers.First(a => a.eventID == EventTriggerType.PointerEnter).callback; showCallback.AddListener(ShowToolTip); var hideCallback = button.GetComponent<EventTrigger>().triggers.First(a => a.eventID == EventTriggerType.PointerExit).callback; hideCallback.AddListener(HideToolTip); if (addToSkillBar) { button.transform.SetParent(skillBar.transform, false); } SkillBtnScript = button.GetComponent<SkillButton>(); SkillBtnScript._skill = this; SkillBtnScript._skillBar = GetComponent<SkillBar>(); SkillBtnScript.Init(); //HideToolTip(); } }
public SkillButton CreateSkillButton(Bitmap normal, Bitmap hover, Bitmap clicked, string name) { SkillButton button = new SkillButton(); button.Name = name; button.SetButtonImages(normal, hover, clicked); //button.BackgroundImageLayout = ImageLayout.Stretch; //button.FlatStyle = FlatStyle.Flat; //button.FlatAppearance.BorderSize = 0; //button.FlatAppearance.CheckedBackColor = Color.Black; //button.FlatAppearance.MouseDownBackColor = Color.Black; //button.FlatAppearance.MouseOverBackColor = Color.Black; return button; }