コード例 #1
0
 //设定操作的物品对象
 public void SetSlotItem(BackpackData data)
 {
     //背包index 和 slot数组的需要不同 index 从1开始 slot从0开始
     slotId    = GetIndex(data.index);
     equipSlot = data.itemData.equipPosition;
     oldEquip  = GetEquipData(equipSlot);
 }
コード例 #2
0
        /// <summary>
        /// 穿上装备
        /// </summary>
        /// <param name="result">Result.</param>
        void UseEquipNetworkResp(GCUserDressEquip result)
        {
            Log.Net("UseEquipNetworkResp " + result);
            if (oldEquip != null)
            {
                PopEquipData(equipSlot);
            }
            var ed = new EquipData(result.DressEquip);

            EquipmentData.Add(ed);

            if (result.HasPackEquip)
            {
                var newBagItem = new BackpackData(result.PackEquip);
                PutItemInBackpackIndex(newBagItem);
            }
            MyEventSystem.PushEventStatic(MyEvent.EventType.UpdateItemCoffer);

            //更新角色属性面板的装备信息
            //以及角色本身的装备信息
            var evt = new MyEvent(MyEvent.EventType.CharEquipChanged);

            evt.localID   = ObjectManager.objectManager.GetMyLocalId();
            evt.equipData = ed;
            evt.boolArg   = true;
            MyEventSystem.myEventSystem.PushEvent(evt);

            //通知角色属性面板 更新UI上面的icon
            evt = new MyEvent(MyEvent.EventType.RefreshEquip);
            MyEventSystem.myEventSystem.PushEvent(evt);
        }
コード例 #3
0
        /*
         * Network Init EquipmentData
         */
        IEnumerator InitEquipData()
        {
            Debug.Log("BackPack::InitEquipData  ");
            UserEquipClear();

            var packet = new KBEngine.PacketHolder();

            CGLoadPackInfo.Builder equip = CGLoadPackInfo.CreateBuilder();
            equip.PackType = PackType.DRESSED_PACK;
            var data = equip.BuildPartial();

            KBEngine.Bundle bundle = new KBEngine.Bundle();
            bundle.newMessage(data.GetType());
            uint fid = bundle.writePB(data);

            yield return(StartCoroutine(bundle.sendCoroutine(KBEngine.KBEngineApp.app.networkInterface(), fid, packet)));

            if (packet.packet.responseFlag == 0)
            {
                var ret = packet.packet.protoBody as GCLoadPackInfo;
                foreach (PackInfo pkinfo in ret.PackInfoList)
                {
                    var eqData = new EquipData(pkinfo);
                    UseEquip(eqData);
                }
            }
            else
            {
            }
        }
コード例 #4
0
ファイル: DetailInfo.cs プロジェクト: Xnovae/MobaClient
 public void SetEquip(EquipData ed)
 {
     equipData = ed;
     if (equipData != null)
     {
         InitButton();
     }
 }
コード例 #5
0
ファイル: NpcEquipment.cs プロジェクト: Xnovae/MobaClient
        void SetArmor(EquipData ed, out GameObject g)
        {
            UnwieldEquip(ed.itemData.equipPosition);

            var fullSet = Resources.Load <GameObject>(ed.itemData.ModelName);

            SetDefaultEquip(fullSet, ed.itemData.equipPosition, out g);
        }
コード例 #6
0
ファイル: NpcEquipment.cs プロジェクト: Xnovae/MobaClient
        //更新UI角色对象的装备
        void FakeWieldEquip(EquipData ed)
        {
            var fake = ObjectManager.objectManager.GetFakeObj(photonView.GetLocalId());

            if (fake != null)
            {
                fake.GetComponent <NpcEquipment>().WieldEquip(ed);
            }
        }
コード例 #7
0
 public void LevelUpEquip(EquipData eqData, List <BackpackData> gems)
 {
     /*
      * var lev = CGLevelUpEquip.CreateBuilder();
      * lev.EquipId = eqData.id;
      * foreach(var g in gems){
      *  lev.AddGemId(g.id);
      * }
      * KBEngine.Bundle.sendImmediate(lev);
      */
 }
コード例 #8
0
        //初始化角色装备
        //只有玩家初始化结束之后 采取 初始化玩家的装备
        void UseEquip(EquipData ed)
        {
            Log.Important("initial role equip");
            EquipmentData.Add(ed);

            //角色本身的装备信息
            var evt = new MyEvent(MyEvent.EventType.CharEquipChanged);

            evt.localID   = ObjectManager.objectManager.GetMyLocalId();
            evt.equipData = ed;
            evt.boolArg   = true;
            MyEventSystem.myEventSystem.PushEvent(evt);

            //通知角色属性面板 更新UI上面的icon
            evt = new MyEvent(MyEvent.EventType.RefreshEquip);
            MyEventSystem.myEventSystem.PushEvent(evt);
        }
