Example #1
0
    private void PlayFailContentTween()
    {
        DCopy db = ReadCfgCopy.GetDataById(LevelData.CopyID);

        if (db == null)
        {
            return;
        }
        for (int i = 0; i < mPassContents.Length; i++)
        {
            ItemPassContent tab  = mPassContents[i];
            EStarCondition  type = db.StarConditions[i];
            int             v    = db.StarValues[i];
            switch (type)
            {
            case EStarCondition.TYPE_MAIN_HEALTH:
                tab.text.text = GTTools.Format("主角血量大于{0}%", v);
                break;

            case EStarCondition.TYPE_PASSCOPY:
                tab.text.text = "通关副本";
                break;

            case EStarCondition.TYPE_TIME_LIMIT:
                tab.text.text = GTTools.Format("{0}秒通关副本", v);
                break;
            }
            tab.trans.gameObject.SetActive(true);
        }
    }
Example #2
0
    private void OnInitItem(Transform trans, int index)
    {
        int        id = index + 1;
        DAdventure db = ReadCfgAdventure.GetDataById(id);

        trans.Find("Name").GetComponent <UILabel>().text        = db.Name;
        trans.Find("Icon").GetComponent <UISprite>().spriteName = db.Icon;
        if (db.Times <= 0)
        {
            trans.Find("Times").GetComponent <UILabel>().text = string.Empty;
        }
        else
        {
            string localString = GTItemHelper.GetText("次数:{0}/{1}");
            trans.Find("Times").GetComponent <UILabel>().text = GTTools.Format(localString, db.Times, db.Times);
        }
        UIEventListener.Get(trans.gameObject).onClick = delegate(GameObject go)
        {
            GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK);
            if (mCurAdventureIndex == index)
            {
                return;
            }
            this.mCurAdventureIndex = index;
            ShowSelect(mCurAdventureIndex);
        };
        ShowSelect(index);
    }
Example #3
0
 public void ChangeEquip()
 {
     //DBItem itemDB = ZTConfig.Instance.GetDBItem(pEquipID);
     //string[] modelPaths = { itemDB.Model_R, itemDB.Model_L };
     //EquipAvatar pModel = GetEquipModelsByPos(pDressPos);
     //for (int i = 0; i < 2; i++)
     {
         string path = "Model/Weapon/120004";//modelPaths[i];
         string bone = Define.EQUIP_BONES[7, 0];
         //if (string.IsNullOrEmpty(path)) { continue; }
         Transform boneTrans = GTTools.GetBone(CacheTransform, bone);
         if (boneTrans == null)
         {
             return;
         }
         //pModel.Models[i] = ZTResource.Instance.Load<GameObject>(path, true);
         GameObject eObj = ZTResource.Instance.Load <GameObject>(path, true);
         if (eObj != null)
         {
             GameObject model = eObj;
             model.transform.parent = boneTrans;
             NGUITools.SetLayer(eObj, Obj.layer);
             model.transform.localPosition    = Vector3.zero;
             model.transform.localEulerAngles = Vector3.zero;
             model.transform.localScale       = Vector3.one;
         }
     }
 }
Example #4
0
 public virtual void SaveDoc(XmlDocument doc, XmlElement element)
 {
     FieldInfo[] fields = this.GetType().GetFields();
     for (int i = 0; i < fields.Length; i++)
     {
         FieldInfo field = fields[i];
         Type      t     = field.FieldType;
         if (t.BaseType == typeof(Enum))
         {
             element.SetAttribute(field.Name, ((int)field.GetValue(this)).ToString());
         }
         else if (t == typeof(int))
         {
             element.SetAttribute(field.Name, field.GetValue(this).ToString());
         }
         else if (t == typeof(bool))
         {
             element.SetAttribute(field.Name, field.GetValue(this).ToString());
         }
         else if (t == typeof(float))
         {
             element.SetAttribute(field.Name, field.GetValue(this).ToString());
         }
         else if (t == typeof(string))
         {
             element.SetAttribute(field.Name, field.GetValue(this).ToString());
         }
         else if (t == typeof(Vector3))
         {
             Vector3 vector3 = (Vector3)field.GetValue(this);
             element.SetAttribute(field.Name, GTTools.SaveVector3(vector3));
         }
     }
 }
