Пример #1
0
    void InsertPlayerResult(int instance, int id, int killed, int dead, EUnitCamp camp)
    {
        GameObject obj = GameObject.Instantiate(Resources.Load <GameObject>("ResultItem"));

        if (CombatData.Ins.GGameMode == GameMode.MENGZHU)
        {
            obj.transform.SetParent(BattleResult.transform);
        }
        else
        {
            obj.transform.SetParent(camp == EUnitCamp.EUC_FRIEND ? MeteorResult : ButterflyResult);
        }
        obj.layer = MeteorResult.gameObject.layer;
        obj.transform.localRotation = Quaternion.identity;
        obj.transform.localScale    = Vector3.one;
        obj.transform.localPosition = Vector3.zero;

        Text Idx  = Control("Idx", obj).GetComponent <Text>();
        Text Name = Control("Name", obj).GetComponent <Text>();

        if (CombatData.Ins.GGameMode == GameMode.MENGZHU)
        {
        }
        else
        {
            Text Camp = Control("Camp", obj).GetComponent <Text>();
            Camp.text = U3D.GetCampStr(camp);
        }

        Text Killed = Control("Killed", obj).GetComponent <Text>();
        Text Dead   = Control("Dead", obj).GetComponent <Text>();

        Idx.text = (id + 1).ToString();
        MeteorUnit unit = U3D.GetUnit(instance);

        Name.text = unit == null ? "[无名氏]":unit.name;

        Killed.text = killed.ToString();
        Dead.text   = dead.ToString();
        MeteorUnit u = U3D.GetUnit(id);

        if (u != null)
        {
            if (u.Dead)
            {
                Idx.color    = Color.red;
                Name.color   = Color.red;
                Killed.color = Color.red;
                Dead.color   = Color.red;
            }
        }
        else
        {
            //得不到信息了。说明该NPC被移除掉了
            Idx.color    = Color.red;
            Name.color   = Color.red;
            Killed.color = Color.red;
            Dead.color   = Color.red;
        }
    }
Пример #2
0
 public void Init(MonsterEx attr, Transform attach, EUnitCamp camp)
 {
     owner = attach.GetComponent <MeteorUnit>();
     Info  = GetComponentInChildren <UnitDebugInfo>(true);
     Info.SetOwner(owner);
     //Transform mainCanvas = GameObject.Find("Canvas").transform;
     //transform.SetParent(mainCanvas);
     transform.localScale    = Vector3.one;
     transform.localRotation = Quaternion.identity;
     transform.localPosition = Vector3.zero;
     transform.SetAsLastSibling();
     //rect.anchoredPosition3D = new Vector3(0, 40.0f, 0);
     //transform.localScale = Vector3.one * 0.1f;//0.07-0.03 0.07是主角与敌人距离最近时,0.03是摄像机与敌人最近时,摄像机与敌人最近时,要看得到敌人,必须距离 44左右
     MonsterName.text = attr == null ? "" : attr.Name;
     if (camp == EUnitCamp.EUC_ENEMY)
     {
         MonsterName.color = Color.red;
     }
     else if (camp == EUnitCamp.EUC_NONE)
     {
         MonsterName.color = Color.white;
     }
     target = attach;
     if (owner == Main.Ins.LocalPlayer)
     {
         MonsterName.gameObject.SetActive(false);
     }
 }
Пример #3
0
    //0-19内的材质是3个,20-27的是单个
    public Material[] Material(int roleIdx, EUnitCamp camp)
    {
        Material[] ret        = new Material[materials.Length];
        string     strTexture = "";
        string     strIndex   = "";

        //if (camp == EUnitCamp.EUC_KILLALL)
        //    strIndex = "01";
        //if (camp == EUnitCamp.EUC_FRIEND)
        strIndex = "01";    //非联机模式,只有1皮肤
        //else
        //strIndex = "01";
        //else if (camp == EUnitCamp.EUC_ENEMY)
        //    strIndex = "03";

        for (int i = 0; i < materials.Length; i++)
        {
            //if (materials[i].TwoSide)
            //    ret[i] = new Material(Shader.Find("Shader Forge/DoubleSideTexture"));
            //else
            ret[i] = new Material(ShaderUtil.Find("AlphaTexture"));
            //根据阵营决定贴图序号
            if (roleIdx > 19)
            {
                ret[i].SetTexture("_MainTex", Resources.Load <Texture>(materials[i].Texture));
            }
            else
            {
                string[] str = materials[i].Texture.Split('b');
                if (str.Length == 2)
                {
                    strTexture = str[0] + "b" + strIndex;
                }
                else
                {
                    strTexture = materials[i].Texture;
                }
                ret[i].SetTexture("_MainTex", Resources.Load <Texture>(strTexture));
            }
            ret[i].SetColor("_Color", materials[i].Diffuse);
        }
        return(ret);
    }