コード例 #9
0
        public static void DressEquip(AvatarInfo info)
        {
            var dressInfo = info.DressInfoList;
            var player    = ObjectManager.objectManager.GetPlayer(info.Id);

            if (player != null)
            {
                var localId = player.GetComponent <KBEngine.KBNetworkView>().GetLocalId();
                foreach (PackInfo pkinfo in dressInfo)
                {
                    var ed  = new EquipData(pkinfo);
                    var evt = new MyEvent(MyEvent.EventType.CharEquipChanged);
                    evt.localID   = localId;
                    evt.equipData = ed;
                    evt.boolArg   = true;
                    MyEventSystem.myEventSystem.PushEvent(evt);
                }
            }
        }
コード例 #10
0
ファイル: NpcEquipment.cs プロジェクト: Xnovae/MobaClient
        void UnwieldEquip(EquipData ed)
        {
            if (ed != null || ed.itemData != null)
            {
                return;
            }

            if (!IsFakeObject)
            {
                var fake = ObjectManager.objectManager.GetFakeObj(photonView.GetLocalId());
                if (fake != null)
                {
                    fake.GetComponent <NpcEquipment>().UnwieldEquip(ed);
                }
            }

            UnwieldEquip(ed.itemData.equipPosition);
            SetFakeObjLayer();
        }
コード例 #11
0
ファイル: LevelUpEquip.cs プロジェクト: Xnovae/MobaClient
 public void SetEquip(EquipData ed)
 {
     equip = ed;
     left.SetEquip(ed);
 }
コード例 #12
0
ファイル: LevelUpEquipLeft.cs プロジェクト: Xnovae/MobaClient
 public void SetEquip(EquipData equip)
 {
     equipData = equip;
     UpdateFrame();
 }
コード例 #13
0
ファイル: NpcEquipment.cs プロジェクト: Xnovae/MobaClient
        void UnwieldEquip(ItemData.EquipPosition pos)
        {
            if (pos == ItemData.EquipPosition.WEAPON)
            {
                if (Weapon != null)
                {
                    GameObject.Destroy(Weapon);
                    WeaponData = null;
                    if (Scabbard != null)
                    {
                        GameObject.Destroy(Scabbard);
                        Scabbard = null;
                    }
                }
            }
            else
            {
                switch (pos)
                {
                case ItemData.EquipPosition.HEAD:
                    if (Head != null)
                    {
                        defaultHead.SetActive(true);
                        GameObject.Destroy(Head);
                    }
                    headData = null;
                    break;

                case ItemData.EquipPosition.BODY:
                    if (Chest != null)
                    {
                        defaultChest.SetActive(true);
                        GameObject.Destroy(Chest);
                    }
                    ChestData = null;
                    break;

                case ItemData.EquipPosition.GLOVES:
                    if (Gloves != null)
                    {
                        defaultGloves.SetActive(true);
                        GameObject.Destroy(Gloves);
                    }
                    GlovesData = null;
                    break;

                case ItemData.EquipPosition.SHOES:
                    if (Shoes != null)
                    {
                        defaultBoots.SetActive(true);
                        GameObject.Destroy(Shoes);
                    }
                    ShoesData = null;
                    break;

                case ItemData.EquipPosition.TROUSERS:
                    if (Trousers != null)
                    {
                        defaultTrousers.SetActive(true);
                        GameObject.Destroy(Trousers);
                    }
                    TrousersData = null;
                    break;

                //项链戒指
                default:
                    Debug.LogError("UnwieldEquip NotExist " + pos);
                    break;
                }
            }
        }
