//type = a:1/10, b:1/100, c:1/1000
    public Player_HeroSkillEditCommand( string playerId,string authToken,string herotype,HeroData hd, CompleteDelegate completeDelegate, ErrorDelegate errorDelegate)
    {
        Hashtable batchHash = new Hashtable ();
        batchHash.Add ("authKey", authToken);

        ArrayList commands = new ArrayList();
        Hashtable command = new Hashtable ();
        command.Add ("action", "player.heroSkillEdit");
        command.Add ("time", TimeUtils.UnixTime);
        ArrayList activeSkillIDList = new ArrayList(){"a","b","c"};
        ArrayList passiveSkillIDList = new ArrayList(){"d","e","f"};
        command.Add ("args", new Hashtable () { { "playerId", playerId },{"herotype",herotype},{"as",activeSkillIDList},{"ps",passiveSkillIDList}});
        command.Add ("requestId", 123);
        commands.Add(command);
        batchHash.Add("commands",commands);

        batch = MiniJSON.jsonEncode(batchHash);

        ////////
        this.onComplete = delegate(Hashtable t){
            completeDelegate(t);
        };
        /////////
        this.onError = delegate(string err_code,string err_msg, Hashtable data){
            errorDelegate(err_code,err_msg,data);
        };
    }
    public void Refresh(HeroData data)
    {
		curHero = data;
//        if (curHero != null)
//            if (curHero != data || curHero.starLevel != data.starLevel)
//            {
//                curHero = data;
//            }
//            else return;
        HeroProperty pros = data.property;
		SetText(labHP, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_LIFEPOINT).ToString(), pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_LIFEGROWTH_1) > 0 ? pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_LIFEGROWTH_1).ToString() : "");
		SetText(labATK, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_ATTACK).ToString(), pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_ATTACKGROWTH_1) > 0 ? pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_ATTACKGROWTH_1).ToString() : "");
		SetText(labDEF, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_ARMOR).ToString(), pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_ARMORGROWTH_1) > 0 ? pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_ARMORGROWTH_1).ToString() : "");
		SetText(labWuS, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_MANAPOINT).ToString());
		SetText(labATKSpeed, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_ATKSPD).ToString());
		SetText(labCritOdds, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_CRITICALLV).ToString());
		SetText(labCritHarm, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_CRITICAL_DAMAGE).ToString());
		SetText(labHitOdds, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_HITLV).ToString());
		SetText(labTureDamage, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_TRUEDAMAGE).ToString());
        //TODO:
        SetText(labStartHit, "D");
		SetText(labRevertByHit, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_HITREGEN).ToString());
		SetText(labFilchByHit, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_LIFESTEAK).ToString());
		SetText(labRevertByFight, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_RECOVERY).ToString());
		SetText(labDodgeOdds, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_DODGELV).ToString());
		SetText(labTenacityOdds, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_TENACITYLV).ToString());
		SetText(labTenacity, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_TENACITYLV).ToString());
		SetText(labTrueDgresist, pros.getPro ((int)GlobalDef.NewHeroProperty.PRO_TRUEDGRESIST).ToString());

		int debirs = data.debris;
		labCount.text = debirs + "/" + data.infoStar.itemNum;
		sldProgress.value = debirs * 1.0f / data.infoStar.itemNum;
    }
    public virtual void InitUI()
    {
        FightHeroList heroList = MonoInstancePool.getInstance<HeroManager>().fightHeroList;
        Dictionary<int, long> dict = heroList.getFightHeroDict();

        curHero = heroList.getHeroData(0);
        SetSkillButton(heroList);

        curUIHero.SetSkills(skillDir[curHero.templateID]);

        curUIHero.Refresh(curHero);

        List<HeroData> heros = heroList.getHeros();

        SetAideCount(heros.Count);

        for (int i = 0; i < heros.Count; i++)
        {
            if (i == 0)
            { }
            else
            {
                RefreshAide(i, heros[i]);
            }
        }
    }
 public void Init(HeroData d)
 {
     data = d;
     InitEquipment();
     //SetCollapse(true);
     Refresh();
 }
	public string parseData(int id, HeroData data, SkillItem skill)
	{
		templateID = id;

		info   = StaticSkill_info.Instance().getStr(templateID,"info");
		param1 = StaticSkill_info.Instance().getFloat(templateID, "param1");
		param2 = StaticSkill_info.Instance().getFloat(templateID, "param2");
		param3 = StaticSkill_info.Instance().getFloat(templateID, "param3");
		param4 = StaticSkill_info.Instance().getFloat(templateID, "param4");
		param5 = StaticSkill_info.Instance().getFloat(templateID, "param5");
		param6 = StaticSkill_info.Instance().getFloat(templateID, "param6");
		varaible1 = StaticSkill_info.Instance().getFloat(templateID, "varaible1");
		varaible2 = StaticSkill_info.Instance().getFloat(templateID, "varaible2");
		varaible3 = StaticSkill_info.Instance().getFloat(templateID, "varaible3");
		formula0  = StaticSkill_info.Instance().getInt(templateID,  "formula0");
		formula1  = StaticSkill_info.Instance().getInt(templateID,  "formula1");
		formula2  = StaticSkill_info.Instance().getInt(templateID,  "formula2");

		des = info;
		resParam1 = processDes (formula0,data, skill);
		resParam2 = processDes (formula1,data, skill);
		resParam3 = processDes (formula2,data, skill);
		des = string.Format(info, resParam1, resParam2, resParam3);

		return "";
	}
	public void refresh(HeroData data, SkillItem skill, int idx)
	{
		Icon.spriteName = skill.icon;
		Name.text   = skill.name;
		Level.text  = skill.level + "级";
		CostMp.text = ""+skill.consume;
		CDTime.text = ""+(int)skill.cd;
		Des1.text   = skill.describe;

		skill.effectDescribe.refresh (data, skill);
		Des2.text = skill.effectDescribe.des;

		int cost = 0;
		skillIdx = idx;
		switch(skillIdx)
		{
		case 0:
			cost = StaticSkilllevel.Instance().getInt (skill.level, "price0");
			break;
		case 1:
			cost = StaticSkilllevel.Instance().getInt (skill.level, "price1");	
			break;
		case 2:
			cost = StaticSkilllevel.Instance().getInt (skill.level, "price2");
			break;
		case 3:
			cost = StaticSkilllevel.Instance().getInt (skill.level, "price3");
			break;
		}
		LvupCost.text = "" + cost;
	}