Example #5
0
    public void ShowInfoByPos(EPosType posType, int pos)
    {
        this.mPos     = pos;
        this.mPosType = posType;
        bool isDress = (posType == EPosType.RoleGem);

        ShowDress(isDress);
        XGem gem    = GTDataManager.Instance.GetGemDataByPos(posType, pos);
        int  itemID = gem.Id;
        DGem gemDB  = ReadCfgGem.GetDataById(itemID);

        gemLevel.text      = GTTools.Format("等级 {0}", gem.StrengthenLevel);
        gemFightValue.text = GTTools.Format("战斗力 {0}", AttrHelper.GetFightValue(gem));
        ShowBaseView(itemID);
        GTItemHelper.ShowGemPropertyText(gemPropertys, itemID, gem.StrengthenLevel);
        DGemSuit suitDB        = ReadCfgGemSuit.GetDataById(gemDB.Suit);
        int      activeSuitNum = isDress ? GemModule.Instance.GetActiveSameSuitsCountByPos(pos) : 0;
        bool     hasSuit       = ReadCfgGemSuit.ContainsKey(gemDB.Suit);

        if (hasSuit)
        {
            ShowHasSuit(gemDB);
            ShowSuitPropertysView(activeSuitNum, suitDB);
            ShowSameSuitGemsView(gemDB.Id);
        }
        else
        {
            ShowNoSuit();
        }
    }
Example #6
0
    static void ReplaceDiffuse()
    {
        Shader           newShader = Shader.Find("MyMobile/Diffuse");
        List <Transform> list      = new List <Transform>();

        GTTools.FindAllChildren(Selection.activeGameObject.transform, list);
        for (int i = 0; i < list.Count; i++)
        {
            GameObject   go       = list[i].gameObject;
            MeshRenderer renderer = go.GetComponent <MeshRenderer>();
            if (renderer == null)
            {
                continue;
            }
            Material[] materials = renderer.sharedMaterials;
            for (int k = 0; k < materials.Length; k++)
            {
                Material mat = materials[k];
                if (mat.shader.name == "MyMobile/Diffuse_old" || mat.shader == null)
                {
                    mat.shader = newShader;
                }
            }
        }
    }
Example #7
0
    private void Fight()
    {
        float dist = GTTools.GetHorizontalDistance(Owner.Pos, Owner.GetTarget().Pos);

        if (dist > AI.ATKDIST)
        {
            AI.ChangeAIState(EAIState.AI_CHASE);
            return;
        }
        if (Owner.FSM == FSMState.FSM_SKILL)
        {
            return;
        }
        Owner.SendStateMessage(FSMState.FSM_Attack);
        Timerr += Time.deltaTime;
        if (Timerr >= SkillCD)
        {
            GameObject   Bullet       = ZTPool.Instance.GetGo("Model/Weapons/bullet");
            BulletScript bulletScript = Bullet.GET <BulletScript>();
            AudioClip    clip         = LoadResource.Instance.Load <AudioClip>("Sounds/AK47A");
            ZTAudio.Instance.PlaySound(clip);
            bulletScript.damage      = Owner.GetAttr(EAttr.Atk);
            bulletScript.AttackActor = this.Owner;
            if (Owner.mActorPart.AttackTransform != null)
            {
                Bullet.transform.position    = Owner.mActorPart.AttackTransform.position;
                Bullet.transform.eulerAngles = Owner.mActorPart.AttackTransform.eulerAngles;
            }
            Timerr = 0;
        }
    }
Example #8
0
    public override void Execute()
    {
        Actor pTarget = Owner.GetTarget();

        switch (Owner.ActorType)
        {
        case EActorType.MONSTER:
        {
            if (pTarget != null)
            {
                //float dist = GTTools.GetHorizontalDistance(Owner.Pos, pTarget.Pos);
                if (Owner.AiConeDetection.IsEnter)
                {
                    AI.ChangeAIState(EAIState.AI_CHASE);
                }
            }
            Patrol();
        }
        break;

        case EActorType.PLAYER:
        {
            if (pTarget != null)
            {
                float dist = GTTools.GetHorizontalDistance(Owner.Pos, pTarget.Pos);
                if (dist < AI.WARDIST)
                {
                    AI.ChangeAIState(EAIState.AI_CHASE);
                }
            }
            Patrol();
        }
        break;
        }
    }