コード例 #14
0
ファイル: NpcEquipment.cs プロジェクト: Xnovae/MobaClient
 //角色装备变更 同时修正FakeObject的装备,FakeObject是背包UI界面上3d模型
 void WieldEquip(EquipData ed)
 {
     /*
      * if (ed == null || ed.itemData == null)
      * {
      *  return;
      * }
      * Log.Sys("Wield Equip is " + ed.itemData.ItemName);
      *
      * if (!IsFakeObject)
      * {
      *  FakeWieldEquip(ed);
      * }
      * var defeq = attribute.ObjUnitData.GetDefaultWardrobe();
      * if(string.IsNullOrEmpty(defeq)){
      *  return;
      * }
      *
      * partToData [ed.itemData.equipPosition] = ed;
      * switch (ed.itemData.equipPosition)
      * {
      *
      *  case ItemData.EquipPosition.WEAPON:
      *      if (Weapon != null)
      *      {
      *          UnwieldEquip(ItemData.EquipPosition.WEAPON);
      *      }
      *
      *      WeaponData = ed;
      *  //是否有刀鞘
      *      if (WeaponData.itemData.HasScabbard)
      *      {
      *          var fullWeapon = Resources.Load<GameObject>(WeaponData.itemData.ModelName);
      *          Log.Sys("NpcEquipment::WieldEquip " + fullWeapon);
      *          Weapon = Instantiate(Util.FindChildRecursive(fullWeapon.transform, "weapon1").gameObject) as GameObject;
      *          Scabbard = Instantiate(Util.FindChildRecursive(fullWeapon.transform, "weapon2").gameObject) as GameObject;
      *          var Point3 = Util.FindChildRecursive(fullWeapon.transform, "Point3");
      *
      *          if (back != null)
      *          {
      *              Scabbard.transform.parent = back;
      *              Scabbard.transform.localPosition = Vector3.zero;
      *              Scabbard.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
      *              foreach (Transform c in Scabbard.transform)
      *              {
      *                  if (c.renderer != null)
      *                  {
      *                      GetComponent<ShadowComponent>().SetShadowPlane(c.gameObject);
      *                  }
      *              }
      *          }
      *
      *          //PeaceMode Level
      *          if (WorldManager.worldManager.IsPeaceLevel())
      *          {
      *              Weapon.transform.parent = back;
      *              var mat = Matrix4x4.TRS(Point3.localPosition, Point3.localRotation, Point3.localScale);
      *              var inv = mat.inverse;
      *              Weapon.transform.localPosition = inv.GetColumn(3);
      *              Weapon.transform.localRotation = Quaternion.LookRotation(inv.GetColumn(2), inv.GetColumn(1));
      *              Weapon.transform.localScale = Vector3.one;
      *
      *              foreach (Transform c in Weapon.transform)
      *              {
      *                  if (c.renderer != null)
      *                  {
      *                      GetComponent<ShadowComponent>().SetShadowPlane(c.gameObject);
      *                  }
      *              }
      *
      *          } else
      *          {
      *              //UI上对象 武器在手中
      *              if (rightHand != null)
      *              {
      *                  Weapon.transform.parent = rightHand;
      *                  Weapon.transform.localPosition = Vector3.zero;
      *                  Weapon.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
      *                  foreach (Transform c in Weapon.transform)
      *                  {
      *                      if (c.renderer != null)
      *                      {
      *                          GetComponent<ShadowComponent>().SetShadowPlane(c.gameObject);
      *                      }
      *                  }
      *              }
      *
      *          }
      *
      *      } else
      *      {
      *          Weapon = Instantiate(Resources.Load<GameObject>(WeaponData.itemData.ModelName)) as GameObject;
      *          Log.Sys("NpcEquipment::WieldEquip No Scab  " + Weapon);
      *          if (WorldManager.worldManager.IsPeaceLevel())
      *          {
      *              if (back != null)
      *              {
      *                  var Point3 = Util.FindChildRecursive(Weapon.transform, "Point3");
      *                  Log.Sys("Wield Weapon in Back " + Point3);
      *                  var mat = Matrix4x4.TRS(Point3.localPosition, Point3.localRotation, Point3.localScale);
      *                  var inv = mat.inverse;
      *
      *                  Weapon.transform.parent = back;
      *                  Weapon.transform.localPosition = inv.GetColumn(3);
      *                  Weapon.transform.localRotation = Quaternion.LookRotation(inv.GetColumn(2), inv.GetColumn(1));
      *                  Weapon.transform.localScale = Vector3.one;
      *
      *                  Log.Sys("Set Weapon Transform " + inv.GetColumn(3));
      *                  if (Weapon.renderer != null)
      *                  {
      *                      GetComponent<ShadowComponent>().SetShadowPlane(Weapon);
      *                  }
      *
      *                  foreach (Transform c in Weapon.transform)
      *                  {
      *                      if (c.renderer != null)
      *                      {
      *                          GetComponent<ShadowComponent>().SetShadowPlane(c.gameObject);
      *                      }
      *                  }
      *              } else
      *              {
      *                  Debug.Log("NpcEquipment:: Not Find Back For equip ");
      *              }
      *          } else
      *          {
      *              Log.Sys("Wield Weapon On RightHand");
      *              if (rightHand != null)
      *              {
      *                  Weapon.transform.parent = rightHand;
      *                  Weapon.transform.localPosition = Vector3.zero;
      *                  Weapon.transform.localRotation = Quaternion.identity;
      *                  Weapon.transform.localScale = Vector3.one;
      *                  //3dsmax
      *                  if (Weapon.renderer != null)
      *                  {
      *                      GetComponent<ShadowComponent>().SetShadowPlane(Weapon);
      *                  }
      *
      *                  foreach (Transform c in Weapon.transform)
      *                  {
      *                      if (c.renderer != null)
      *                      {
      *                          GetComponent<ShadowComponent>().SetShadowPlane(c.gameObject);
      *                      }
      *                  }
      *              } else
      *              {
      *                  Debug.LogError("NpcEquipment:: Not Found RightHand");
      *              }
      *          }
      *      }
      *
      *      break;
      *
      *
      *  case ItemData.EquipPosition.BODY:
      *      SetArmor(ed, out Chest);
      *      ChestData = ed;
      *      defaultChest.SetActive(false);
      *      break;
      *  case ItemData.EquipPosition.GLOVES:
      *      SetArmor(ed, out Gloves);
      *      GlovesData = ed;
      *      defaultGloves.SetActive(false);
      *      break;
      *
      *  case ItemData.EquipPosition.SHOES:
      *      SetArmor(ed, out Shoes);
      *      ShoesData = ed;
      *      defaultBoots.SetActive(false);
      *      break;
      *  case ItemData.EquipPosition.HEAD:
      *      Log.Trivial(Log.Category.System, "Wear Head");
      *
      *      SetArmor(ed, out Head);
      *      headData = ed;
      *      defaultHead.SetActive(false);
      *      break;
      *  case ItemData.EquipPosition.TROUSERS:
      *      SetArmor(ed, out Trousers);
      *      TrousersData = ed;
      *      defaultTrousers.SetActive(false);
      *      break;
      *
      *  default:
      *      Debug.LogError("WieldEquip Not Exists " + ed.itemData.equipPosition);
      *      break;
      * }
      *
      * SetFakeObjLayer();
      */
 }