Пример #4
0
    void InsertPlayerResult(string name_, int id, int killed, int dead, EUnitCamp camp)
    {
        GameObject obj = GameObject.Instantiate(Resources.Load <GameObject>("ResultItem"));;

        obj.transform.SetParent(camp == EUnitCamp.EUC_FRIEND ? MeteorResult : ButterflyResult);
        obj.layer = MeteorResult.gameObject.layer;
        obj.transform.localRotation = Quaternion.identity;
        obj.transform.localScale    = Vector3.one;
        obj.transform.localPosition = Vector3.zero;

        Text Idx  = ldaControl("Idx", obj).GetComponent <Text>();
        Text Name = ldaControl("Name", obj).GetComponent <Text>();
        //Text Camp = ldaControl("Camp", obj).GetComponent<Text>();
        Text Killed = ldaControl("Killed", obj).GetComponent <Text>();
        Text Dead   = ldaControl("Dead", obj).GetComponent <Text>();

        Idx.text  = (id + 1).ToString();
        Name.text = name_;
        //Camp.text = result.camp == 1 ""
        Killed.text = killed.ToString();
        Dead.text   = dead.ToString();
        MeteorUnit u = U3D.GetUnit(id);

        if (u != null)
        {
            if (u.Dead)
            {
                Idx.color    = Color.red;
                Name.color   = Color.red;
                Killed.color = Color.red;
                Dead.color   = Color.red;
            }
        }
        else
        {
            //得不到信息了。说明该NPC被移除掉了
            Idx.color    = Color.red;
            Name.color   = Color.red;
            Killed.color = Color.red;
            Dead.color   = Color.red;
        }
    }
Пример #5
0
 //0-19内的材质是3个,20-27的是单个
 public Material[] Material(int roleIdx, EUnitCamp camp)
 {
     if (roleIdx >= CombatData.Ins.MaxModel)
     {
         Material[] ret = new Material[materials.Length];
         for (int i = 0; i < materials.Length; i++)
         {
             ret[i] = new Material(ShaderMng.Find("AlphaTexture"));
             ret[i].SetTexture("_MainTex", SkcFile.GetTexrtureFromPlugin(roleIdx, materials[i].Texture));
         }
         return(ret);
     }
     else
     {
         if (GamePool.Instance != null && GamePool.Instance.SkcMng != null)
         {
             return(GamePool.Instance.SkcMng.GetPlayerMat(roleIdx, camp));
         }
         return(null);
     }
 }
Пример #6
0
 void SpawnRobot(int idx, EUnitCamp camp)
 {
     U3D.SpawnRobot(idx, camp, weaponIdx, hpArray[hpIdx]);
 }
Пример #7
0
    //在关卡模式下,不分阵营.
    public Material[] GetPlayerMat(int id, EUnitCamp camp)
    {
        SkcMatItem[] TargetGroup = null;
        if (GameStateMgr.Ins.gameStatus.Quality == 0)
        {
            TargetGroup = Player;
        }
        else if (GameStateMgr.Ins.gameStatus.Quality == 1)
        {
            TargetGroup = Player800;
        }
        else if (GameStateMgr.Ins.gameStatus.Quality == 2)
        {
            TargetGroup = Player300;
        }

        //普通关卡和盟主模式,只有1个阵营的皮肤
        if (CombatData.Ins.GLevelMode <= LevelMode.SinglePlayerTask)
        {
            if (camp == EUnitCamp.EUC_NONE || camp == EUnitCamp.EUC_KILLALL)
            {
                Material[] mat = new Material[TargetGroup[id].PlayerCamp0.Length];
                for (int i = 0; i < TargetGroup[id].PlayerCamp0.Length; i++)
                {
                    mat[i] = TargetGroup[id].PlayerCamp0[i] as Material;
                }
                return(mat);
            }
            else if (camp == EUnitCamp.EUC_FRIEND)
            {
                Material[] mat = new Material[TargetGroup[id].PlayerCamp0.Length];
                for (int i = 0; i < TargetGroup[id].PlayerCamp0.Length; i++)
                {
                    mat[i] = TargetGroup[id].PlayerCamp0[i] as Material;
                }
                return(mat);
            }
            else if (camp == EUnitCamp.EUC_ENEMY)
            {
                Material[] mat = new Material[TargetGroup[id].PlayerCamp0.Length];
                for (int i = 0; i < TargetGroup[id].PlayerCamp0.Length; i++)
                {
                    mat[i] = TargetGroup[id].PlayerCamp0[i] as Material;
                }
                return(mat);
            }
        }
        else if (CombatData.Ins.GLevelMode > LevelMode.SinglePlayerTask && CombatData.Ins.GLevelMode <= LevelMode.MultiplyPlayer)
        {
            if (CombatData.Ins.GGameMode == GameMode.Normal || CombatData.Ins.GGameMode == GameMode.MENGZHU)
            {
                if (camp == EUnitCamp.EUC_NONE || camp == EUnitCamp.EUC_KILLALL)
                {
                    Material[] mat = new Material[TargetGroup[id].PlayerCamp0.Length];
                    for (int i = 0; i < TargetGroup[id].PlayerCamp0.Length; i++)
                    {
                        mat[i] = TargetGroup[id].PlayerCamp0[i] as Material;
                    }
                    return(mat);
                }
                else if (camp == EUnitCamp.EUC_FRIEND)
                {
                    Material[] mat = new Material[TargetGroup[id].PlayerCamp0.Length];
                    for (int i = 0; i < TargetGroup[id].PlayerCamp0.Length; i++)
                    {
                        mat[i] = TargetGroup[id].PlayerCamp0[i] as Material;
                    }
                    return(mat);
                }
                else if (camp == EUnitCamp.EUC_ENEMY)
                {
                    Material[] mat = new Material[TargetGroup[id].PlayerCamp0.Length];
                    for (int i = 0; i < TargetGroup[id].PlayerCamp0.Length; i++)
                    {
                        mat[i] = TargetGroup[id].PlayerCamp0[i] as Material;
                    }
                    return(mat);
                }
            }
            else if (CombatData.Ins.GGameMode == GameMode.ANSHA || CombatData.Ins.GGameMode == GameMode.SIDOU)
            {
                if (camp == EUnitCamp.EUC_NONE || camp == EUnitCamp.EUC_KILLALL)
                {
                    Material[] mat = new Material[TargetGroup[id].PlayerCamp2.Length];
                    for (int i = 0; i < TargetGroup[id].PlayerCamp2.Length; i++)
                    {
                        mat[i] = TargetGroup[id].PlayerCamp2[i] as Material;
                    }
                    return(mat);
                }
                else if (camp == EUnitCamp.EUC_FRIEND)
                {
                    Material[] mat = new Material[TargetGroup[id].PlayerCamp0.Length];
                    for (int i = 0; i < TargetGroup[id].PlayerCamp0.Length; i++)
                    {
                        mat[i] = TargetGroup[id].PlayerCamp0[i] as Material;
                    }
                    return(mat);
                }
                else if (camp == EUnitCamp.EUC_ENEMY)
                {
                    Material[] mat = new Material[TargetGroup[id].PlayerCamp1.Length];
                    for (int i = 0; i < TargetGroup[id].PlayerCamp1.Length; i++)
                    {
                        mat[i] = TargetGroup[id].PlayerCamp1[i] as Material;
                    }
                    return(mat);
                }
            }
        }
        return(null);
    }