Ejemplo n.º 7
0
    void OnReceivedHeroData(byte[] msg)
    {
        HeroDataPacket heroDataPacket = new HeroDataPacket(msg);
        HeroData       heroData       = heroDataPacket.GetData();

        dataManager.SetHeroData(heroData);
        loadingManager.dataCheck[(int)ServerPacketId.HeroData - 4] = true;
    }
Ejemplo n.º 8
0
        public bool Serialize(HeroData data)
        {
            bool ret = true;

            ret &= Serialize(data.Id);
            ret &= Serialize(data.level);
            return(ret);
        }
Ejemplo n.º 9
0
        private void RandomPC_Click(object sender, EventArgs e)
        {
            Hero hero = HeroData.Create().ConvertToHero();

            Session.Project.Heroes.Add(hero);
            Session.Modified = true;
            this.update_view();
        }
	public void refresh(HeroData data, SkillItem skill)
	{
		des = info;
		resParam1 = processDes (formula0,data, skill);
		resParam2 = processDes (formula1,data, skill);
		resParam3 = processDes (formula2,data, skill);
		des = string.Format(info, resParam1, resParam2, resParam3);
	}
Ejemplo n.º 11
0
    public static HeroData Create()
    {
        HeroData asset = ScriptableObject.CreateInstance <HeroData> ();

        AssetDatabase.CreateAsset(asset, "Assets/GameDataFiles/HeroData.asset");
        AssetDatabase.SaveAssets();
        return(asset);
    }
    public SkillItem(HeroData heroData, int id)
    {
        this.hero = heroData;
		level = 1;
        parseData(id);

		effectDescribe.parseData (id, heroData, this);
    }
        public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            SelectedHeroData = (HeroData)parameter;

            Busy.SetBusy(false);

            return(Task.CompletedTask);
        }
Ejemplo n.º 14
0
    public static HeroData GetCharacterData(CharacterData data)
    {
        HeroData characterData = new HeroData();

        characterData.ID   = data.id;
        characterData.Name = data.name;
        return(characterData);
    }
Ejemplo n.º 15
0
 public void OnItemSlotClick(HeroData heroData)
 {
     SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
     CharactersManager.instance.SetStageHeros(index, heroData.id);
     RefreshUI();
     pinPoint.SetActive(false);
     selectHeroLockCover.SetActive(true);
 }
Ejemplo n.º 16
0
 private float GetPassiveValue(HeroData data)
 {
     Hashtable psTable = data.passiveHash["GAMORA10A"] as Hashtable;
     float v = (null != psTable && psTable.ContainsKey("sk_damage"))
                 ? ((int)psTable["sk_damage"] * 0.01f + 1f)
                 : 1f;
     return v;
 }
Ejemplo n.º 17
0
    void PickAHero(int index)
    {
        int      heroIndex = Random.Range(0, listToPick.Count);
        HeroData hero      = listToPick[heroIndex];

        listToPick.RemoveAt(heroIndex);
        transform.GetChild(index).GetComponent <CharacterSelector>().SetHero(hero);
    }
//作者:
//		1:参数1/100*英雄当前伤害+参数2+变量1*lv
//		2:参数3/100*英雄当前伤害+参数4+变量2*lv
//		3:参数5/100*英雄当前伤害+参数6+变量3*lv
//		4:(参数1+变量1*lv)/100*英雄当前伤害+参数2
//		5:(参数3+变量2*lv)/100*英雄当前伤害+参数4
//		6:(参数5+变量3*lv)/100*英雄当前伤害+参数6
//		7:参数1/100+参数2+变量1*lv
//		8:参数3/100+参数4+变量2*lv
//		9:参数5/100+参数6+变量3*lv
//		10:(参数1+变量1*lv)/100+参数2
//		11:(参数3+变量2*lv)/100+参数4
//		12:(参数5+变量3*lv)/100+参数6
//		13:参数1+(变量1*lv)
//		14:参数3+(变量2*lv)
//		15:参数5+(变量3*lv)

	public int processDes(int desID, HeroData data, SkillItem skill)
	{
		float res = 0;
		int min = (int)data.getMinAttack();
		int max = (int)data.getMaxAttack();
		int atk = (max + min)/2;
		switch(desID)
		{
		case 1:
			res = param1/100*atk + param2 + varaible1*skill.level;
			break;
		case 2:
			res = param3/100*atk + param4 + varaible2*skill.level;
			break;
		case 3:
			res = param5/100*atk + param6 + varaible3*skill.level;
			break;
		case 4:
			res = (param1 + varaible1*skill.level) / 100 * atk + param2;
			break;
		case 5:
			res = (param3 + varaible2*skill.level) / 100 * atk + param4;
			break;
		case 6:
			res = (param5 + varaible3*skill.level) / 100 * atk + param6;
			break;
		case 7:
			res = param1 / 100 + param2 + varaible1*skill.level;
			break;
		case 8:
			res = param3 / 100 + param4 + varaible2*skill.level;
			break;
		case 9:
			res = param5 / 100 + param6 + varaible3*skill.level;
			break;
		case 10:
			res = (param1 + varaible1*skill.level) + param2;
			break;
		case 11:
			res = (param3 + varaible2*skill.level) + param4;
			break;
		case 12:
			res = (param5 + varaible3*skill.level) + param6;
			break;
		case 13:
			res = param1 + varaible1*skill.level;
			break;
		case 14:
			res = param3 + varaible2*skill.level;
			break;
		case 15:
			res = param5 + varaible3*skill.level;
			break;
		default :
			return 0;
		}
		return (int)res;
	}