コード例 #15
0
        //角色装备变更 同时修正FakeObject的装备,FakeObject是背包UI界面上3d模型
        void WieldEquip(EquipData ed)
        {
            if (ed == null || ed.itemData == null)
            {
                return;
            }
            Log.Sys("Wield Equip is " + ed.itemData.ItemName);

            if (!IsFakeObject)
            {
                FakeWieldEquip(ed);
            }
            var defeq = attribute.ObjUnitData.GetDefaultWardrobe();

            if (string.IsNullOrEmpty(defeq))
            {
                return;
            }

            partToData [ed.itemData.equipPosition] = ed;
            switch (ed.itemData.equipPosition)
            {
            case ItemData.EquipPosition.WEAPON:
                if (Weapon != null)
                {
                    UnwieldEquip(ItemData.EquipPosition.WEAPON);
                }

                WeaponData = ed;
                //是否有刀鞘
                if (WeaponData.itemData.HasScabbard)
                {
                    var fullWeapon = Resources.Load <GameObject>(WeaponData.itemData.ModelName);
                    Log.Sys("NpcEquipment::WieldEquip " + fullWeapon);
                    Weapon   = Instantiate(Util.FindChildRecursive(fullWeapon.transform, "weapon1").gameObject) as GameObject;
                    Scabbard = Instantiate(Util.FindChildRecursive(fullWeapon.transform, "weapon2").gameObject) as GameObject;
                    var Point3 = Util.FindChildRecursive(fullWeapon.transform, "Point3");

                    if (back != null)
                    {
                        Scabbard.transform.parent        = back;
                        Scabbard.transform.localPosition = Vector3.zero;
                        Scabbard.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                        foreach (Transform c in Scabbard.transform)
                        {
                            if (c.GetComponent <Renderer>() != null)
                            {
                                GetComponent <ShadowComponent>().SetShadowPlane(c.gameObject);
                            }
                        }
                    }

                    //PeaceMode Level
                    if (WorldManager.worldManager.IsPeaceLevel())
                    {
                        Weapon.transform.parent = back;
                        var mat = Matrix4x4.TRS(Point3.localPosition, Point3.localRotation, Point3.localScale);
                        var inv = mat.inverse;
                        Weapon.transform.localPosition = inv.GetColumn(3);
                        Weapon.transform.localRotation = Quaternion.LookRotation(inv.GetColumn(2), inv.GetColumn(1));
                        Weapon.transform.localScale    = Vector3.one;

                        foreach (Transform c in Weapon.transform)
                        {
                            if (c.GetComponent <Renderer>() != null)
                            {
                                GetComponent <ShadowComponent>().SetShadowPlane(c.gameObject);
                            }
                        }
                    }
                    else
                    {
                        //UI上对象 武器在手中
                        if (rightHand != null)
                        {
                            Weapon.transform.parent        = rightHand;
                            Weapon.transform.localPosition = Vector3.zero;
                            Weapon.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
                            foreach (Transform c in Weapon.transform)
                            {
                                if (c.GetComponent <Renderer>() != null)
                                {
                                    GetComponent <ShadowComponent>().SetShadowPlane(c.gameObject);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Weapon = Instantiate(Resources.Load <GameObject>(WeaponData.itemData.ModelName)) as GameObject;
                    Log.Sys("NpcEquipment::WieldEquip No Scab  " + Weapon);
                    if (WorldManager.worldManager.IsPeaceLevel())
                    {
                        if (back != null)
                        {
                            var Point3 = Util.FindChildRecursive(Weapon.transform, "Point3");
                            Log.Sys("Wield Weapon in Back " + Point3);
                            var mat = Matrix4x4.TRS(Point3.localPosition, Point3.localRotation, Point3.localScale);
                            var inv = mat.inverse;

                            Weapon.transform.parent        = back;
                            Weapon.transform.localPosition = inv.GetColumn(3);
                            Weapon.transform.localRotation = Quaternion.LookRotation(inv.GetColumn(2), inv.GetColumn(1));
                            Weapon.transform.localScale    = Vector3.one;

                            Log.Sys("Set Weapon Transform " + inv.GetColumn(3));
                            if (Weapon.GetComponent <Renderer>() != null)
                            {
                                GetComponent <ShadowComponent>().SetShadowPlane(Weapon);
                            }

                            foreach (Transform c in Weapon.transform)
                            {
                                if (c.GetComponent <Renderer>() != null)
                                {
                                    GetComponent <ShadowComponent>().SetShadowPlane(c.gameObject);
                                }
                            }
                        }
                        else
                        {
                            Debug.Log("NpcEquipment:: Not Find Back For equip ");
                        }
                    }
                    else
                    {
                        Log.Sys("Wield Weapon On RightHand");
                        if (rightHand != null)
                        {
                            Weapon.transform.parent        = rightHand;
                            Weapon.transform.localPosition = Vector3.zero;
                            Weapon.transform.localRotation = Quaternion.identity;
                            Weapon.transform.localScale    = Vector3.one;
                            //3dsmax
                            if (Weapon.GetComponent <Renderer>() != null)
                            {
                                GetComponent <ShadowComponent>().SetShadowPlane(Weapon);
                            }

                            foreach (Transform c in Weapon.transform)
                            {
                                if (c.GetComponent <Renderer>() != null)
                                {
                                    GetComponent <ShadowComponent>().SetShadowPlane(c.gameObject);
                                }
                            }
                        }
                        else
                        {
                            Debug.LogError("NpcEquipment:: Not Found RightHand");
                        }
                    }
                }

                break;


            case ItemData.EquipPosition.BODY:
                SetArmor(ed, out Chest);
                ChestData = ed;
                defaultChest.SetActive(false);
                break;

            case ItemData.EquipPosition.GLOVES:
                SetArmor(ed, out Gloves);
                GlovesData = ed;
                defaultGloves.SetActive(false);
                break;

            case ItemData.EquipPosition.SHOES:
                SetArmor(ed, out Shoes);
                ShoesData = ed;
                defaultBoots.SetActive(false);
                break;

            case ItemData.EquipPosition.HEAD:
                Log.Trivial(Log.Category.System, "Wear Head");

                SetArmor(ed, out Head);
                headData = ed;
                defaultHead.SetActive(false);
                break;

            case ItemData.EquipPosition.TROUSERS:
                SetArmor(ed, out Trousers);
                TrousersData = ed;
                defaultTrousers.SetActive(false);
                break;

            default:
                Debug.LogError("WieldEquip Not Exists " + ed.itemData.equipPosition);
                break;
            }

            SetFakeObjLayer();
        }
コード例 #16
0
ファイル: PackageItem.cs プロジェクト: Xnovae/MobaClient
 public void SetEquipData(EquipData equip)
 {
     equipData = equip;
     Name.text = string.Format("[ff9500]{0}({1}级)[-]", equip.itemData.ItemName, equipData.entry.Level);
 }