Пример #8
0
 public void PlayerMoveNotify(Transform target, EUnitCamp camp, bool isMainPlayer)
 {
     //在小地图这个地点绘制一个 圆点,如果是主角,绘制一个尖三角.
 }
Пример #9
0
    //0-19内的材质是3个,20-27的是单个
    public Material[] Material(int roleIdx, EUnitCamp camp)
    {
        if (roleIdx >= Main.Ins.CombatData.MaxModel)
        {
            Material[] ret = new Material[materials.Length];
            for (int i = 0; i < materials.Length; i++)
            {
                ret[i] = new Material(ShaderMng.Find("AlphaTexture"));
                ret[i].SetTexture("_MainTex", SkcFile.GetTexrtureFromPlugin(roleIdx, materials[i].Texture));
                ret[i].SetColor("_Color", materials[i].Diffuse);
            }
            return(ret);
        }
        else
        {
            if (GamePool.Instance != null && GamePool.Instance.SkcMng != null)
            {
                return(GamePool.Instance.SkcMng.GetPlayerMat(roleIdx, camp));
            }
            //使用预先设置好的材质球,降低DC和Batch
            Material[] ret        = new Material[materials.Length];
            string     strTexture = "";
            string     strIndex   = "";
            //if (camp == EUnitCamp.EUC_KILLALL)
            //    strIndex = "01";
            //if (camp == EUnitCamp.EUC_FRIEND)
            strIndex = "01"; //非联机模式,只有1皮肤
                             //else
                             //strIndex = "01";
                             //else if (camp == EUnitCamp.EUC_ENEMY)
                             //    strIndex = "03";

            for (int i = 0; i < materials.Length; i++)
            {
                //if (materials[i].TwoSide)
                //    ret[i] = new Material(Shader.Find("Shader Forge/DoubleSideTexture"));
                //else
                ret[i] = new Material(ShaderMng.Find("AlphaTexture"));
                //根据阵营决定贴图序号
                if (roleIdx > 19)
                {
                    ret[i].SetTexture("_MainTex", Resources.Load <Texture>(materials[i].Texture));
                }
                else
                {
                    string[] str = materials[i].Texture.Split('b');
                    if (str.Length == 2)
                    {
                        strTexture = str[0] + "b" + strIndex;
                    }
                    else
                    {
                        strTexture = materials[i].Texture;
                    }
                    ret[i].SetTexture("_MainTex", Resources.Load <Texture>(strTexture));
                }
                ret[i].SetColor("_Color", materials[i].Diffuse);
            }
            return(ret);
        }
    }