Inheritance: MonoBehaviour
Beispiel #1
0
	/// <summary>
	/// 显示最上面的技能按钮
	/// </summary>
	/// <param name="manager"></param>
	private void PresentIcons(SkillManager manager)
	{
		if (this.gameObject.activeSelf == false || items == null)
			return;
		// 为每个按钮关联对应的技能
		foreach (var i in items.Zip(from s in manager where s.Value == null || s.Value.IsBasic == false orderby s.Key select s))
			i.Item1.Skill = i.Item2;

		// 默认选中第一个学会的技能
		if (selected == null)
		{
			foreach (var i in items)
			{
				if (i.Skill.Value == null)
					continue;
				selected = i;
				break;
			}
		}
		// 更新选中技能信息
		if (selected != null)
		{
			var click = UIEventListener.Get(selected.uiIcon.gameObject).onClick;
			if (click != null)
				click(selected.uiIcon.gameObject);
			selected.uiIcon.GetComponent<UIToggle>().value = true;
		}
	}
Beispiel #2
0
 public static void InitializeManager()
 {
     CharacterMgr = CharacterStore.GetInstance();
     ObjectMgr = ObjectManager.GetInstance();
     SkillMgr = SkillManager.GetInstance();
     SpellMgr = SpellManager.GetInstance();
     WorldMgr = WorldManager.GetInstance();
 }
Beispiel #3
0
 public static void InitializeManager()
 {
     DataMgr = DataManager.GetInstance();
     ObjectMgr = ObjectManager.GetInstance();
     SkillMgr = SkillManager.GetInstance();
     SpawnMgr = SpawnManager.GetInstance();
     SpellMgr = SpellManager.GetInstance();
     WorldMgr = WorldManager.GetInstance();
 }
 public SaveManager(AchievementManager otherA, SkillManager otherS, PlayerController p, DayNightCycleManager otherD)
 {
     achievementManager = otherA;
     skillManager = otherS;
     if(!Directory.Exists("./save/"))
         Directory.CreateDirectory("./save/");
     player = p;
     timeManager = otherD;
 }
	public HeroData()
	{
		property = new HeroProperty ();
        equipmentList = new EquipmentList();
        realmList = new HeroRealm();
		skillList = new SkillManager();
		bufferController = new BufferController();
		battle = -1;
        level = 1;
	}
Beispiel #6
0
    private void Awake()
    {
        _instance = this;
        skillDBController = this.GetComponent<SkillDBController>();
        skillDBController.OnGetSkillDBList += this.OnGetSkillDBList;    //注册回调函数
        skillDBController.OnUpgradeSkillDB += this.OnUpgradeSkillDB;
        InitSkill();
        skillDBController.Get(); //发起请求

    }
Beispiel #7
0
        public BattleManager(EntityParent _owner, SkillManager _skillManager)
        {
            theOwner = _owner;
            skillManager = _skillManager;
            theOwner.AddUniqEventListener<int>(Events.FSMMotionEvent.OnPrepareEnd, OnPrepareEnd);
            theOwner.AddUniqEventListener<int>(Events.FSMMotionEvent.OnAttackingEnd, OnAttackingEnd);
            theOwner.AddUniqEventListener<int>(Events.FSMMotionEvent.OnHitAnimEnd, OnHitAnimEnd);
            theOwner.AddUniqEventListener(Events.FSMMotionEvent.OnRollEnd, OnRollEnd);

            EventDispatcher.AddEventListener<int, uint, uint, List<int>>(Events.FSMMotionEvent.OnHit, OnHit);
        }
Beispiel #8
0
 void Awake()
 {
     singleton = this;
     TextAsset ta = Resources.Load(resourceName, typeof(TextAsset)) as TextAsset;
     if (ta != null) {
         skills = ta.GetXml().FindSkills().ToArray();
     }
     else {
         skills = new Skill[0];
         Debug.Log("Skills list not found");
     }
 }
Beispiel #9
0
 public static void InitializeManager()
 {
     ActionMgr         = ActionManager.GetInstance();
     AddonMgr          = AddonManager.GetInstance();
     SkillMgr          = SkillManager.GetInstance();
     SpellMgr          = SpellManager.GetInstance();
     SpecializationMgr = SpecializationManager.GetInstance();
     DataMgr           = DataManager.GetInstance();
     SpawnMgr          = SpawnManager.GetInstance();
     GossipMgr         = GossipManager.GetInstance();
     ObjectMgr         = ObjectManager.GetInstance();
     WorldMgr          = WorldManager.GetInstance();
 }
    void OnGUI()
    {
        skillManager = EditorGUILayout.ObjectField("Skill Manager", skillManager, typeof(SkillManager), false) as SkillManager;
        if (skillManager != null)
        {
            currentSkillTypeToCreate = (SkillTypeToCreate)EditorGUILayout.EnumPopup(currentSkillTypeToCreate);

            newSkillName = EditorGUILayout.TextField("Skill Name: ", newSkillName);
            newSkillDescription = EditorGUILayout.TextField("Description: ", newSkillDescription);
            newSkillCost = EditorGUILayout.IntField("Cost: ", newSkillCost);
            switch(currentSkillTypeToCreate)
            {
                case SkillTypeToCreate.DefaultSkill:
                    break;

                case SkillTypeToCreate.SwordSkill:
                    break;

            }

            if (GUILayout.Button("Add New Skill"))
            {
                switch(currentSkillTypeToCreate)
                {
                    case SkillTypeToCreate.DefaultSkill:
                        DefaultSkill newDefaultSkill = new DefaultSkill();
                        newDefaultSkill.skillName = newSkillName;
                        newDefaultSkill.description = newSkillDescription;
                        newDefaultSkill.cost = newSkillCost;
                        newDefaultSkill.type = (int)currentSkillTypeToCreate;
                        skillManager.skillList.Add(newDefaultSkill);
                        break;

                    case SkillTypeToCreate.SwordSkill:
                        SwordSkill newSwordSkill = new SwordSkill();
                        newSwordSkill.skillName = newSkillName;
                        newSwordSkill.description = newSkillDescription;
                        newSwordSkill.cost = newSkillCost;
                        newSwordSkill.type = (int)currentSkillTypeToCreate;
                        skillManager.skillList.Add(newSwordSkill);
                        break;

                }
            }
        }
    }
	void Awake()
	{
		m_transform = transform;
		m_animation = GetComponent<Animation>();
		m_audio = GetComponent<AudioSource>();
		m_rigidbody = GetComponent<Rigidbody>();
		script_monEf = Monster_efs.instance;
		enemy = GameObject.FindWithTag("Respawn").GetComponent<DB_Monster>().enemy[1];

		script_sound = GameObject.FindWithTag("sound").GetComponent<SoundEf_slash>();
		script_cam = Camera.main.GetComponent<CamMove>();
		//
		gameObject.AddComponent<Skill> ();
		m_skillScript = gameObject.GetComponent<Skill> ();
		skillData = new SkillState("enemy_normal_skill");
		skillData.Init (this);
		skillList = new SkillManager ();
		m_isDead = false;
	}