Ejemplo n.º 19
0
    private void GetHeroArr()
    {
        string name           = "";
        string currentattrstr = "";
        string nextlvattrstr  = "";

        playerData.GetInstance().selectHeroDetail.RefreshAttr();
        float[]  itemarr     = playerData.GetInstance().selectHeroDetail.charAttrs;
        HeroData myHd        = playerData.GetInstance().selectHeroDetail;
        HeroData nextGradeHd = new HeroData(myHd.id, myHd.lvl, myHd.grade + 1, myHd.star);

        nextGradeHd.equipSite = myHd.equipSite;
        nextGradeHd.RefreshAttr();
        float[] nextgradearr = nextGradeHd.charAttrs;
        for (int i = 0; i < itemarr.Length; i++)
        {
            if (itemarr[i] > 0)
            {
                name           += propertyname[i] + "\n";
                currentattrstr += ((int)itemarr[i]).ToString() + "\n";
                nextlvattrstr  += ((int)nextgradearr[i]).ToString() + "\n";
            }
        }
        nextGradeHd   = null;
        heroPreView   = transform.Find("HeroPreview").GetComponent <UIScrollView>();
        attrName      = transform.Find("HeroPreview/AttrName").GetComponent <GUISingleLabel>();
        attrValue     = transform.Find("HeroPreview/AttrValue").GetComponent <GUISingleLabel>();
        nextAttrValue = transform.Find("HeroPreview/NextAttrValue").GetComponent <GUISingleLabel>();
        if (attrName != null)
        {
            attrName.text = name;
            UIWidget widget = attrName.GetComponent <UIWidget>();
            if (widget != null)
            {
                bool vis = widget.isVisible;

                if (!vis)
                {
                    this.gameObject.SetActive(true);
                }

                this.gameObject.SetActive(vis);
            }
            NGUITools.AddWidgetCollider(attrName.gameObject, true);
        }
        if (attrValue != null)
        {
            attrValue.text = currentattrstr;
        }
        if (nextAttrValue != null)
        {
            nextAttrValue.text = nextlvattrstr;
        }
        if (heroPreView != null)
        {
            heroPreView.ResetPosition();
        }
    }
Ejemplo n.º 20
0
    public void UpdateWindow()
    {
        HeroData hero = HeroDetailWindow.hero;

        mainText.text = "";
        Dictionary <BonusType, HeroData.HeroBonusTotal> bonusTotalsDict = hero.GetAllBonusTotals();

        List <BonusType> sortedBonuses = bonusTotalsDict.Keys.ToList();

        sortedBonuses.Sort();

        foreach (BonusType bonusType in sortedBonuses)
        {
            HeroData.HeroBonusTotal bonusTotal       = bonusTotalsDict[bonusType];
            List <GroupType>        sortedGroupTypes = bonusTotal.sumByRestrictions.Keys.ToList();
            sortedGroupTypes.Sort();

            if (!sortedGroupTypes.Contains(GroupType.NO_GROUP))
            {
                mainText.text += "○ " + LocalizationManager.Instance.GetBonusTypeString(bonusType) + '\n';
            }

            foreach (GroupType groupType in sortedGroupTypes)
            {
                StatBonus statBonus = bonusTotal.sumByRestrictions[groupType];

                if (groupType != GroupType.NO_GROUP)
                {
                    mainText.text += "<margin=2em>";
                }

                if (statBonus.HasFixedModifier)
                {
                    mainText.text += "○ " + LocalizationManager.Instance.GetLocalizationText_BonusType(bonusType, ModifyType.FLAT_ADDITION, statBonus.FixedModifier, groupType);
                }
                else
                {
                    if (statBonus.AdditiveModifier != 0)
                    {
                        mainText.text += "○ " + LocalizationManager.Instance.GetLocalizationText_BonusType(bonusType, ModifyType.ADDITIVE, statBonus.AdditiveModifier, groupType);
                    }

                    if (statBonus.FlatModifier != 0)
                    {
                        mainText.text += "○ " + LocalizationManager.Instance.GetLocalizationText_BonusType(bonusType, ModifyType.FLAT_ADDITION, statBonus.FlatModifier, groupType);
                    }

                    if (statBonus.MultiplyModifiers.Count != 0)
                    {
                        mainText.text += "○ " + LocalizationManager.Instance.GetLocalizationText_BonusType(bonusType, ModifyType.MULTIPLY, (statBonus.CurrentMultiplier - 1) * 100, groupType);
                    }
                }

                mainText.text += "</margin>";
            }
            mainText.text += "\n";
        }
    }