Example #9
0
    public static void ShowEquipStrengthText(UILabel label, int equipID, int strengthLevel)
    {
        if (label == null)
        {
            return;
        }
        DEquipStreng strengthDB = ReadCfgEquipStreng.GetDataById(equipID);

        label.text = string.Empty;
        for (int i = 0; i < strengthDB.Propertys.Count; i++)
        {
            DStrengthValue data = strengthDB.Propertys[i];
            if (data.Value <= 0 || data.Property == 0)
            {
                continue;
            }
            DProperty propertyDB = ReadCfgProperty.GetDataById(data.Property);
            string    desc       = GTTools.Format(propertyDB.Desc, data.Value);
            string    v          = string.Empty;
            if (data.UnlockLevel <= strengthLevel)
            {
                v = GTTools.Format("[00ff00]{0}[-]", desc);
            }
            else
            {
                v = GTTools.Format("[777777]{0} (强化至{1}级生效)[-]", desc, data.UnlockLevel);
            }
            label.Append(v);
        }
    }
Example #10
0
    public static void ShowEquipAdvanceText(UILabel label, int equipID, int advanceLevel)
    {
        if (label == null)
        {
            return;
        }
        DEquipAdvance advanceDB = ReadCfgEquipAdvance.GetDataById(equipID);

        label.text = string.Empty;
        for (int i = 0; i < advanceDB.Propertys.Count; i++)
        {
            KeyValuePair <EAttr, int> data = advanceDB.Propertys[i];
            if (data.Value <= 0 || data.Key == 0)
            {
                continue;
            }
            DProperty propertyDB = ReadCfgProperty.GetDataById(data.Key);
            string    desc       = GTTools.Format(propertyDB.Desc, data.Value);
            string    v          = string.Empty;
            if (advanceLevel >= (i + 1))
            {
                v = GTTools.Format("[00ff00]{0}[-]", desc);
            }
            else
            {
                v = GTTools.Format("[777777]{0} (进阶至{1}级生效)[-]", desc, i + 1);
            }
            label.Append(v);
        }
    }
Example #11
0
    public void ShowViewByPos(EPosType posType, int pos)
    {
        this.mPos     = pos;
        this.mPosType = posType;
        ShowDress(posType == EPosType.RoleEquip);
        XEquip equip = GTDataManager.Instance.GetEquipDataByPos(mPosType, mPos);

        if (equip == null)
        {
            return;
        }
        int itemID = equip.Id;

        ShowBaseView(itemID);
        equipFightValue.text   = GTTools.Format("战斗力 {0}", GTAttrHelper.GetFightValue(equip));
        equipAdvanceLevel.text = MLEquip.Instance.GetEquipAdvanceNameByLevel(equip.AdvanceLevel);
        Dictionary <EAttr, int> propertys = GTAttrHelper.GetPropertys(equip);

        title3.text = GTTools.Format("装备星级 {0}", equip.StarLevel);
        title2.text = GTTools.Format("进阶等级 {0}", equip.AdvanceLevel);
        title1.text = GTTools.Format("强化等级 {0}", equip.StrengthenLevel);
        GTItemHelper.ShowPropertyText(this.equipPropertys, propertys, true);
        GTItemHelper.ShowEquipStrengthText(text1, itemID, equip.StrengthenLevel);
        GTItemHelper.ShowEquipAdvanceText(text2, itemID, equip.AdvanceLevel);
        GTItemHelper.ShowEquipStarText(text3, itemID, equip.StarLevel);
    }
