Ejemplo n.º 1
0
    public void EquipOn(int id)
    {
        if (id <= 0)
        {
            return;
        }
        zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao = DataReader <zZhuangBeiPeiZhiBiao> .Get(id);

        if (zZhuangBeiPeiZhiBiao == null)
        {
            Debug.LogError("zZhuangBeiPeiZhiBiao no find, equipId = " + id);
            return;
        }
        if (zZhuangBeiPeiZhiBiao.model <= 0)
        {
            return;
        }
        EquipBody equipBody = DataReader <EquipBody> .Get(zZhuangBeiPeiZhiBiao.model);

        if (equipBody == null)
        {
            return;
        }
        this.DoEquipOn(id, equipBody);
    }
Ejemplo n.º 2
0
 private void DoEquipOn(int newEquipId, EquipBody dataEB)
 {
     if (dataEB.putOnMethod == 1)
     {
         if (this.ActorTarget == null)
         {
             this.mWeaponId      = 0;
             this.mCacheWeaponId = newEquipId;
             return;
         }
         this.mWeaponId      = newEquipId;
         this.mCacheWeaponId = 0;
         this.DoEquipWeapons(newEquipId, dataEB, delegate(bool isSuccess)
         {
             if (isSuccess)
             {
                 EventDispatcher.Broadcast("EquipCustomization.ACTSELF_CHANGE_WEAPON");
                 this.EquipSuccess(newEquipId);
                 this.CheckShowEquipFX(newEquipId);
             }
         });
     }
     else if (dataEB.putOnMethod == 2)
     {
         if (this.ActorTarget == null)
         {
             this.mClothesId      = 0;
             this.mCacheClothesId = newEquipId;
             return;
         }
         this.mClothesId      = newEquipId;
         this.mCacheClothesId = 0;
         this.DoEquipClothes(newEquipId, dataEB, delegate(bool isSuccess)
         {
             if (isSuccess)
             {
                 this.EquipSuccess(0);
             }
         });
     }
     else
     {
         Debug.LogError(string.Concat(new object[]
         {
             "GameData.EquipBody id = ",
             dataEB.id,
             ", putOnMethod is illegal = ",
             dataEB.putOnMethod
         }));
     }
 }
Ejemplo n.º 3
0
    public EquipSet(String cls)
    {
        set = new Equip[5];

        head      = new EquipHead();      //EquipManager.GetEquip(NormalHead + cls);
        body      = new EquipBody();      //EquipManager.GetEquip(NormalBody) + cls;
        foot      = new EquipFoot();      //EquipManager.GetEquip(NormalFoot + cls);
        weapon    = new EquipWeapon();    //EquipManager.GetEquip(NormalWeapon + cls);
        subWeapon = new EquipSubWeapon(); //EquipManager.GetEquip(NormalSubWeapon + cls);

        set[0] = head;
        set[1] = body;
        set[2] = foot;
        set[3] = weapon;
        set[4] = subWeapon;
    }
Ejemplo n.º 4
0
 private void InstantiateEquipWeapon(int equipId, EquipBody dataEB, Action <GameObject, GameObject> loaded)
 {
     if (string.IsNullOrEmpty(dataEB.prefabPath))
     {
         if (loaded != null)
         {
             loaded.Invoke(null, null);
         }
         return;
     }
     this.LoadAsset(equipId, dataEB.prefabPath, EquipCustomization.EquipType.Equip, delegate(bool isSuccess)
     {
         if (!isSuccess)
         {
             if (loaded != null)
             {
                 loaded.Invoke(null, null);
             }
             return;
         }
         if (string.IsNullOrEmpty(dataEB.prefabPath2))
         {
             if (loaded != null)
             {
                 loaded.Invoke(EquipCustomizationTool.GetInstantiate(dataEB.prefabPath), null);
             }
             return;
         }
         this.LoadAsset(equipId, dataEB.prefabPath2, EquipCustomization.EquipType.Equip, delegate(bool isSuccess2)
         {
             if (!isSuccess2)
             {
                 if (loaded != null)
                 {
                     loaded.Invoke(EquipCustomizationTool.GetInstantiate(dataEB.prefabPath), null);
                 }
                 return;
             }
             if (loaded != null)
             {
                 loaded.Invoke(EquipCustomizationTool.GetInstantiate(dataEB.prefabPath), EquipCustomizationTool.GetInstantiate(dataEB.prefabPath2));
             }
         });
     });
 }
Ejemplo n.º 5
0
 private void DoEquipClothes(int equipId, EquipBody dataEB, Action <bool> finished)
 {
     EquipCustomizationTool.GetInstantiateClothes(dataEB, delegate(SkinnedMeshRenderer renderer)
     {
         if (this.ActorTarget == null)
         {
             finished.Invoke(false);
             return;
         }
         if (equipId != this.mClothesId)
         {
             finished.Invoke(false);
             return;
         }
         Transform transform = XUtility.RecursiveFindTransform(this.ActorTarget.get_transform(), dataEB.slot);
         if (transform == null)
         {
             Debug.LogError("slot is no find, GameData.EquipBody id = " + dataEB.id);
             finished.Invoke(false);
             return;
         }
         SkinnedMeshRenderer component = transform.GetComponent <SkinnedMeshRenderer>();
         if (renderer != null)
         {
             component.set_sharedMesh(renderer.get_sharedMesh());
             List <Transform> list = new List <Transform>();
             for (int i = 0; i < renderer.get_bones().Length; i++)
             {
                 Transform transform2 = XUtility.RecursiveFindTransform(this.ActorTarget.get_transform(), renderer.get_bones()[i].get_name());
                 list.Add(transform2);
             }
             component.set_bones(list.ToArray());
             component.set_shadowCastingMode(0);
             component.set_receiveShadows(false);
             component.set_useLightProbes(false);
             component.set_material(renderer.get_sharedMaterial());
         }
         if (finished != null)
         {
             finished.Invoke(true);
         }
     });
 }