Ejemplo n.º 21
0
    public void OnEnter()
    {
        heroData         = GameRoot.GetInstance().BattleField.assetManager.GetHeroData(GameRoot.GetInstance().gameDataManager.boss.id);
        heroName.text    = StrUtil.GetText(heroData.CreatureName);
        exp              = GameRoot.GetInstance().gameDataManager.bossExp[heroData.id - 1001];
        proficiency.text = StrUtil.GetText("熟练度:") + exp;

        heroSprite.sprite = GameRoot.GetInstance().BattleField.assetManager.GetCards(heroData.icon);

        skillPanel.content.sizeDelta = new Vector2(0, 160 * heroData.talents.Length + 20);

        int unlockNum = 0;

        for (int i = 0; i < heroData.talents.Length; ++i)
        {
            SkillData  skillData = GameRoot.GetInstance().BattleField.assetManager.GetSkillData(heroData.talents[i]);
            GameObject obj       = Instantiate(skillInfoPrefab);
            obj.transform.parent        = skillPanel.content.transform;
            obj.transform.localScale    = Vector3.one;
            obj.transform.localPosition = new Vector3(325, -100 - i * 160, 0);
            obj.GetComponent <SkillInfoPanel>().InjectData(skillData, heroData);
            if (skillData.needExp <= exp)
            {
                ++unlockNum;
                obj.GetComponent <SkillInfoPanel>().Lock(false);
            }
            else
            {
                obj.GetComponent <SkillInfoPanel>().Lock(true);
            }
        }

        talent.text = StrUtil.GetText("天赋") + " " + unlockNum + "/" + heroData.talents.Length;

        quitBtn.GetComponent <RectTransform>().position = new Vector3(-Screen.width * 2 / 5, quitBtn.GetComponent <RectTransform>().position.y, 0);
        quitBtn.GetComponent <RectTransform>().DOMoveX(0, 0.5f);
        nextBtn.GetComponent <RectTransform>().position = new Vector3(Screen.width * 3 / 2, quitBtn.GetComponent <RectTransform>().position.y, 0);
        nextBtn.GetComponent <RectTransform>().DOMoveX(Screen.width, 0.5f);
        float x = heroName.gameObject.GetComponent <RectTransform>().position.x;

        heroName.gameObject.GetComponent <RectTransform>().position = new Vector3(-Screen.width * 2 / 5, heroName.GetComponent <RectTransform>().position.y, 0);
        heroName.gameObject.GetComponent <RectTransform>().DOMoveX(x, 0.5f);

        float x_2 = proficiency.gameObject.GetComponent <RectTransform>().position.x;

        proficiency.gameObject.GetComponent <RectTransform>().position = new Vector3(-Screen.width * 2 / 5, proficiency.GetComponent <RectTransform>().position.y, 0);
        proficiency.gameObject.GetComponent <RectTransform>().DOMoveX(x_2, 0.5f);

        float x_3 = talent.gameObject.GetComponent <RectTransform>().position.x;

        talent.gameObject.GetComponent <RectTransform>().position = new Vector3(-Screen.width * 2 / 5, talent.GetComponent <RectTransform>().position.y, 0);
        talent.gameObject.GetComponent <RectTransform>().DOMoveX(x_3, 0.5f);

        float x_4 = skillPanel.gameObject.GetComponent <RectTransform>().position.x;

        skillPanel.gameObject.GetComponent <RectTransform>().position = new Vector3(-Screen.width * 2 / 5, skillPanel.GetComponent <RectTransform>().position.y, 0);
        skillPanel.gameObject.GetComponent <RectTransform>().DOMoveX(x_4, 0.5f);
    }
Ejemplo n.º 22
0
 public void RemoveHeroData(HeroData hero)
 {
     if (heroDict.ContainsKey(hero.Id))
     {
         HeroSaveData temp = heroDict[hero.Id];
         heroDict.Remove(hero.Id);
         heroList.Remove(temp);
     }
 }
Ejemplo n.º 23
0
        internal static void Initialize()
        {
            GameSettings.EnergyRegenateSeconds = ((GlobalData)CSV.Tables.Get(Gamefile.Globals).GetData("ENERGY_REGENERATE_SECONDS")).NumberValue;

            GameSettings.StartingGold      = ((GlobalData)CSV.Tables.Get(Gamefile.Globals).GetData("STARTING_GOLD")).NumberValue;
            GameSettings.StartingDiamonds  = ((GlobalData)CSV.Tables.Get(Gamefile.Globals).GetData("STARTING_DIAMONDS")).NumberValue;
            GameSettings.StartingCharacter = (HeroData)CSV.Tables.Get(Gamefile.Heroes).GetData(((GlobalData)CSV.Tables.Get(Gamefile.Globals).GetData("STARTING_CHARACTER")).TextValue);
            GameSettings.StartingQuest     = (QuestData)CSV.Tables.Get(Gamefile.Quests).GetData(((GlobalData)CSV.Tables.Get(Gamefile.Globals).GetData("STARTING_QUEST")).TextValue);
        }
Ejemplo n.º 24
0
    public void Init(HeroData heroData, float precent, string str)
    {
        this.heroItem = (Resources.Load("Prefab/NewUI/SelectHero/SelectHeroItem") as GameObject);
        GameObject gameObject = NGUITools.AddChild(this.V_HeroItem.gameObject, this.heroItem);

        gameObject.GetComponent <NewHeroItem>().Init(heroData, NewHeroItem.CardType.HeroAvator, true, true);
        this.V_Slider.fillAmount = precent;
        this.V_Label.text        = str;
    }
Ejemplo n.º 25
0
        public void Init(HeroData heroData, Action cancelCallback, Action skillCallback)
        {
            cancelComplete = cancelCallback;
            skillComplete  = skillCallback;
            data           = heroData;
//            skillImg.sprite
            UpdateLifeDisplay();
            UpdateEnergy();
        }
Ejemplo n.º 26
0
 public void Init(HeroData data)
 {
     if (data == null)
     {
         Debug.LogWarning("data is null");
         return;
     }
     gameObject.SetActive(true);
 }