Example #12
0
        public override void Execute()
        {
            base.Execute();
            Transform bindBoneSt = GTTools.GetBone(CacheTransform, "Bone001");
            Transform bindBoneEd = GTTools.GetBone(CacheTransform, "Bone002");

            if (SrcCharacter != null)
            {
                Transform bindBone = SrcCharacter.Avatar.GetBindTransform(mLightObj.CasterBind);
                bindBoneSt.position = bindBone != null ? bindBone.position : (SrcCharacter.Pos + Vector3.up * 1);
            }
            if (DstCharacter != null)
            {
                Transform bindBone = DstCharacter.Avatar.GetBindTransform(mLightObj.TargetBind);
                bindBoneEd.position = bindBone != null ? bindBone.position : (DstCharacter.Pos + Vector3.up * 1);
            }
            else
            {
                bindBoneEd.position = SrcCharacter.Pos + SrcCharacter.Dir * mLightObj.MaxDis;
            }
            if (mHitCallback != null)
            {
                mHitCallback.Invoke(this);
                mHitCallback = null;
            }
        }
Example #13
0
    private void OnUpdateBranchTask()
    {
        string format  = GTItemHelper.GetText("[00ffff]【支线】[-]{0}");
        string content = GTItemHelper.GetText("没有发现新任务");

        mTaskContentType2.text = GTTools.Format(format, content);
    }
Example #14
0
    private void ShowBagNum()
    {
        int maxNum = GTDataManager.Instance.GetBagNum();
        int curNum = GTDataManager.Instance.GetBagDataByBagType(mShow).Count;

        labBagNum.text = GTTools.Format("{0}/{1}", curNum, maxNum);
    }
Example #15
0
    private void ShowCurrRelicsView1()
    {
        DRelics db     = ReadCfgRelics.GetDataById(centerID);
        XRelics relics = DataDBSRelics.GetDataById(centerID);

        relicsName.text = (relics == null) ? db.Name : GTTools.Format("{0}  +{1}", db.Name, relics.Level);
        relicsDesc.text = db.Desc.ToString();
    }
Example #16
0
    public static void ShowExpTip(int exp)
    {
        GTWindowManager.Instance.OpenWindow(EWindowID.UIMessageTip);
        UIMessageTip dialog = (UIMessageTip)GTWindowManager.Instance.GetWindow(EWindowID.UIMessageTip);
        string       format = GetText("经验+{0}");

        dialog.ShowExp(GTTools.Format(format, exp));
    }
Example #17
0
 public static int Copy(object destination, object source)
 {
     if (destination == null || source == null)
     {
         return(0);
     }
     return(GTTools.Copy(destination, source, source.GetType()));
 }
Example #18
0
 public void EnterWorld(MapConfig data)
 {
     for (int i = 0; i < data.MapNpcs.Count; i++)
     {
         MapNpc cfg = data.MapNpcs[i];
         DActor db  = ReadCfgActor.GetDataById(cfg.NpcID);
         if (db == null)
         {
             continue;
         }
         XCharacter c = new XCharacter();
         c.Id   = cfg.NpcID;
         c.Name = db.Name;
         c.GUID = GTGUID.NewGUID();
         c.PosX = cfg.Pos.x;
         c.PosY = cfg.Pos.y;
         c.PosZ = cfg.Pos.z;
         c.Face = cfg.Face;
         c.Type = (int)EActorType.NPC;
         c.Camp = (int)EBattleCamp.CT_PVE_NEUTRAL;
         c.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr)));
         foreach (var current in db.Attrs)
         {
             c.CurAttrs[(int)current.Key - 1] = current.Value;
         }
         m_AllActors.Add(c.GUID, c);
     }
     for (int i = 0; i < data.MapAreaMonsters.Count; i++)
     {
         MapAreaMonster cfg = data.MapAreaMonsters[i];
         DActor         db  = ReadCfgActor.GetDataById(cfg.MonsterID);
         if (db == null)
         {
             continue;
         }
         for (int k = 0; k < cfg.Points.Count; k++)
         {
             MapPoint   p = cfg.Points[k];
             XCharacter c = new XCharacter();
             c.Id   = cfg.MonsterID;
             c.Name = db.Name;
             c.GUID = GTGUID.NewGUID();
             c.PosX = p.Pos.x;
             c.PosY = p.Pos.y;
             c.PosZ = p.Pos.z;
             c.Face = p.EulerAngles.y;
             c.Type = (int)EActorType.MONSTER;
             c.Camp = (int)EBattleCamp.CT_PVE_ENEMY;
             c.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr)));
             foreach (var current in db.Attrs)
             {
                 c.CurAttrs[(int)current.Key - 1] = current.Value;
             }
             m_AllActors.Add(c.GUID, c);
         }
     }
 }