Ejemplo n.º 6
0
 private void DoEquipWeapons(int equipId, EquipBody dataEB, Action <bool> finished)
 {
     this.InstantiateEquipWeapon(equipId, dataEB, delegate(GameObject weapon1, GameObject weapon2)
     {
         if (this.ActorTarget == null)
         {
             this.ClearWeaponTemp(weapon1, weapon2);
             finished.Invoke(false);
             return;
         }
         if (!this.VerifyWeapon(equipId))
         {
             this.ClearWeaponTemp(weapon1, weapon2);
             finished.Invoke(false);
             return;
         }
         if (weapon1 == null)
         {
             this.ClearWeaponTemp(weapon1, weapon2);
             finished.Invoke(false);
             return;
         }
         this.ClearWeapons();
         if (weapon1 != null)
         {
             EquipCustomizationTool.SetLayer(weapon1, this.ActorTarget);
             ShadowController.SetShadowModelRender2Child(this.ActorTarget.get_transform(), weapon1.get_transform(), false);
             this.m_goWeapons.Add(weapon1);
             this.SetWeapon2Slot(this.GetWeaponSlotRealName(dataEB.slot), true);
         }
         if (weapon2 != null)
         {
             EquipCustomizationTool.SetLayer(weapon2, this.ActorTarget);
             ShadowController.SetShadowModelRender2Child(this.ActorTarget.get_transform(), weapon2.get_transform(), false);
             this.m_goWeapons.Add(weapon2);
             this.SetWeapon2Slot(this.GetWeaponSlotRealName(dataEB.slot), true);
         }
         if (finished != null)
         {
             finished.Invoke(weapon1 != null);
         }
     });
 }
Ejemplo n.º 7
0
    public static void AnalysisEquipList(List <int> equipList, out bool isContainWeapon, out int weaponID, out bool isContainClothes, out int clothesID)
    {
        isContainWeapon  = false;
        isContainClothes = false;
        weaponID         = 0;
        clothesID        = 0;
        if (equipList == null)
        {
            return;
        }
        if (equipList.get_Count() == 0)
        {
            return;
        }
        for (int i = 0; i < equipList.get_Count(); i++)
        {
            if (DataReader <zZhuangBeiPeiZhiBiao> .Contains(equipList.get_Item(i)))
            {
                zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao = DataReader <zZhuangBeiPeiZhiBiao> .Get(equipList.get_Item(i));

                if (DataReader <EquipBody> .Contains(zZhuangBeiPeiZhiBiao.model))
                {
                    EquipBody equipBody = DataReader <EquipBody> .Get(zZhuangBeiPeiZhiBiao.model);

                    int putOnMethod = equipBody.putOnMethod;
                    if (putOnMethod != 1)
                    {
                        if (putOnMethod == 2)
                        {
                            isContainClothes = true;
                            clothesID        = equipList.get_Item(i);
                        }
                    }
                    else
                    {
                        isContainWeapon = true;
                        weaponID        = equipList.get_Item(i);
                    }
                }
            }
        }
    }
Ejemplo n.º 8
0
    private string GetWeaponSlot(int equipId)
    {
        zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao = DataReader <zZhuangBeiPeiZhiBiao> .Get(equipId);

        if (zZhuangBeiPeiZhiBiao == null)
        {
            Debug.LogError("zZhuangBeiPeiZhiBiao no find, equipId = " + equipId);
            return(string.Empty);
        }
        if (zZhuangBeiPeiZhiBiao.model <= 0)
        {
            return(string.Empty);
        }
        EquipBody equipBody = DataReader <EquipBody> .Get(zZhuangBeiPeiZhiBiao.model);

        if (equipBody == null)
        {
            return(string.Empty);
        }
        return(equipBody.slot);
    }
Ejemplo n.º 9
0
 public static void GetInstantiateClothes(EquipBody dataEB, Action <SkinnedMeshRenderer> loaded)
 {
     if (string.IsNullOrEmpty(dataEB.mesh))
     {
         if (loaded != null)
         {
             loaded.Invoke(null);
         }
         return;
     }
     AssetManager.LoadEquipCustomizationAsset(dataEB.mesh.Replace("\\", "/"), delegate(Object meshAsset)
     {
         if (meshAsset == null)
         {
             if (loaded != null)
             {
                 loaded.Invoke(null);
             }
             return;
         }
         GameObject gameObject = meshAsset as GameObject;
         if (gameObject != null)
         {
             Transform transform = XUtility.RecursiveFindTransform(gameObject.get_transform(), dataEB.slot);
             if (transform != null)
             {
                 SkinnedMeshRenderer component = transform.GetComponent <SkinnedMeshRenderer>();
                 if (loaded != null)
                 {
                     loaded.Invoke(component);
                 }
                 return;
             }
         }
         if (loaded != null)
         {
             loaded.Invoke(null);
         }
     });
 }