Ejemplo n.º 27
0
 public void RecordUseDrug(HeroData hd, ItemNodeState item)
 {
     Recordid   = hd.id;
     Recordlvl  = hd.lvl;
     RecordCurE = hd.exps;
     RecordMaxE = hd.maxExps;
     DrugID     = item.props_id;
     DrugCount  = playerData.GetInstance().GetItemCountById(item.props_id);
 }
Ejemplo n.º 28
0
    void OnAddHero(HeroData heroData)
    {
        //가장 앞 순서의 빈 슬롯
        emptySlot = heroSelectSlotList.Find(x => string.IsNullOrEmpty(x.id));
        //emptySlot.AssignHero(heroData);

        //시작 버튼 활성
        Instance.buttonStart.interactable = selectedHeroDataList.Count > 0;
    }
Ejemplo n.º 29
0
 public void UnfixOfficer(HeroData heroData)
 {
     if (takeOfficer.ContainsKey(heroData.Officer))
     {
         takeOfficer.Remove(heroData.Officer);
     }
     heroData.Officer = 0;
     heroData.ClearOfficerAttr();
 }
Ejemplo n.º 30
0
        protected virtual void DrawTitle(PlayerState state, HeroData config)
        {
            var rotation   = Quaternion.FromToRotation(Vector3.forward, state.Speed);
            var leftPoint  = rotation * (Vector3.up * 1.2f + Vector3.left * .3f);
            var rightPoint = rotation * (Vector3.up * 1.2f + Vector3.right * .3f);
            var full       = (rightPoint - leftPoint) * state.HitPoints / config.HitPoints;

            Debug.DrawLine(state.Position + leftPoint, state.Position + leftPoint + full, Color.red);
        }
Ejemplo n.º 31
0
    /// <summary> 캐릭터 정보 상세보기 </summary>
    public void ShowHeroInfo(HeroData heroData)
    {
        if (coroutineShowHeroInfo != null)
        {
            StopCoroutine(coroutineShowHeroInfo);
        }

        coroutineShowHeroInfo = StartCoroutine(ShowHeroInfoA(heroData));
    }
Ejemplo n.º 32
0
    public void ShowHero(GameObject hero, HeroData heroData)
    {
        if (hero != null)
        {
            targetHeroData = heroData;
            showHeroObj    = Instantiate(hero, HeroShowPoint.transform);
            showHeroObj.transform.localScale    = new Vector3(200, 200, 200);
            showHeroObj.transform.localPosition = Vector3.zero;

            if (showHeroObj.GetComponent <Hero>() != null)
            {
                Destroy(showHeroObj.GetComponent <Hero>());
            }
            if (showHeroObj.GetComponent <Rigidbody2D>() != null)
            {
                Destroy(showHeroObj.GetComponent <Rigidbody2D>());
            }
            foreach (var sp in showHeroObj.GetComponentsInChildren <SpriteRenderer>())
            {
                sp.sortingLayerName = "ShowObject";
                sp.gameObject.layer = 16;
            }
            showHeroObj.gameObject.SetActive(true);

            if (heroNameText != null)
            {
                heroNameText.text = HeroSystem.GetHeroName(heroData.id);
            }
            if (heroDescriptionText != null)
            {
                heroDescriptionText.text = HeroSystem.GetHeroDescription(heroData.id);
            }
            if (heroLevelText != null)
            {
                heroLevelText.text = string.Format("LV {0}", heroData.level);
            }
            if (heroExpText != null)
            {
                int   exp        = targetHeroData.exp;
                int   needExp    = Common.GetHeroNeedExp(targetHeroData.level);
                float expPercent = ((float)exp / (float)needExp);
                heroExpText.text    = string.Format("{0}/{1}({2}%)", exp, needExp, (expPercent * 100).ToString("N0"));
                heroExpSlider.value = expPercent;
            }

            if (CharactersManager.instance.GetLobbyHeros(targetHeroData.id))
            {
                heroSetLobbyButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("heroInfoExceptLobbyButton");
            }
            else
            {
                heroSetLobbyButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("heroInfoToLobbyButton");
            }

            RefreshHeroStatusEquipmentPanel();
        }
    }
Ejemplo n.º 33
0
 public void setValues(Sprite img, string name, int atk, int def, int hp, HeroData data)
 {
     image.sprite       = img;
     this.cardName.text = name;
     this.atk.text      = "Atk: " + atk.ToString();
     this.def.text      = "Def: " + def.ToString();
     this.hp.text       = "Health: " + hp.ToString();
     this.data          = data;
 }
Ejemplo n.º 34
0
    /// <summary> 영웅 교체 </summary>
    public void ChangeDeployHeroList(string LineID, List <string> deployHeroIDList)
    {
        if (LineID == placeID)
        {
            for (int i = 0; i < heroList.Count; i++)
            {
                heroList[i].onChangedValue -= OnChangedHeroData;
                heroList[i].placeID         = "";
            }
            // 초기화 후 새로 삽입
            heroList.Clear();

            for (int i = 0; i < deployHeroIDList.Count; i++)
            {
                HeroData hero = HeroManager.heroDataDic[deployHeroIDList[i]];
                hero.onChangedValue += OnChangedHeroData;
                hero.placeID         = LineID;
                heroList.Add(hero);
            }
            CalculateProductinAmount();
        }
        else
        {
            // 동일 ID 체크 후 제거
            for (int i = 0; i < deployHeroIDList.Count; i++)
            {
                HeroData hero = heroList.Find(x => x.id == deployHeroIDList[i]);
                if (hero != null)
                {
                    hero.onChangedValue -= OnChangedHeroData;
                    heroList.Remove(hero);
                }
            }
        }

        // 저장
        List <string> heroIDList = new List <string>();

        for (int i = 0; i < heroList.Count; i++)
        {
            heroIDList.Add(heroList[i].id);
        }

        //for (int i = 0; i < heroList.Count; i++)
        //{
        //    heroList[i].baseData.territorySkillDataList[0].
        //}

        string saveData = JsonMapper.ToJson(heroIDList);

        ObscuredPrefs.SetString(placeID + saveKey, saveData);

        if (onChangedHeroList != null)
        {
            onChangedHeroList();
        }
    }