Example #19
0
    private void ShowAdvanceView()
    {
        XEquip equip = GTDataManager.Instance.GetEquipDataByPos(mPosType, mPos);

        if (equip == null)
        {
            return;
        }
        int itemID = equip.Id;

        if (EquipModule.Instance.IsFullStarLevel(equip))
        {
            return;
        }
        GTItemHelper.ShowItemTexture(mEquipAdvance.nowEquipTexture, itemID);
        GTItemHelper.ShowItemQuality(mEquipAdvance.nowEquipQuality, itemID);
        GTItemHelper.ShowItemName(mEquipAdvance.nowEquipName, itemID);

        GTItemHelper.ShowItemTexture(mEquipAdvance.nexEquipTexture, itemID);
        GTItemHelper.ShowItemQuality(mEquipAdvance.nexEquipQuality, itemID);
        GTItemHelper.ShowItemName(mEquipAdvance.nexEquipName, itemID);

        Dictionary <EAttr, int> nowPropertys = AttrHelper.GetPropertys(equip);
        XEquip nexEquip = new XEquip();

        GTTools.Copy(nexEquip, equip);
        nexEquip.AdvanceLevel++;
        Dictionary <EAttr, int> nexPropertys = AttrHelper.GetPropertys(nexEquip);

        GTItemHelper.ShowPropertyText(mEquipAdvance.nowEquipPropertys, nowPropertys, false);
        GTItemHelper.ShowPropertyText(mEquipAdvance.nexEquipPropertys, nexPropertys, false);
        mEquipAdvance.nowEquipFightValue.text = AttrHelper.GetFightValue(nowPropertys).ToString();
        mEquipAdvance.nexEquipFightValue.text = AttrHelper.GetFightValue(nexPropertys).ToString();

        DEquip            equipDB = ReadCfgEquip.GetDataById(itemID);
        DEquipAdvanceCost db      = ReadCfgEquipAdvanceCost.GetDataById(equipDB.Quality * 1000 + equip.AdvanceLevel + 1);
        int hasItemNum            = GTDataManager.Instance.GetItemCountById(db.CostItemId);

        GTItemHelper.ShowItemTexture(mEquipAdvance.costItemTexture, db.CostItemId);
        GTItemHelper.ShowPriceText(mEquipAdvance.costItemNum, hasItemNum, db.CostItemNum);
        GTItemHelper.ShowItemQuality(mEquipAdvance.costItemQuality, itemID);
        if (db.CostEquipNum > 0)
        {
            mEquipAdvance.costEquipBtn.SetActive(true);
            GTItemHelper.ShowItemTexture(mEquipAdvance.costEquipTexture, itemID);
            GTItemHelper.ShowItemQuality(mEquipAdvance.costEquipQuality, itemID);
            int hasSameEquipNum = EquipModule.Instance.GetBagSameEquipList(equip).Count;
            GTItemHelper.ShowPriceText(mEquipAdvance.costEquipNum, hasSameEquipNum, db.CostEquipNum);
        }
        else
        {
            mEquipAdvance.costEquipBtn.SetActive(false);
        }
        GTItemHelper.ShowItemTexture(mEquipAdvance.costMoneyTexture, db.CostMoneyId);
        GTItemHelper.ShowItemNum(mEquipAdvance.costMoneyNum, db.CostMoneyNum);
        GTItemHelper.ShowEquipAdvanceText(mEquipAdvance.advanceText, itemID, equip.AdvanceLevel);
    }
Example #20
0
    private void OnUpdateAvatarHealth()
    {
        Character player = CharacterManager.Main;
        int       maxHP  = player.CurrAttr.MaxHP;
        int       curHP  = player.CurrAttr.HP;

        mBar1.value     = curHP / (maxHP * 1f);
        mBarValue1.text = GTTools.Format("{0}/{1}", curHP, maxHP);
    }
Example #21
0
    private void OnUpdateAvatarPower()
    {
        Character player = CharacterManager.Main;
        int       maxMP  = player.CurrAttr.MaxMP;
        int       curMP  = player.CurrAttr.MP;

        mBar2.value     = curMP / (maxMP * 1f);
        mBarValue2.text = GTTools.Format("{0}/{1}", curMP, maxMP);
    }