Beispiel #12
0
        public static void CleanupBrokenSkills(SimDescription sim, Logger log)
        {
            try
            {
                if (sim.SkillManager == null)
                {
                    return;
                }

                List <ulong> remove = new List <ulong>();
                foreach (KeyValuePair <ulong, Skill> value in sim.SkillManager.mValues)
                {
                    Skill skill = value.Value;

                    if (skill == null)
                    {
                        remove.Add(value.Key);
                    }
                    else
                    {
                        Skill staticSkill = SkillManager.GetStaticSkill(skill.Guid);
                        if (staticSkill != null)
                        {
                            if (skill.NonPersistableData == null)
                            {
                                skill.mNonPersistableData = staticSkill.mNonPersistableData;

                                if (skill.NonPersistableData != null)
                                {
                                    if (log != null)
                                    {
                                        log(" Broken Skill " + skill.Guid + " Repaired " + sim.FullName);
                                    }
                                }
                                else
                                {
                                    remove.Add(value.Key);
                                }
                            }

                            if (skill.SkillLevel > staticSkill.MaxSkillLevel)
                            {
                                skill.SkillLevel = staticSkill.MaxSkillLevel;

                                if (log != null)
                                {
                                    log(" Skill Level Reduced To Max " + skill.Guid + ": " + sim.FullName);
                                }
                            }
                        }
                        else
                        {
                            remove.Add(value.Key);
                        }
                    }
                }

                foreach (ulong guid in remove)
                {
                    sim.SkillManager.mValues.Remove(guid);

                    if (log != null)
                    {
                        log("Broken Skill " + guid + " Dropped " + sim.FullName);
                    }
                }

                NectarSkill nectarSkill = sim.SkillManager.GetSkill <NectarSkill>(SkillNames.Nectar);
                if (nectarSkill != null)
                {
                    if (nectarSkill.mSimIDsServed == null)
                    {
                        nectarSkill.mSimIDsServed = new List <ulong>();
                    }

                    if (nectarSkill.mHashesMade == null)
                    {
                        nectarSkill.mHashesMade = new List <uint>();
                    }
                }

                RockBand bandSkill = sim.SkillManager.GetSkill <RockBand>(SkillNames.RockBand);
                if (bandSkill != null)
                {
                    if (bandSkill.mBandGigsStats != null)
                    {
                        bandSkill.mBandGigsStats.Remove(null);
                    }
                }

                BroomRidingSkill broomRidingSkill = sim.SkillManager.GetSkill <BroomRidingSkill>(SkillNames.BroomRiding);
                if (broomRidingSkill != null)
                {
                    if (broomRidingSkill.mLotsVisited == null)
                    {
                        broomRidingSkill.mLotsVisited = new List <Lot>();

                        if (log != null)
                        {
                            log(" Missing LotsVisited Added: " + sim.FullName);
                        }
                    }

                    for (int i = broomRidingSkill.mLotsVisited.Count - 1; i >= 0; i--)
                    {
                        if (broomRidingSkill.mLotsVisited[i] == null)
                        {
                            broomRidingSkill.mLotsVisited.RemoveAt(i);

                            if (log != null)
                            {
                                log(" Invalid LotsVisited Removed: " + sim.FullName);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(sim, e);
            }
        }
Beispiel #13
0
    public void CreateSkillList(Transform character)
    {
        var unitSkillData    = character.GetComponent <CharacterStatus>().skills;
        var UIContent        = transform.Find("Scroll View").Find("Viewport").Find("Content");
        var skillInfoPanel   = transform.Find("SkillInfoPanel");
        var descriptionPanel = transform.Find("DescriptionPanel");

        skillInfoPanel.gameObject.SetActive(false);
        descriptionPanel.gameObject.SetActive(false);
        var roleInfoPanel = transform.parent;

        allButtons.Clear();
        GameObject button;

        foreach (var skill in unitSkillData)
        {
            var tempSkill = SkillManager.GetInstance().skillList.Find(s => s.EName == skill.Key);

            button = GameObject.Instantiate(_Button, UIContent);

            Destroy(button.GetComponent <Button>());

            button.GetComponentInChildren <Text>().alignment            = TextAnchor.MiddleLeft;
            button.GetComponentInChildren <Text>().text                 = tempSkill.CName;
            button.GetComponentInChildren <Text>().resizeTextForBestFit = false;
            button.GetComponentInChildren <Text>().fontSize             = 45;
            button.GetComponentInChildren <Text>().GetComponent <RectTransform>().sizeDelta = new Vector2(-30, 0);
            button.name = skill.Key;

            button.GetComponent <RectTransform>().sizeDelta = new Vector2(-72 * 2, 72);

            button.GetComponent <RectTransform>().pivot     = new Vector2(0f, 1f);
            button.GetComponent <RectTransform>().anchorMin = new Vector2(0, 1);
            button.GetComponent <RectTransform>().anchorMax = new Vector2(1, 1);
            allButtons.Add(button);

            var levelChange = GameObject.Instantiate(_LevelChange, button.transform);

            levelChange.transform.Find("LevelUp").GetComponent <Button>().onClick.AddListener(OnButtonClick);
            levelChange.transform.Find("LevelDown").GetComponent <Button>().onClick.AddListener(OnButtonClick);

            //技能等级小于零 约定为技能未解锁。
            if (skill.Value < 0)
            {
                button.GetComponentInChildren <Text>().color = new Color(0.6f, 0.6f, 0.6f);
                levelChange.transform.Find("LevelUp").GetComponent <Button>().interactable    = false;
                levelChange.transform.Find("LevelDown").GetComponent <Button>().interactable  = false;
                levelChange.transform.Find("LevelUp").GetComponentInChildren <Text>().color   = new Color(0.6f, 0.6f, 0.6f);
                levelChange.transform.Find("LevelDown").GetComponentInChildren <Text>().color = new Color(0.6f, 0.6f, 0.6f);
            }

            var imageUI = UnityEngine.Object.Instantiate(_SkillButtonImages, button.transform);

            var _Class = imageUI.transform.Find("SkillClass").GetComponent <Image>();
            var _Type  = imageUI.transform.Find("SkillType").GetComponent <Image>();
            var _Combo = imageUI.transform.Find("SkillCombo").GetComponent <Image>();

            _Class.transform.localPosition = new Vector3(10, 0, 0);
            _Type.transform.localPosition  = new Vector3(70, 0, 0);
            _Combo.transform.localPosition = new Vector3(130, 0, 0);

            if (tempSkill is UnitSkill)
            {
                var tempUnitSkill = (UnitSkill)tempSkill;
                _Class.sprite = imagesList.Find(i => i.name.Substring(11) == tempUnitSkill.skillClass.ToString());
                _Type.sprite  = imagesList.Find(i => i.name.Substring(10) == tempUnitSkill.skillType.ToString());
                _Combo.gameObject.SetActive(tempUnitSkill.comboType != UnitSkill.ComboType.cannot);
            }
            else
            {
                _Class.sprite = imagesList.Find(i => i.name.Substring(11) == UnitSkill.SkillClass.passive.ToString());
                _Type.gameObject.SetActive(false);
                _Combo.gameObject.SetActive(false);
            }


            EventTriggerListener.Get(button).onEnter = g =>
            {
                if (tempSkill.description.Length > 0)
                {
                    descriptionPanel.gameObject.SetActive(true);
                }
                if (tempSkill is UnitSkill)
                {
                    skillInfoPanel.gameObject.SetActive(true);
                }
                LogSkillInfo(tempSkill, descriptionPanel, skillInfoPanel, roleInfoPanel, g.transform);
            };

            EventTriggerListener.Get(button).onExit = g =>
            {
                skillInfoPanel.gameObject.SetActive(false);
                descriptionPanel.gameObject.SetActive(false);
            };

            var levelUI = UnityEngine.Object.Instantiate(_SkillLevelImages, button.transform);

            for (int i = 0; tempSkill.maxLevel > i; i++)
            {
                var toggle = levelUI.transform.Find("Level" + (i + 1).ToString()).gameObject;
                toggle.SetActive(true);
                if (skill.Value > i)
                {
                    toggle.GetComponent <Toggle>().isOn = true;
                }
            }
        }

        UIContent.GetComponent <RectTransform>().sizeDelta = new Vector2(UIContent.GetComponent <RectTransform>().sizeDelta.x, allButtons[0].GetComponent <RectTransform>().sizeDelta.y *(allButtons.Count));

        //设置按钮位置
        for (int i = 0; i < allButtons.Count; i++)
        {
            allButtons[i].transform.localPosition = new Vector3(allButtons[i].transform.localPosition.x, -(int)(i * (allButtons[i].GetComponent <RectTransform>().sizeDelta.y)), 0);
        }
    }
Beispiel #14
0
    private void UpdateUI()
    {
        SkillManager skillMgr = player.GetSkillManager();

        text.text = skillMgr.GetSkillLevel(SkillType.Mining) + " " + skillMgr.GetSkillXp(SkillType.Mining) + "/" + skillMgr.GetSkillXpNeeded(SkillType.Mining);
    }
	void Awake()
	{
		_instance = this;
		InitSkill();
	}
        //计算普通Battle获得的物品
        public void calcBattleBonusItems()
        {
            bonusItems.Clear();

            foreach (String roleKey in uiHost.battleFieldContainer.field.EnemyTeam)
            {
                List <Item> itemList = new List <Item>();
                Role        role     = RoleManager.GetRole(roleKey);
                if (role != null)
                {
                    int roleLevel = role.Level;
                    foreach (Item item in ItemManager.Items)
                    {
                        if (item.IsDrop && roleLevel >= (item.level - 1) * 5)
                        {
                            itemList.Add(item);
                        }
                    }
                }

                //计算取得的物品概率,常规战斗下每个人掉落物品的概率均为10%
                if (itemList.Count > 0 && Tools.ProbabilityTest(0.1))
                {
                    bonusItems.Add(itemList[Tools.GetRandomInt(0, itemList.Count - 1)]);
                }

                double roleHard = 2;
                if (role != null)
                {
                    roleHard += role.Level / 3.0;
                    if (role.Level == 30)
                    {
                        roleHard = 99999;                   //30级的角色可以掉落所有残章
                    }
                }

                double canzhangProperty = 0;
                if (RuntimeData.Instance.GameMode == "hard")
                {
                    canzhangProperty = 0.03;
                }
                else if (RuntimeData.Instance.GameMode == "crazy") //炼狱难度,掉率提高
                {
                    canzhangProperty = 0.08 + (RuntimeData.Instance.Round - 1) * 0.04;
                }

                //外功残章
                if (Tools.ProbabilityTest(canzhangProperty))
                {
                    Skill s = null;

                    int c = 0;
                    while (c < 100)
                    {
                        c++;
                        s = SkillManager.GetRandomSkill();
                        if (role != null && role.Level == 30 && s.Hard < 7)
                        {
                            continue;                                                 //高级角色不掉落低级残章
                        }
                        if (role != null && role.Level >= 20 && s.Hard < 4)
                        {
                            continue;
                        }
                        if (s.Hard < roleHard)
                        {
                            break;
                        }
                    }
                    bonusItems.Add(ItemManager.GetItem(s.Name + "残章"));
                }
                //内功残章
                if (Tools.ProbabilityTest(canzhangProperty / 2.0))
                {
                    InternalSkill s = null;
                    while (true)
                    {
                        s = SkillManager.GetRandomInternalSkill();
                        if (s.Hard < roleHard)
                        {
                            break;
                        }
                    }
                    bonusItems.Add(ItemManager.GetItem(s.Name + "残章"));
                }
            }

            //显示物品
            int count = 0;

            this.bonusItemsPanel.Children.Clear();
            StackPanel currentPanel = null;

            for (int i = 0; i < bonusItems.Count; i++)
            {
                if (count > 6)
                {
                    count = 0;
                }

                if (count == 0)
                {
                    currentPanel             = new StackPanel();
                    currentPanel.Orientation = Orientation.Horizontal;
                    currentPanel.Height      = 60;
                    currentPanel.Margin      = new Thickness(2, 2, 2, 0);
                    this.bonusItemsPanel.Children.Add(currentPanel);
                }
                Item     newItem  = bonusItems[i].Clone(true);
                ItemUnit itemUnit = new ItemUnit();
                itemUnit.BindItem(newItem);
                itemUnit.Margin = new Thickness(2, 2, 2, 8);
                currentPanel.Children.Add(itemUnit);
                count++;

                //添加物品
                RuntimeData.Instance.Items.Add(newItem);
            }
        }
Beispiel #17
0
 void InitSkills()
 {
     SkillMgr = new SkillManager(this);
     this.Info.Skills.AddRange(this.SkillMgr.Infos);
 }
Beispiel #18
0
 //魔法学派对应技能
 Skill SchoolToSkill(MagicSchool _school)
 {
     return(SkillManager.GetSkill("Magic_" + _school.ToString()));
 }
Beispiel #19
0
 void Start()
 {
     animator      = transform.GetComponent <Animator>();
     skillManager  = transform.GetComponent <SkillManager>();
     playerManager = transform.GetComponent <PlayerManager>();
 }
Beispiel #20
0
    public override void OnUnitClicked(Unit unit)
    {
        foreach (var f in BattleFieldManager.GetInstance().floors)
        {
            f.Value.SetActive(false);
        }
        range = new MoveRange();
        if (unit.playerNumber.Equals(roundManager.CurrentPlayerNumber) && !unit.UnitEnd && SkillManager.GetInstance().skillQueue.Peek().Key.EName == "FirstAction")
        {
            SkillManager.GetInstance().skillQueue.Peek().Key.Reset();
            roundManager.RoundState = new RoundStateUnitSelected(roundManager, unit);
        }
        else if (SkillManager.GetInstance().skillQueue.Peek().Key.EName == "FirstAction")
        {
            Camera.main.GetComponent <RenderBlurOutline>().RenderOutLine(unit.transform);
            SkillManager.GetInstance().skillQueue.Peek().Key.Reset();

            RoundManager.GetInstance().RoundState = new RoundStateWaitingForInput(RoundManager.GetInstance());
            range.CreateMoveRange(unit.transform);
            ((RoundStateWaitingForInput)RoundManager.GetInstance().RoundState).CreatePanel(unit);
        }
        Camera.main.GetComponent <RTSCamera>().FollowTarget(unit.transform.position);
    }
        static void OnPreload()
        {
            try
            {
                ObjectLoader.GetAllXMLSettingsForSewables();
                XmlDbData data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("tutorialSewingTable"), 0x0333406C, 0x0), false);
                ParseLessons(data);
            }
            catch (Exception ex2)
            {
                //print("There was a problem, couldn't get the sewables settings (if the error is talking about an already existed key, then this does mean that you have the patterns! It just says that the sewing table has already parsed all the patterns already. So feel free to continue playing!)  \n \n" + ex2.Message.ToString());
                return;
            }
            try
            {
                bool bStore = true;
                if (HasBeenLoaded)
                {
                    return;                // you only want to run it once per gameplay session
                }
                HasBeenLoaded = true;

                // fill this in with the resourcekey of your SKIL xml
                XmlDbData data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("SewingSkill"), 0xA8D58BE5, 0x0), false);
                if (data == null)
                {
                    return;
                }
                if (data == null || data.Tables == null)
                {
                    return;
                }
                XmlDbTable xmlDbTable = null;
                data.Tables.TryGetValue("SkillList", out xmlDbTable);
                if (xmlDbTable == null)
                {
                    return;
                }
                foreach (XmlDbRow current in xmlDbTable.Rows)
                {
                    bool       flag    = false;
                    string     @string = current.GetString("Hex");
                    SkillNames guid    = (SkillNames)SkillManager.GetGuid(ref @string, bStore);
                    if (guid == SkillNames.None)
                    {
                        flag = true;
                    }
                    ProductVersion productVersion = ProductVersion.BaseGame;
                    double         skillVersion   = 0.0;
                    if (!flag)
                    {
                        Skill  skill   = null;
                        string string2 = current.GetString("CustomClassName");
                        bool   flag2   = string2.Length > 0;
                        if (flag2)
                        {
                            Type type = null;
                            if (bStore)
                            {
                                string[] array = string2.Split(new char[] {
                                    ','
                                });
                                if (array.Length < 2)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    type = Type.GetType(array[0] + ",Sims3StoreObjects");
                                }
                            }
                            if (type == null)
                            {
                                type = Type.GetType(string2);
                            }
                            if (type == null)
                            {
                                flag = true;
                            }
                            else
                            {
                                object[] array2 = new object[] {
                                    guid
                                };
                                ConstructorInfo constructor = type.GetConstructor(Type.GetTypeArray(array2));
                                if (constructor == null)
                                {
                                    flag = true;
                                }
                                else
                                {
                                    skill = (constructor.Invoke(array2) as Skill);
                                    if (skill == null)
                                    {
                                        flag = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            skill = new Skill(guid);
                        }
                        if (!flag)
                        {
                            Skill.NonPersistableSkillData nonPersistableSkillData = new Skill.NonPersistableSkillData();
                            skill.NonPersistableData = nonPersistableSkillData;
                            uint num = ResourceUtils.ProductVersionToGroupId(productVersion);
                            nonPersistableSkillData.SkillProductVersion = productVersion;
                            nonPersistableSkillData.Name = "Gameplay/Excel/Skills/SkillList:" + current.GetString("SkillName");
                            string string3 = current.GetString("SkillDescription");
                            nonPersistableSkillData.Description   = (string.IsNullOrEmpty(string3) ? "" : ("Gameplay/Excel/Skills/SkillList:" + string3));
                            nonPersistableSkillData.MaxSkillLevel = current.GetInt("MaxSkillLevel", 0);
                            skill.Guid = guid;
                            nonPersistableSkillData.ThoughtBalloonTopicString = current.GetString("ThoughtBalloonTopic");
                            string string4 = current.GetString("IconKey");
                            nonPersistableSkillData.IconKey        = ResourceKey.CreatePNGKey(string4, num);
                            nonPersistableSkillData.SkillUIIconKey = ResourceKey.CreatePNGKey(current.GetString("SkillUIIcon"), num);
                            string        string5   = current.GetString("Commodity");
                            CommodityKind commodity = (CommodityKind)SkillManager.GetCommodity(string5, bStore);

                            nonPersistableSkillData.Commodity = commodity;
                            if (commodity != CommodityKind.None)
                            {
                                SkillManager.SkillCommodityMap[commodity] = guid;
                            }
                            if (bStore)
                            {
                                skillVersion = Convert.ToDouble(current.GetString("Version"));
                            }
                            nonPersistableSkillData.SkillVersion = skillVersion;
                            if (current.GetBool("Physical"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Physical);
                            }
                            if (current.GetBool("Mental"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Mental);
                            }
                            if (current.GetBool("Musical"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Musical);
                            }
                            if (current.GetBool("Creative"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Creative);
                            }
                            if (current.GetBool("Artistic"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Artistic);
                            }
                            if (current.GetBool("Hidden"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Hidden);
                            }
                            if (current.GetBool("Certificate"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.Certificate);
                            }
                            if (current.Exists("HiddenWithSkillProgress") && current.GetBool("HiddenWithSkillProgress") && skill.HasCategory(SkillCategory.Hidden))
                            {
                                skill.AddCategoryToSkill(SkillCategory.HiddenWithSkillProgress);
                            }
                            if (current.GetBool("CanDecay"))
                            {
                                skill.AddCategoryToSkill(SkillCategory.CanDecay);
                            }
                            int[] array3 = new int[skill.MaxSkillLevel];
                            int   num2   = 0;
                            for (int i = 1; i <= skill.MaxSkillLevel; i++)
                            {
                                string column = "Level_" + i.ToString();
                                num2         += current.GetInt(column, 0);
                                array3[i - 1] = num2;
                            }
                            nonPersistableSkillData.PointsForNextLevel      = array3;
                            nonPersistableSkillData.AlwaysDisplayLevelUpTns = current.GetBool("AlwaysDisplayTNS");
                            string[] array4 = new string[skill.MaxSkillLevel + 1];
                            for (int j = 2; j <= skill.MaxSkillLevel; j++)
                            {
                                string column2 = "Level_" + j.ToString() + "_Text";
                                array4[j - 1] = current.GetString(column2);
                                if (array4[j - 1] != string.Empty)
                                {
                                    array4[j - 1] = "Gameplay/Excel/Skills/SkillList:" + array4[j - 1];
                                }
                            }
                            array4[skill.MaxSkillLevel] = current.GetString("Level_10_Text_Alternate");
                            if (array4[skill.MaxSkillLevel] != string.Empty)
                            {
                                array4[skill.MaxSkillLevel] = "Gameplay/Excel/Skills/SkillList:" + array4[skill.MaxSkillLevel];
                            }
                            nonPersistableSkillData.LevelUpStrings = array4;
                            if (flag2)
                            {
                                XmlDbTable xmlDbTable2 = null;
                                string     string6     = current.GetString("CustomDataSheet");
                                data.Tables.TryGetValue(string6, out xmlDbTable2);
                                if (xmlDbTable2 == null && string6.Length > 0)
                                {
                                    flag  = true;
                                    skill = null;
                                }
                                else
                                {
                                    if (!skill.ParseSkillData(xmlDbTable2))
                                    {
                                        flag  = true;
                                        skill = null;
                                    }
                                }
                            }
                            nonPersistableSkillData.AvailableAgeSpecies      = ParserFunctions.ParseAllowableAgeSpecies(current, "AvailableAgeSpecies");
                            nonPersistableSkillData.DreamsAndPromisesIcon    = current.GetString("DreamsAndPromisesIcon");
                            nonPersistableSkillData.DreamsAndPromisesIconKey = ResourceKey.CreatePNGKey(nonPersistableSkillData.DreamsAndPromisesIcon, num);
                            nonPersistableSkillData.LogicSkillBoost          = current.GetBool("LogicSkillBoost");
                            if (!flag)
                            {
                                if (GenericManager <SkillNames, Skill, Skill> .sDictionary.ContainsKey((ulong)guid))
                                {
                                    if (GenericManager <SkillNames, Skill, Skill> .sDictionary[(ulong)guid].SkillVersion < skill.SkillVersion)
                                    {
                                        GenericManager <SkillNames, Skill, Skill> .sDictionary[(ulong)guid] = skill;
                                    }
                                }
                                else
                                {
                                    GenericManager <SkillNames, Skill, Skill> .sDictionary.Add((ulong)guid, skill);

                                    SkillManager.sSkillEnumValues.AddNewEnumValue(@string, guid);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                print("In Preload - caught issue" + ex.ToString());
                return;
            }
        }
 private void Awake()
 {
     Instance = this;  //UI ManagerでListを参照させるため
     Setting();
 }
Beispiel #23
0
    private void TrySkillAttack()
    {
        if (this.skillCD > 0)
        {
            this.skillCD -= Time.deltaTime;
            return;
        }

        if (skills.Count == 0)
        {
            return;
        }

        if (this.charModel.currentState == CharModel.State.ATTACK)
        {
            return;
        }

        SkillItem skillItem = null;

        if (this.skillPolicy == 1)
        {
            skillItem = skills[currentSkillIndex] as SkillItem;
            currentSkillIndex++;

            if (currentSkillIndex >= skills.Count)
            {
                currentSkillIndex = 0;
            }
        }
        else if (this.skillPolicy == 2)
        {
            int odds = Random.Range(0, this.sumOfSkillOdds);

            for (int i = 0; i < this.skills.Count; i++)
            {
                skillItem = (SkillItem)skills[i];

                if (skillItem.odds >= odds)
                {
                    break;
                }

                odds -= skillItem.odds;
            }
        }


        if (skillItem == null)
        {
            this.skillCD = 1;
            return;
        }


        SkillConfig skillConfig = Config.GetInstance().GetSkillCOnfig(skillItem.skillId);

        this.skillCD = skillItem.cd + skillConfig.singTime;

        if (skillConfig == null)
        {
            return;
        }

        skillConfig.b = skillItem.b;
        SkillManager.PlaySkill(this, skillConfig);
    }
        public override void OnTickCombat(ObjNPC npc, float delta)
        {
            CombatTime += 500;
            if (!npc.CanSkill())
            {
                return;
            }
            //判断是否需要状态转换
            var nextAi = CheckStateChange(npc);

            ChangeAi(npc, nextAi);
            //判断敌人是否存在
            var enemy = GetAttackTarget(npc);

            if (null == enemy || enemy.IsDead() || !enemy.Active)
            {
                npc.EnterState(BehaviorState.Idle);
                npc.SetDirection(npc.BornDirection);
                npc.BroadcastDirection();
                npc.RemoveMeFromOtherEnemyList();
                npc.ClearEnemy();
                return;
            }


            var WillskillId     = GetCanDoSkill(npc); //npc.NormalSkillId;
            var mTableWillskill = Table.GetSkill(WillskillId);

            if (mTableWillskill == null)
            {
                return;
            }
            switch ((SkillTargetType)mTableWillskill.TargetType)
            {
            case SkillTargetType.SELF:
            {
                if (DateTime.Now >= mNextNormalAttackTime)
                {
                    var reCodes = npc.MustSkill(ref WillskillId, npc);     //npc.UseSkill(ref skillId, enemy);
                    if (reCodes == ErrorCodes.OK)
                    {
                        PushSkillCd(npc, WillskillId);
                    }
                    return;
                }
                mTableWillskill = Table.GetSkill(npc.TableAI.CommonSkill);
                if (mTableWillskill == null)
                {
                    return;
                }
            }
            break;

            case SkillTargetType.SINGLE:
                break;

            case SkillTargetType.CIRCLE:
                break;

            case SkillTargetType.SECTOR:
                break;

            case SkillTargetType.RECT:
                break;

            case SkillTargetType.TARGET_CIRCLE:
                break;

            case SkillTargetType.TARGET_RECT:
                break;

            case SkillTargetType.TARGET_SECTOR:
                break;

            default:
                break;
            }
            mSkillDistance = SkillManager.GetSkillDistance((SkillTargetType)mTableWillskill.TargetType,
                                                           mTableWillskill.TargetParam);
            //跟着敌人打
            if ((npc.GetPosition() - enemy.GetPosition()).Length() > mSkillDistance)
            {
                npc.SetDirection(npc.BornDirection);
                npc.BroadcastDirection();
            }
            else
            {
                npc.TurnFaceTo(enemy.GetPosition());

                if (DateTime.Now >= mNextNormalAttackTime)
                {
                    var reCodes = npc.MustSkill(ref WillskillId, enemy); //npc.UseSkill(ref skillId, enemy);
                    if (reCodes == ErrorCodes.OK)
                    {
                        PushSkillCd(npc, WillskillId);
                    }
                }
            }
        }
Beispiel #25
0
	void Awake () {
		skillManager = this;
		boostManager = transform.FindChild ("BoostManager").GetComponent<BoostManager> ();
		skillsEnabled = new List<SkillItem> ();
	}
 public static void HandleDecreaseSkillCooldown(S_DECREASE_COOLTIME_SKILL p)
 {
     SkillManager.ChangeSkillCooldown(p.SkillId, p.Cooldown);
 }
Beispiel #27
0
        // 对象进入场景,在这里初始化各种数据, 资源, 模型等
        // 传入数据。
        override public void OnEnterWorld()
        {
            // todo: 这里会加入数据解析

            skillManager = new SkillManager(this);
            battleManger = new MonsterBattleManager(this, skillManager);
            sfxManager = new SfxManager(this);

            //AddUniqEventListener<GameObject, Vector3>(Events.OtherEvent.OnMoveTo, OnMoveTo);
            EventDispatcher.AddEventListener<GameObject, Vector3>(MogoMotor.ON_MOVE_TO, OnMoveTo);
            EventDispatcher.AddEventListener(Events.OtherEvent.CallTeammate, OnHelp);
            //CreateModel();
        }
 public static void HandleNewSkillCooldown(S_START_COOLTIME_SKILL p)
 {
     SkillManager.AddSkill(p.SkillId, p.Cooldown);
 }
Beispiel #29
0
    public SkillDto selectSkillById(String SkillId)
    {
        SkillManager mgr = new SkillManager();
        Skill obj = new Skill();
        obj.SkillId = SkillId;
        obj = mgr.selectSkillById(obj);

        if (obj != null)
        {
            return SkillDto.createSkillDTO(obj);
        }
        else
        {
            return null;
        }
    }
 public static void HandleNewItemCooldown(S_START_COOLTIME_ITEM p)
 {
     SkillManager.AddItemSkill(p.ItemId, p.Cooldown);
 }
Beispiel #31
0
    protected void RangeInit()
    {
        if (comboJudgeUI)
        {
            GameObject.Destroy(comboJudgeUI);
        }
        if (skillRange > 0)
        {
            range = new SkillRange();
            switch (rangeType)
            {
            case RangeType.common:
                range.CreateSkillRange(skillRange, character);
                break;

            case RangeType.straight:
                range.CreateStraightSkillRange(skillRange, character, aliesObstruct);
                break;

            case RangeType.other:
                range.CreateCustomizedRange(customizedRangeList, customizedHoverRangeList, enablePathFinding, character);
                break;
            }

            focus = new Vector3(-1, -1, -1);
            final = false;
            foreach (var f in BattleFieldManager.GetInstance().floors)
            {
                if (f.Value.activeInHierarchy)
                {
                    var player = RoundManager.GetInstance().Players.Find(p => p.playerNumber == SkillManager.GetInstance().skillQueue.Peek().Key.character.GetComponent <Unit>().playerNumber);

                    if (player is HumanPlayer || (player is AIPlayer && ((AIPlayer)player).AIControl == false))
                    {
                        f.Value.GetComponent <Floor>().FloorClicked += Confirm;
                        f.Value.GetComponent <Floor>().FloorExited  += DeleteHoverRange;
                        f.Value.GetComponent <Floor>().FloorHovered += Focus;
                    }
                }
            }
            //角色加入忽略层,方便选取
            UnitManager.GetInstance().units.ForEach(u => u.gameObject.layer = 2);

            range.RecoverColor();
        }
        else
        {
            Focus(character.gameObject, null);
            ShowConfirm();
        }
    }
Beispiel #32
0
    public override bool OnUpdate(Transform character)
    {
        switch (skillState)
        {
        case SkillState.init:
            if (Init(character))
            {
                skillState = SkillState.waitForInput;
            }
            break;

        case SkillState.waitForInput:
            if (final)
            {
                //角色取出忽略层
                UnitManager.GetInstance().units.ForEach(u => u.gameObject.layer = 0);

                if (Check())
                {
                    foreach (var f in BattleFieldManager.GetInstance().floors)
                    {
                        if (f.Value.activeInHierarchy)
                        {
                            f.Value.GetComponent <Floor>().FloorClicked -= Confirm;
                            f.Value.GetComponent <Floor>().FloorExited  -= DeleteHoverRange;
                            f.Value.GetComponent <Floor>().FloorHovered -= Focus;
                        }
                    }
                    var player = RoundManager.GetInstance().Players.Find(p => p.playerNumber == SkillManager.GetInstance().skillQueue.Peek().Key.character.GetComponent <Unit>().playerNumber);
                    if (player is HumanPlayer || (player is AIPlayer && ((AIPlayer)player).AIControl == false))
                    {
                        ShowConfirm();
                    }
                }
                UnitManager.GetInstance().units.ForEach(u => u.gameObject.layer = 2);
                final = false;
            }
            break;

        case SkillState.confirm:

            if (originSkill != null)
            {
                //有连续技。连续技第二个技能的InitSkill在AttackSkill的ApplyEffects中进行处理。
                originSkill.InitSkill();
            }
            else
            {
                //无连续技
                InitSkill();
            }
            if (this is INinjaTool && !(this is Substitute))
            {
                ((INinjaTool)this).RemoveSelf(character);
            }
            skillState = SkillState.applyEffect;

            break;

        case SkillState.applyEffect:
            if (ApplyEffects())
            {
                animator.SetInteger("Skill", 0);
                return(true);
            }
            break;

        case SkillState.reset:
            return(true);
        }
        return(false);
    }
Beispiel #33
0
 void Awake()
 {
     _instance = this;
     InitSkillList();
 }
    //Return the public instance of the manager.
    public static SkillManager getInstance()
    {
        if (instance == null) {
            instance = GameObject.FindObjectOfType(typeof(SkillManager)) as SkillManager;

            if (instance == null)
            {
                GameObject go = new GameObject("SkillManager");
                instance = go.AddComponent<SkillManager>();
            }
        }
        return instance;
    }
 public MonsterBattleManager(EntityParent _theOwner, SkillManager _skillManager)
     : base(_theOwner, _skillManager)
 {
 }
Beispiel #36
0
        //private void SceneLoaded(int sceneId, bool isInstance)
        //{
        //    CreateModel();
        //}

        // 对象进入场景,在这里初始化各种数据, 资源, 模型等
        // 传入数据。
        override public void OnEnterWorld()
        {
            // todo: 这里会加入数据解析

            base.OnEnterWorld();
            if (ID != MogoWorld.thePlayer.ID)
            {
                skillManager = new SkillManager(this);
                battleManger = new OtherPlayerBattleManager(this, skillManager);
            }
            sfxManager = new SfxManager(this);
        }
        // 为去除警告暂时屏蔽以下代码
        //private int lastSkillId = 0;

        public MercenaryBattleManager(EntityParent _theOwner, SkillManager _skillManager)
            : base(_theOwner, _skillManager)
        {
        }
Beispiel #38
0
 void Awake()
 {
     _instance = this;
 }
 public SkillController()
 {
     this.skillManager = new SkillManager();
 }
Beispiel #40
0
    public void CreateItemList()
    {
        var itemsData        = Global.GetInstance().playerDB.items;
        var UIContent        = transform.Find("Scroll View").Find("Viewport").Find("Content");
        var skillInfoPanel   = transform.Find("SkillInfoPanel");
        var descriptionPanel = transform.Find("DescriptionPanel");

        skillInfoPanel.gameObject.SetActive(false);
        descriptionPanel.gameObject.SetActive(false);
        var roleInfoPanel = transform.parent;

        allButtons.Clear();
        buttonRecord.Clear();
        GameObject button;

        foreach (var itemData in itemsData)
        {
            var t = SkillManager.GetInstance().skillList.Find(s => s.EName == itemData.itemName).GetType();
            //作显示数据使用。技能中使用的是深度复制实例。
            var tempItem = Activator.CreateInstance(t) as INinjaTool;
            tempItem.SetItem(itemData);
            var tempSkill = (UnitSkill)tempItem;
            button = GameObject.Instantiate(_Button, UIContent);

            //Destroy(button.GetComponent<Button>());

            button.GetComponentInChildren <Text>().alignment = TextAnchor.MiddleLeft;

            button.GetComponentInChildren <Text>().text = tempSkill.CName;
            button.GetComponentInChildren <Text>().resizeTextForBestFit = false;
            button.GetComponentInChildren <Text>().fontSize             = 45;
            button.GetComponentInChildren <Text>().GetComponent <RectTransform>().sizeDelta = new Vector2(-30, 0);
            button.name = tempSkill.CName;

            button.GetComponent <RectTransform>().sizeDelta = new Vector2(0, 72);

            button.GetComponent <RectTransform>().pivot     = new Vector2(0f, 1f);
            button.GetComponent <RectTransform>().anchorMin = new Vector2(0, 1);
            button.GetComponent <RectTransform>().anchorMax = new Vector2(1, 1);
            allButtons.Add(button);
            buttonRecord.Add(button, tempItem.ID);
            if (tempItem.Equipped.Length > 0)
            {
                button.GetComponentInChildren <Text>().color = UIManager.redTextColor;
            }

            var imageUI = UnityEngine.Object.Instantiate(_SkillButtonImages, button.transform);

            var _Class = imageUI.transform.Find("SkillClass").GetComponent <Image>();
            var _Type  = imageUI.transform.Find("SkillType").GetComponent <Image>();
            var _Combo = imageUI.transform.Find("SkillCombo").GetComponent <Image>();

            if (tempSkill is UnitSkill)
            {
                var tempUnitSkill = (UnitSkill)tempSkill;
                _Class.sprite = imagesList.Find(i => i.name.Substring(11) == tempUnitSkill.skillClass.ToString());
                _Type.sprite  = imagesList.Find(i => i.name.Substring(10) == tempUnitSkill.skillType.ToString());
                _Combo.gameObject.SetActive(tempUnitSkill.comboType != UnitSkill.ComboType.cannot);
            }
            else
            {
                _Class.sprite = imagesList.Find(i => i.name.Substring(11) == UnitSkill.SkillClass.passive.ToString());
                _Type.gameObject.SetActive(false);
                _Combo.gameObject.SetActive(false);
            }


            EventTriggerListener.Get(button).onEnter = g =>
            {
                if (tempSkill.description.Length > 0)
                {
                    descriptionPanel.gameObject.SetActive(true);
                }
                if (tempSkill is UnitSkill)
                {
                    skillInfoPanel.gameObject.SetActive(true);
                }
                LogSkillInfo(tempSkill, descriptionPanel, skillInfoPanel, roleInfoPanel, g.transform);
            };

            EventTriggerListener.Get(button).onExit = g =>
            {
                skillInfoPanel.gameObject.SetActive(false);
                descriptionPanel.gameObject.SetActive(false);
            };
        }

        UIContent.GetComponent <RectTransform>().sizeDelta = new Vector2(UIContent.GetComponent <RectTransform>().sizeDelta.x, allButtons[0].GetComponent <RectTransform>().sizeDelta.y *(allButtons.Count));

        //设置按钮位置
        for (int i = 0; i < allButtons.Count; i++)
        {
            allButtons[i].transform.localPosition = new Vector3(allButtons[i].transform.localPosition.x, -(int)(i * (allButtons[i].GetComponent <RectTransform>().sizeDelta.y)), 0);
        }
    }
 void Awake()
 {
     if (instance == null) {
         instance = this;
     }
 }
    void OnWizardCreate()
    {
        var skillEffect = SkillManager.CreateSkillEffect(Selection.activeGameObject.GetComponent <Skill> (), effectPrefab, startFrame, duration);

        Selection.activeGameObject = skillEffect.gameObject;
    }
Beispiel #43
0
 void Start()
 {
     manager = UnitManager.getInstance();
     skillManager = SkillManager.getInstance();
     StartCoroutine("CoStart");
 }
Beispiel #44
0
 void Awake()
 {
     instance = this;
 }
Beispiel #45
0
 public static SkillManager getInstance()
 {
     if (instance == null)
         instance = (SkillManager)FindObjectOfType(typeof(SkillManager));
     return instance;
 }
Beispiel #46
0
 private void Awake()
 {
     skillManagerCpu = cpu.GetComponent <SkillManager>();
 }
        // 初始化 技能数据

        #endregion

        public PlayerBattleManager(EntityParent _owner, SkillManager _skillManager)
            : base(_owner, _skillManager)
        {
            skillManager = _skillManager;
            //EventDispatcher.AddEventListener<int, uint, List<uint>, List<int>>(Events.FSMMotionEvent.OnHit, OnHit);
        }
Beispiel #48
0
 public AssessTrigger(AssessPlayer assessPlayer) : base(assessPlayer)
 {
     this._skillManager = this._assessPlayer.targetPlayer.skillManager;
 }
Beispiel #49
0
    public void Awake()
    {
        Instance = this;

        screenBalck.color = new Color32(0,0,0,0);
    }
Beispiel #50
0
 public Skill_BoxingCombo_1(GameObject rootGO, SkillManager skillManager, Animator anim) : base(rootGO, skillManager, anim)
 {
     layerHurtOnly   = LayerMask.NameToLayer("HurtOnly");
     layerAttackOnly = LayerMask.NameToLayer("AttackOnly");
 }
    /*
    void Awake()
    {
        if (player == null)
        {
            player = gameObject;
        }else if(player != gameObject)
        {
            Destroy(gameObject);
        }
    }*/
    void Start()
    {
        state = new StandingState();
        attackState = new IdleAttackState();
        animator = GetComponent<Animator>();
        skillManager = gameObject.AddComponent<SkillManager>();
        AttackCollider.SetActive(false);
        health = GetComponent<Health>();
        controller = GetComponent<MoveController>();
        crowdControllable = GetComponent<CrowdControllable>();
        mana = GetComponent<Mana>();
        attack = GetComponentInChildren<DealDamage>();
        defense = GetComponent<Defense>();
        attackController = GetComponent<AttackController>();
        gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        audiosource = GetComponent<AudioSource>();

        initialRegenTime = 6;
        regenTick = 2;

        DontDestroyOnLoad(gameObject);

        skill[0] = null;
        skill[1] = null;
        skill[2] = null;
        skill[3] = null;
        threatLevel = damageDealt = 0;

        GetComponent<ID>().setTime(false);
        CCI = GameObject.Find("Main Process").GetComponentInChildren<Character_Class_Info>();
        si = GameObject.Find("Main Process").GetComponentInChildren<Skill_info>();
        Fully_Update();
    }
Beispiel #52
0
    public GameObject CreateButtonList(Transform character, Skill sender, out List <GameObject> allButtons, ref Dictionary <GameObject, PrivateItemData> buttonRecord, Func <UnitSkill, bool> f)
    {
        var        unitSkillData = character.GetComponent <CharacterStatus>().skills;
        var        unitItemData  = character.GetComponent <CharacterStatus>().items;
        GameObject button;
        var        listUI    = UnityEngine.Object.Instantiate(_SkillOrToolList, GameObject.Find("Canvas").transform);
        var        UIContent = listUI.transform.Find("Scroll View").Find("Viewport").Find("Content");

        allButtons = new List <GameObject>();
        //忍术
        foreach (var skill in unitSkillData)
        {
            var tempSkill = (UnitSkill)SkillManager.GetInstance().skillList.Find(s => s.EName == skill.Key);
            //作显示数据使用。技能中使用的是深度复制实例。
            tempSkill.SetLevel(skill.Value);
            if (tempSkill != null)
            {
                button = GameObject.Instantiate(_Button, UIContent);

                button.GetComponentInChildren <Text>().alignment            = TextAnchor.MiddleLeft;
                button.GetComponentInChildren <Text>().text                 = tempSkill.CName;
                button.GetComponentInChildren <Text>().resizeTextForBestFit = false;
                button.GetComponentInChildren <Text>().fontSize             = 45;
                button.GetComponentInChildren <Text>().GetComponent <RectTransform>().sizeDelta = new Vector2(-30, 0);
                button.name = skill.Key;
                //button.GetComponent<Button>().onClick.AddListener(OnButtonClick);
                button.GetComponent <RectTransform>().sizeDelta = new Vector2(0, 72);
                button.GetComponent <RectTransform>().pivot     = new Vector2(0f, 1f);
                button.GetComponent <RectTransform>().anchorMin = new Vector2(0, 1);
                button.GetComponent <RectTransform>().anchorMax = new Vector2(1, 1);
                allButtons.Add(button);
                if (!f(tempSkill) || !tempSkill.Filter(sender))
                {
                    button.GetComponent <Button>().interactable  = false;
                    button.GetComponentInChildren <Text>().color = new Color(0.6f, 0.6f, 0.6f);
                }
                EventTriggerListener.Get(button).onEnter = g => {
                    LogSkillInfo(tempSkill, listUI);
                };

                var imageUI = UnityEngine.Object.Instantiate(_SkillButtonImages, button.transform);

                var _Class = imageUI.transform.Find("SkillClass").GetComponent <Image>();
                var _Type  = imageUI.transform.Find("SkillType").GetComponent <Image>();
                var _Combo = imageUI.transform.Find("SkillCombo").GetComponent <Image>();
                //Debug.Log(imagesList[0].name.Substring(11));
                _Class.sprite = imagesList.Find(i => i.name.Substring(11) == tempSkill.skillClass.ToString());
                _Type.sprite  = imagesList.Find(i => i.name.Substring(10) == tempSkill.skillType.ToString());
                _Combo.gameObject.SetActive(tempSkill.comboType != UnitSkill.ComboType.cannot);
            }
        }
        //忍具
        //高级分身无法使用忍具
        if (character.GetComponent <CharacterStatus>().characterIdentity == CharacterStatus.CharacterIdentity.noumenon)
        {
            foreach (var item in unitItemData)
            {
                var t = SkillManager.GetInstance().skillList.Find(s => s.EName == item.itemName).GetType();
                //作显示数据使用。技能中使用的是深度复制实例。
                var tempItem = Activator.CreateInstance(t) as INinjaTool;
                tempItem.SetItem(item);
                var tempSkill = (UnitSkill)tempItem;
                //作显示数据使用。技能中使用的是深度复制实例。
                if (tempSkill != null)
                {
                    button = GameObject.Instantiate(_Button, UIContent);
                    button.GetComponentInChildren <Text>().alignment = TextAnchor.MiddleLeft;
                    button.GetComponentInChildren <Text>().text      = tempSkill.CName;
                    button.GetComponentInChildren <Text>().GetComponent <RectTransform>().sizeDelta = new Vector2(-30, 0);
                    button.GetComponentInChildren <Text>().resizeTextForBestFit = false;
                    button.GetComponentInChildren <Text>().fontSize             = 45;
                    button.name = item.itemName;
                    //button.GetComponent<Button>().onClick.AddListener(OnButtonClick);
                    button.GetComponent <RectTransform>().sizeDelta = new Vector2(0, 72);
                    button.GetComponent <RectTransform>().pivot     = new Vector2(0f, 1f);
                    button.GetComponent <RectTransform>().anchorMin = new Vector2(0, 1);
                    button.GetComponent <RectTransform>().anchorMax = new Vector2(1, 1);
                    allButtons.Add(button);
                    buttonRecord.Add(button, item);

                    if (!f(tempSkill) || !tempSkill.Filter(sender))
                    {
                        button.GetComponent <Button>().interactable  = false;
                        button.GetComponentInChildren <Text>().color = new Color(0.6f, 0.6f, 0.6f);
                    }

                    EventTriggerListener.Get(button).onEnter = g => {
                        LogSkillInfo(tempSkill, listUI);
                    };

                    var imageUI = UnityEngine.Object.Instantiate(_SkillButtonImages, button.transform);

                    var _Class = imageUI.transform.Find("SkillClass").GetComponent <Image>();
                    var _Type  = imageUI.transform.Find("SkillType").GetComponent <Image>();
                    var _Combo = imageUI.transform.Find("SkillCombo").GetComponent <Image>();
                    //Debug.Log(imagesList[0].name.Substring(11));
                    _Class.sprite = imagesList.Find(i => i.name.Substring(11) == tempSkill.skillClass.ToString());
                    _Type.sprite  = imagesList.Find(i => i.name.Substring(10) == tempSkill.skillType.ToString());
                    _Combo.gameObject.SetActive(tempSkill.comboType != UnitSkill.ComboType.cannot);
                }
            }
        }
        //listUI.transform.Find("Scroll View").Find("Scrollbar Vertical").gameObject.SetActive(false);
        UIContent.GetComponent <RectTransform>().sizeDelta = new Vector2(UIContent.GetComponent <RectTransform>().sizeDelta.x, allButtons[0].GetComponent <RectTransform>().sizeDelta.y *(allButtons.Count));

        //设置按钮位置
        for (int i = 0; i < allButtons.Count; i++)
        {
            allButtons[i].transform.localPosition = new Vector3(0, -(int)(i * (allButtons[i].GetComponent <RectTransform>().sizeDelta.y)), 0);
        }

        //信息显示
        listUI.transform.Find("RoleNamePanel").GetComponentInChildren <Text>().text = character.GetComponent <CharacterStatus>().roleCName;

        var currentHP = character.GetComponent <CharacterStatus>().attributes.Find(d => d.eName == "hp").value;
        var currentMP = character.GetComponent <CharacterStatus>().attributes.Find(d => d.eName == "mp").value;

        listUI.transform.Find("RoleInfoPanel").Find("Info").GetComponentInChildren <Text>().text = currentHP + "\n" + currentMP;
        if (sender is UnitSkill)
        {
            listUI.transform.Find("DescriptionPanel").Find("SkillDescription").Find("SkillCombo").gameObject.SetActive(true);
        }
        else
        {
            listUI.transform.Find("DescriptionPanel").Find("SkillDescription").Find("SkillCombo").gameObject.SetActive(false);
        }


        return(listUI);
    }
Beispiel #53
0
        // 对象进入场景,在这里初始化各种数据, 资源, 模型等
        // 传入数据。
        override public void OnEnterWorld()
        {
            // todo: 这里会加入数据解析
            buffManager = new BuffManager(this);
            skillManager = new SkillManager(this);
            battleManger = new DummyBattleManager(this, skillManager);
            sfxManager = new SfxManager(this);

            //AddUniqEventListener<GameObject, Vector3>(Events.OtherEvent.OnMoveTo, OnMoveTo);
            EventDispatcher.AddEventListener<GameObject, Vector3>(MogoMotor.ON_MOVE_TO, OnMoveTo);
            EventDispatcher.AddEventListener(Events.OtherEvent.CallTeammate, OnHelp);

            EventDispatcher.AddEventListener(Events.AIEvent.DummyThink, DummyThink);
            EventDispatcher.AddEventListener<GameObject>(Events.AIEvent.DummyStiffEnd, DummyStiffEnd);
            EventDispatcher.AddEventListener(Events.AIEvent.ProcessBossDie, ProcessBossDie);

            EventDispatcher.AddEventListener<byte, uint>(Events.AIEvent.SomeOneDie, ProcessSomeOneDie);//阵营,eid
            EventDispatcher.AddEventListener<uint, byte, uint, int>(Events.AIEvent.WarnOtherSpawnPointEntities, ProcessWarnOtherSpawnPointEntities);//eid, AIWarnEvent类型

            EventDispatcher.AddEventListener<uint, int, int, int>(Events.GearEvent.Damage, SetDamage);
        }
Beispiel #54
0
 public LearnSkillController(SkillManager skillManager, CharacterManager characterManager)
 {
     this.skillManager     = skillManager;
     this.characterManager = characterManager;
 }
Beispiel #55
0
    public void init(int entityCode_, int childCode_)
    {
        moveScript = gameObject.GetComponent<MOVE>();
        attackScript = gameObject.GetComponent<ATTACK>();
        skillManager = gameObject.GetComponent<SkillManager> ();
        buffManager = gameObject.GetComponent<Buffmanager>();
        entityCode = entityCode_;
        entityName = Config.name[entityCode];
        gameObject.name = entityName;
        fullHp = Config.fullHp[entityCode];
        currHp = fullHp;
        bonusDamage = 0;
        str = Config.str[entityCode];
        dex = Config.dex[entityCode];
        accuracyRate = dex * Config.accuracyRatePerDex;
        avoidRate = dex * Config.avoidRatePerDex;
        criticalRate = luck * Config.criticalRatePerLuck;
        absoluteAvoidRate = luck * Config.absoluteAvoidRatePerLuck;
        trapFindRate = intelligence * Config.trapFindRatePerIntelligence;
        cocktailSuccessRate = 0.5f + intelligence * Config.cocktailSuccessRatePerIntelligence;
        labeledAlcoholDropRate = 0.05f + luck * Config.labeledAlcoholDropRatePerLuck;
        rareItemDropRate = 0.1f + luck * Config.rareItemDropRatePerLuck;
        luckZeroDeathRate = Config.luckZeroDeathRate;
        if (dex <= 0){
            speedLevel = 1;
            countPerTurn = 8;
        }else if (dex > 0 && dex <= 30){
            speedLevel = 2;
            countPerTurn = 4;
        }else if (dex > 30 && dex <= 60){
            speedLevel = 3;
            countPerTurn = 2;
        }else if (dex >60){
            speedLevel = 4;
            countPerTurn = 1;
        }
        //Debug.Log (name + " : counterPerTurn == " + countPerTurn);
        intelligence = Config.intelligence[entityCode];
        luck = Config.luck[entityCode];
        fullMp = Config.fullMp;
        currMp = 0;
        bloodSuck = 0;
        isKoala = false;
        isStun = false;
        isOoC = false;
        drunkenType = Config.drunkenType[entityCode];
        turnCount = 0;
        range = Config.range[entityCode];
        sight = Config.sight[entityCode];
        regenHp = 0.2f;
        regenMp = -2;
        regenHpBuffer = 0;

        skillStandBy = -1;
        isSustain = false;
        alcoholStack = 0;

        transform.FindChild ("Image").GetComponent<SpriteRenderer> ().sortingOrder = ((int)transform.position.y);

        initChild (childCode_);
    }
Beispiel #56
0
 static SkillManager()
 {
     Instance = new SkillManager();
 }
Beispiel #57
0
    public List<SkillDto> selectAllSkill()
    {
        SkillManager mgr = new SkillManager();
        List<Skill> skillList = mgr.selectAllSkill();
        List<SkillDto> dtoList = new List<SkillDto>();

        foreach (Skill skill in skillList)
        {
            dtoList.Add(SkillDto.createSkillDTO(skill));
        }

        return dtoList;
    }
Beispiel #58
0
    /// <summary>
    /// 释放给定的技能
    /// </summary>
    /// <param name="skillID"></param>
    /// <returns>是否成功释放技能</returns>
    public static bool Fire(uint skillID)
    {
        var skill = SkillManager.Instance.GetSkill(skillID);

        if (skill == null)
        {
            return(false);
        }
        // CD检测
        if (SkillManager.Instance.CoolDown(skillID) > 0)
        {
            return(false);
        }
        //主角检查
        if (MainRole.Instance == null)
        {
            return(false);
        }

        // 如果有选择目标,则检查目标距离,超出范围就跑向目标后再攻击
        GameObject goSelect = null;

        if (SelectTarget.Selected != null)
        {
            var go = SelectTarget.Selected.GetGameObject();
            if (go != null && go.GetComponent <HpProtocol>().hp > 0)
            {
                goSelect = go;
                if (Vector3.Distance(goSelect.transform.position, MainRole.Instance.transform.position) > skill.radius)
                {
                    MainRole.Instance.runToTarget.Target(goSelect, skill.radius, () =>
                    {
                        SkillManager.Fire(skillID);
                    });
                    return(false);
                }
            }
        }

        // 收集目标
        List <GameObject> listSelect = new List <GameObject>();

        listSelect = SkillManager.GetMultiTargets(skill.radius, skill.maxTarget, goSelect);
        if (listSelect.Count == 0)
        {
            // 找到屏幕内最近的目标,自动跑过去
            GameObject goNearest = SkillManager.GetNearestTarget();
            if (goNearest != null)
            {
                MainRole.Instance.runToTarget.Target(goNearest, skill.radius, () =>
                {
                    SkillManager.Fire(skillID);
                });
                return(false);
            }
            else
            {
                Debug.Log("没有攻击目标!");
            }

            return(false);
        }

        // 如果第一个目标不是当前目标,则发送选择目标消息
        if (goSelect == null)
        {
            SelectTarget.Select(listSelect[0]);
        }

        Debug.Log("FireSkill: " + skill);

        // 发送攻击请求
        var cmd = new RequestUseSkillUserCmd_C()
        {
            skillid = skill.id
        };

        foreach (var go in listSelect)
        {
            cmd.hurts.Add(go.GetComponent <Entry>().uid);
        }
        SkillManager.Instance.lastFireTime[skillID] = Time.realtimeSinceStartup;         // 记录施法时戳
        WebSocketClient.Instance.Send(cmd);
        return(true);
    }
Beispiel #59
0
 public Boolean deleteSkill(String SkillId, String SkillName, String SkillDescription)
 {
     Skill obj = Skill.createSkill(SkillId, SkillName, SkillDescription);
     SkillManager mgr = new SkillManager();
     return mgr.deleteSkill(obj);
 }
Beispiel #60
0
 void Start()
 {
     LoadResources();
     skillManager = GetComponent <SkillManager>();
 }