Ejemplo n.º 35
0
    private void Start()
    {
        HeroData      = GameManager.Instance.GetHeroDataIns();
        UIManager     = GameManager.Instance.GetUIMgrIns();
        ScenesManager = GameManager.Instance.GetScenesMgrIns();

        Init();
        StartCoroutine(UpdateTime());
    }
Ejemplo n.º 36
0
        void SpawnHero(HeroData data_)
        {
            CreateParams param = new CreateParams {
                data     = data_,
                position = heroSpawnPoint.transform.position
            };

            GameObjectsBuilder.GameObjectsBuilder.Create(param);
        }
Ejemplo n.º 37
0
 private void Awake()
 {
     anim        = GetComponent <Animator>();
     triggerFlag = GetComponent <CircleCollider2D>();
     mydata      = SQLiteManager.Instance.team["FlagMan"];
     maxHP       = mydata.totalHP;
     currentHP   = mydata.totalHP;
     currentDEF  = mydata.totalDEF;
     currentRES  = mydata.totalRES;
 }
Ejemplo n.º 38
0
    protected override void DrawTitle(PlayerState state, HeroData config)
    {
        base.DrawTitle(state, config);

        Statuses[state.Id] = new StatusDesc
        {
            Position = state.Position + Vector3.up * 1.5f,
            Title    = $"{state.HeroName}",
        };
    }
    private void RefreshEnemyAide(int heroIndex, HeroData data)
    {
        if (heroIndex < otherHeros.Length && heroIndex >= 0)
        {
            otherHeros[heroIndex].Refresh(data);

            //Debug.Log("data t id is:" + data.guid + " hp " + data.getPercentByHP() + "  name " + data.name);

        }
    }
 /// <summary>
 /// 实例一个装备在上面
 /// </summary>
 /// <param name="data">可以是空</param>
 public virtual void Refresh(EquipmentItem data, HeroData hero = null)
 {
     heroData = hero;
     if (heroData != null)
     {
         if (sprHeroIcon) sprHeroIcon.spriteName = heroData.icon_middle;
     }
     Replace(data);
     //Debug.Log("Refresh this");
 }
Ejemplo n.º 41
0
 public void Init(HeroData heroData)
 {
     HeroLvText.text    = heroData.lv.ToString();
     HeroAtkText.text   = heroData.atk.ToString();
     HeroHpText.text    = heroData.hp.ToString();
     HeroManaText.text  = heroData.mana.ToString();
     HeroDefText.text   = heroData.def.ToString();
     HeroSpeedText.text = heroData.speed.ToString();
     HeroDesText.text   = heroData.des.ToString();
 }
Ejemplo n.º 42
0
    // 初始化
    public override void Init()
    {
        base.Init();

        if (heroData == null)
        {
            heroData = new HeroData();
            Save();
        }
    }
    public override void InitUI()
    {
        base.InitUI();

        for (int i = 0; i < GlobalDef.MAX_HERO; i++)
        {
            HeroData data = MonoInstancePool.getInstance<EnemyHeroManager>().getFightHeroByIdx(i);
            if (i == 0) curRivalData = data;
            RefreshEnemyAide(i, data);
        }
    }
Ejemplo n.º 44
0
 public void highlightHeroData(HeroData hd)
 {
     for(int n = 0;n < teamCellList.Count;n++){
         TeamMiniCell tc = teamCellList[n];
         if(tc.heroData == hd  && hd != null){
             tc.highLight(true);
         }else{
             tc.highLight(false);
         }
     }
 }
	public void addTempHero()
	{
        for (int i = 0; i < 10; i++)
        {
            HeroData hero = new HeroData();
			hero.level = 50;
			hero.equipmentList.addTempItem();
            hero.templateID = 100001 + i;
//			if( hero.templateID == 100002 )
//				hero.templateID = 100017;
            hero.guid = (long)1111111 + i;
            hero.parseData(hero.templateID);
			hero.property.country = i + 1 ;
			hero.activate = true;
            hero.battle = i;
            addHero(hero.guid, hero);
			hero.refreshProperty();
            fightHeroList.setFightHero(hero.battle, hero.guid);

//			float minAtk = hero.getMinAttack();
//			float maxAtk = hero.getMaxAttack();
//			float armor = hero.getArmor();
//			float hitLv = hero.getHitLv();
//			float dodLv = hero.getDodgelv();
//			float criticallv = hero.getCriticallv();
//			float criticalDamage = hero.getCriticalDamage();
//			float trueDamage = hero.getRealAttack();
//			float trueDamageReduce = hero.getReduceRealAttack();
//
//			float damageReduce = hero.getReduceDamage();
//			float hitRate = hero.getHitRate();
//			float dodRate = hero.getDodgeRate();
//			float criticalRate = hero.getCriticalRate();
//
////			float normalDamage =  
//
//			int a = 0;


            //Debug.Log(" ----------------------"+fightHeroList.getFightHeroDict().Count);
        }

//		for (int i = 0; i < 3; i++)
//		{
//			HeroData hero = new HeroData();
//			hero.templateID = 100001 + i;
//			hero.guid = (long)22222 + i;
//			hero.parseData(hero.templateID);
//			hero.property.country = i + 1 ;
//			addHero(hero.guid, hero);
//		}
		isDirty = true;
	}