Example #22
0
        public MoverFixPosition(ActMissile obj, Character target, HitCallbackFly onTriggerEnter) :
            base(obj, target, onTriggerEnter)
        {
            this.m_HAngle       = obj.MoveHAngle;
            this.m_VAngle       = obj.MoveVAngle;
            this.m_DestPosition = target != null?target.Avatar.GetBindPosition(EBind.Body) : CacheTransform.position + CacheTransform.forward * 10;

            this.m_DistanceToTarget = GTTools.GetHorizontalDistance(CacheTransform.position, m_DestPosition);
        }
Example #23
0
        protected override void ReadAttribute(string key, string value)
        {
            //if (this.Data.Id == 61009)
            {
                Debug.LogError(key + "=======" + value);
            }
            switch (key)
            {
            case "Id":
                this.Data.Id = value.ToInt32();
                break;

            case "LastTime":
                this.Data.LastTime = value.ToFloat();
                break;

            case "Bind":
                this.Data.Bind = (EEffectBind)value.ToInt32();
                break;

            case "Fly":
                this.Data.Fly = (EFlyType)value.ToInt32();
                break;

            case "SetParent":
                this.Data.SetParent = value.ToInt32() == 1;
                break;

            case "Dead":
                this.Data.Dead = (EFlyObjDeadType)value.ToInt32();
                break;

            case "Offset":
                this.Data.Offset = GTTools.ToVector3(value, true);
                break;

            case "Euler":
                this.Data.Euler = GTTools.ToVector3(value, true);
                break;

            case "Sound":
                this.Data.Sound = value;
                break;

            case "FlySpeed":
                this.Data.FlySpeed = value.ToFloat();
                break;

            case "Delay":
                this.Data.Delay = value.ToFloat();
                break;

            case "JudgeName":
                this.JudgeName = value;
                break;
            }
        }
Example #24
0
 public static void ShowProgressText(UILabel lab, int now, int max)
 {
     if (lab == null)
     {
         return;
     }
     lab.gameObject.SetActive(true);
     lab.text = GTTools.Format("{0}/{1}", now, max);
 }
Example #25
0
 //获取手掌列表
 public Transform[] GetHands()
 {
     if (mHands == null && CacheTransform != null)
     {
         mHands    = new Transform[2];
         mHands[0] = GTTools.GetBone(CacheTransform, "Bip01 L Hand");
         mHands[1] = GTTools.GetBone(CacheTransform, "Bip01 R Hand");
     }
     return(mHands);
 }
Example #26
0
    public static Vector3 GetVector3(this XmlElement element, string name)
    {
        string s = element.GetAttribute(name);

        if (string.IsNullOrEmpty(s))
        {
            return(Vector3.zero);
        }
        return(GTTools.ToVector3(s, true));
    }
Example #27
0
    public static void ShowQualityText(UILabel lab, string text, int quality)
    {
        if (string.IsNullOrEmpty(text) || lab == null)
        {
            return;
        }
        string encode = ReadCfgQuality.GetDataById(quality).Encode;

        lab.text = GTTools.Format("[{0}]{1}[-]", encode, text);
    }
Example #28
0
 public void LoadSystemInfo()
 {
     mLastLoginTime = long.Parse(PlayerPrefs.GetString("LastLoginTime", GTTools.GetUtcTime().ToString()));
     mGameStartTime = GTTools.GetUtcTime();
     ActionStart();
     if (mGameStartTime - mLastLoginTime >= 21600)
     {
         DataDailyTask.ClearAll();
     }
 }
Example #29
0
    public void EnterWorld(int mapID)
    {
        this.MapID = mapID;
        this.Init();
        string fsPath = GTTools.Format("Text/Map/{0}", MapID);

        Config = new Cfg.Map.MapConfig();
        Config.Load(fsPath);
        this.OnSceneStart();
    }
Example #30
0
    private string ShowStar(int star)
    {
        string s = string.Empty;

        for (int i = 0; i < star; i++)
        {
            s = GTTools.Format("{0}{1}", s, "★");
        }
        return(s);
    }