Ejemplo n.º 46
0
 public override void OnIn(object data)
 {
     heroData = (HeroData)data;
     index = this.getDynamicCell().index;
     Debug.Log(index + " : " + heroData.nickName);
     Index.text = "" + index;
     if(isSelected){
         light.gameObject.SetActive(true);
     }else{
         light.gameObject.SetActive(false);
     }
 }
	public void refresh(HeroData data)
	{
		Icon.spriteName = data.icon_middle;
		showNormal ();
		int star = data.starLevel;
		setStarLv (star);
		Level.text = "Lv." + data.level;
//		Icon.spriteName = "";
//		if(FateNum != null)
//		{
//			FateNum = "1缘份";
//		}
	}
	public void refreshSkills(HeroData data)
	{
		if(data == null)
			return;
		for(int i = 0; i < data.skillList.count(); i++)
		{
			SkillItem skillItem = data.skillList.getSkillByIdx (i);
			if(skillItem != null)
			{
				Skills[i].refresh(skillItem);
			}
		}
	}
Ejemplo n.º 49
0
 public bool addHeroData(HeroData hd)
 {
     for(int n = 0;n < teamCellList.Count;n++){
         TeamMiniCell tc = teamCellList[n];
         if(tc.heroData == null){
             tc.SetHeroData(hd);
             hd.state = HeroData.State.SELECTED;
             updateTeamChangeCellView(hd);
             UserInfo.instance.saveAllheroes();
             return true;
         }
     }
     return false;
 }
    public override void Refresh(HeroData data)
    {
        base.Refresh(data);
        if (data != null)
        {
            //TODO:圆形图标
            //if (icon) icon.spriteName = data.icon;

            for (int i = 0; i < sprsEnery.Length; i++)
            {
                sprsEnery[i].gameObject.SetActive(i < data.getMaxEnergy());
            }
        }
    }
    void SetDatas(HeroManager manager, List<HeroDebugData> heroDatas)
    {
        HeroDebugData data;
        HeroData hero;
        for (int i = 0; i < heroDatas.Count; i++)
        {
            hero = new HeroData();
            data = heroDatas[i];

            //set max
            for (int j = 0; j < data.equipment.Count; j++)
            {
                EquipmentItem item = new EquipmentItem();
                Property.Equip e = new Property.Equip();

                if (data.equipment[j].equipId > 0 && data.equipment[j].equipLevel > 0)
                {
                    e.templateid = (uint)data.equipment[j].equipId;
                    item.parseData(e);

                    //Debug.Log(item.equitype);
                    //set level
                    item.equiplev = data.equipment[j].equipLevel;
                    hero.equipmentList.addItem(i * 10 + j, item);
                }
            }

            //set id level
            if (data.heroId > 0 && data.heroLevel > 0)
            {
                hero.templateID = data.heroId;
                hero.guid = (long)1111111 + i;
                hero.level = data.heroLevel;
                hero.property.country = i + 1;
                hero.activate = false;
                hero.battle = i;
                hero.starLevel = data.heroStar;

                hero.parseData(hero.templateID);

                hero.refreshProperty();
                manager.addHero(hero.guid, hero);
                Debug.Log("hero is init " + i + "   resname : " + hero.resname);
            }

            if (i < 3)
                manager.fightHeroList.setFightHero(hero.battle, hero.guid);
        }
    }
	public void refresh(HeroData data)
	{
		if(data == null)
			return;
		for(int i = 1; i < (int)GlobalDef.EquipmentTpye.E_MAX; i++)
		{
			EquipmentItem item = data.equipmentList.getItemByType(i); 
			if(item != null)
			{
				EquipList[i-1].refresh(item);
			}
			else
			{
				EquipList[i-1].setEmpty();
			}
		}
	}
	public void refreshInfo(HeroData data)
	{
		if (null == data)
			return;
		setTempDefaultVal (data.level, data.exp);

		Icon.spriteName = data.icon_middle;
		setStar (data.starLevel, data.activate);
		setCountry (data.property.country, data.name);
		setAtkIcon (data.heroType, data.activate);
		if(LevelNum != null) LevelNum.text = "Lv." + data.level;
		if(RealmLevel != null) RealmLevel.text = "+"+data.realmList.curRealmLevel;
		if(HelpIcon != null)HelpIcon.gameObject.SetActive(false);
		if(FightIcon != null)FightIcon.gameObject.SetActive(false);
		if(data.battle >= 0 && data.battle < 3)
		{
			if(FightIcon != null)
				FightIcon.gameObject.SetActive(true);
		}
		else if(data.battle >= 3)
		{
			if(HelpIcon != null)
				HelpIcon.gameObject.SetActive(true);
		}
		if (FightPowerLabel != null)
			FightPowerLabel.text = ""+data.calcFight ();
//
//		if(data.activate)
//		{
//			if(LvBar != null)
//				LvBar.gameObject.SetActive(true);
//			if(debirsBar != null)
//				debirsBar.gameObject.SetActive(false);
//			updateLvBar(data);
//		}
//		else 
//		{
			if(LvBar != null)
				LvBar.gameObject.SetActive(false);
			if(debirsBar != null)
				debirsBar.gameObject.SetActive(true);
			updateDebrids(data);
//		}

	}
Ejemplo n.º 54
0
    public static void calculate(HeroData heroData)
    {
        if (equipEftHandler == null)
        {
            initHashtable ();
        }

        heroData.resetEft ();
        GlobalModifier.reset ();

        List<Effect> equipEftAry = heroData.getEquipEft ();

        foreach(Effect eft in equipEftAry)
        {
            FunHandler func = equipEftHandler [eft.eName] as FunHandler;

            if(func == null)
            {
                continue;
            }
            func (eft,
                heroData.itemAdd,
                heroData.itemMult);
        }

        List<Effect> skEftAry = heroData.getSkEft ();

        foreach(Effect eft in skEftAry)
        {

        //			Debug.Log(eftD.eName);
        //			Debug.Log ("eftD.eName=" + eft.eName);
        //			Debug.Log (Utils.dumpHashTable (equipEftHandler));

            FunHandler func = equipEftHandler [eft.eName.ToUpper()] as FunHandler;
            if(func == null)
            {
                continue;
            }
            func (eft,
                heroData.skillAdd,
                heroData.skillMult);
        }
    }
Ejemplo n.º 55
0
 public void init(Hero hero,int _index4TextADD)
 {
     this.hero = hero;
     if(hero == null){
         groupTraining.SetActive(false);
         groupNotTraining.SetActive(false);
         groupAdd.SetActive(true);
         gameObject.name = string.Format("HeroStateDialog_{0}{1}", "ADD", _index4TextADD);
     }else{
         hd = hero.data as HeroData;
         gameObject.name = string.Format("HeroStateDialog_{0}", hero.name);
         expLvLabel.text = "Level " + hd.lv;
         expBar.initBar(hd.exp);
         groupTraining.SetActive(false);
         groupNotTraining.SetActive(false);
         groupAdd.SetActive(false);
     }
     //_index4TextADD = (++_index4TextADD > 3)? 0: _index4TextADD;
 }
    /// <summary>
    /// 切换英雄
    /// </summary>
    /// <param name="ch">需要切换的英雄</param>
    public void SwitchChar(HeroData data)
    {
        curUIHero.Refresh(data);
        //Debug.Log(" SetSkills =======================" + data.templateID);
        //curUIHero.SetSkills(skillDir[data.templateID]);
        ChangeCharSkills(data.templateID);

        //切换副将
        for (int i = 1; i < uiHeros.Length; i++)
        {
            if (uiHeros[i].IsHero(data))
            {
                uiHeros[i].Refresh(curHero);
                Debug.Log("Switch --------------");
            }
        }
        //-----------------------

        //ChangeCharSkills(data.templateID);
        curHero = data;
    }
	public void refresh(HeroData data)
	{
		if(data == null)
			return;
		Property [0].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_LIFEPOINT);
		float min = data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_MINATTACK);
		float max = data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_MAXATTACK);
		Property [1].text = "" + (int)min + "-" + max;
		Property [2].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_ARMOR);
		Property [3].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_MANAPOINT);
		Property [4].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_MOVEPOWER);
		Property [5].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_CRITICALLV);
		Property [6].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_DODGELV);
		Property [7].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_HITLV);
		Property [8].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_ATKSPD);
		Property [9].text = "" + (int)data.getHitRate();
		Property [10].text = "" + (int)data.getCriticalRate();
		Property [11].text = "" + (int)data.getDodgeRate();
		Property [12].text = "" + (int)data.getCriticalDamage();
		Property [13].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_TRUEDAMAGE);
		Property [14].text = "" + (int)data.getResPro ((int)GlobalDef.NewHeroProperty.PRO_TRUEDGRESIST);
	}
    public void SwitchRivalChar(HeroData data)
    {
        //Debug.Log("-------------swithc Rival hero guid is " + data.guid);
        //HeroData tempData = curRivalData;
        //if (tempData == null)
        //{
        //    Debug.Log("F**k ---------------------");
        //}
        otherHeros[0].Refresh(data);

        //切换副将
        for (int i = 1; i < otherHeros.Length; i++)
        {
            if (otherHeros[i].IsHero(data))
            {
                otherHeros[i].Refresh(curRivalData);
                //Debug.Log("-------------swithc cur Rival hero guid is " + curRivalData.guid);
            }
        }
        //-----------------------
        curRivalData = data;
    }
Ejemplo n.º 59
0
	public bool AddWeaponToHero( HeroData hero )
	{
		m_weapon = m_rightHand.gameObject.AddComponent<Cha_Weapon>();	
		m_weapon.dummy_spine = m_back;
		m_weapon.sub_hand = m_leftHand;

		EquipmentItem wp = hero.equipmentList.getItemByType((int)GlobalDef.EquipmentTpye.E_WEAPON);
		if (null == wp) {
			Debug.LogError("weapon is error name=>" + wp.resname );
			return false;
		}
		int weaponType = hero.heroType;
		string weaponName = wp.resname;
		m_weapon.Init (weaponName, weaponType);

		if(GetComponentInParent<Unit>().m_unitType == GlobalDef.UnitType.UNIT_TYPE_ENEMY_HERO)
		{
			int a;
			a = 0;
		}
		return true;
	}
    public virtual void Refresh(HeroData data)
    {
        if (data != null)
        {
            //Debug.Log("init hero ava" + data.templateID);
            hero = data;

            bool isDead = data.getCurPro((int)GlobalDef.NewHeroProperty.PRO_LIFEPOINT) == 0;
            //TODO:
            if (icon)
            {
                icon.spriteName = data.icon_middle;
                if (isDead)
                {
                    //set gray
                    icon.color = new Color(0, 0, 0);
                }
                else
                {
                    icon.color = new Color(255, 255, 255);
                }
            }
            //Debug.Log(data.icon_middle);

            if (sprDead)
                if (!isDead)
                {
                    sprDead.enabled = false;
                }
                else SetDead();

            SetHP();
            SetLevel(data.level);
            SetOther(data);
        }
        else RefreshNull();

    }