Example #1
0
    public bool UseMountOrPetResult(CReadPacket packet)
    {
        Debug.Log("使用宠物或坐骑结果");
        Dictionary <string, object> data = packet.data;
        int resolt = int.Parse(data["ret"].ToString());
        int types  = int.Parse(data["types"].ToString());

        if (resolt == 0)
        {
            if (types == 1)
            {
                MountAndPetNodeData.Instance().currentPetID = long.Parse(data["petId"].ToString());
                //UIMountAndPet.Instance.ShowPet();//刷新宠物
                CharacterManager.playerCS.HidePet();
            }
            else if (types == 2)
            {
                MountAndPetNodeData.Instance().currentMountID = long.Parse(data["petId"].ToString());
                //UIMountAndPet.Instance.ShowMount();//刷新坐骑
                if (CharacterManager.playerCS.pm.isRiding)//如果玩家正骑着坐骑,然后更换了坐骑,需要让玩家下坐骑(因为坐骑已经改变了)
                {
                    CharacterManager.playerCS.pm.Ride(false);
                }
            }
        }
        else
        {
            Debug.Log(string.Format("使用宠物或坐骑失败:{0}", data["desc"].ToString()));
            //UIPromptBox.Instance.ShowLabel(data["desc"].ToString());
            Control.ShowGUI(UIPanleID.UIPromptBox, EnumOpenUIType.DefaultUIOrSecond, false, data["desc"].ToString());
        }
        return(true);
    }
Example #2
0
 public static MountAndPetNodeData Instance()
 {
     if (mSingleton == null)
     {
         mSingleton = new MountAndPetNodeData();
     }
     return(mSingleton);
 }
Example #3
0
    public bool ChangeMountOrPetStateResult(CReadPacket packet)
    {
        Debug.Log("改变宠物或坐骑的状态结果");
        Dictionary <string, object> data = packet.data;
        int resolt = int.Parse(data["ret"].ToString());
        int types  = int.Parse(data["types"].ToString());

        //int state = int.Parse();
        //object[] itemList = data["item"] as object[];
        if (resolt == 0)
        {
            int state = int.Parse(data["status"].ToString());
            if (types == 1)
            {
                if (state == 1)
                {
                    MountAndPetNodeData.Instance().godefPetID = long.Parse(data["petId"].ToString());
                    //显示宠物
                    CharacterManager.playerCS.CreatePet(MountAndPetNodeData.Instance().godefPetID);
                    Debug.Log("显示宠物");
                }
                else if (state == 0)
                {
                    MountAndPetNodeData.Instance().godefPetID = 0;
                    //隐藏宠物
                    CharacterManager.playerCS.HidePet();
                    Debug.Log("隐藏宠物");
                }
            }
            else if (types == 2)
            {
                if (state == 1)
                {
                    MountAndPetNodeData.Instance().goMountID = long.Parse(data["petId"].ToString());
                    CharacterManager.playerCS.pm.Ride(true, MountAndPetNodeData.Instance().goMountID);
                    Debug.Log("上马");
                    //上马
                }
                else if (state == 0)
                {
                    MountAndPetNodeData.Instance().goMountID = 0;
                    CharacterManager.playerCS.pm.Ride(false);
                    Debug.Log("下马");
                    //下马
                }
            }
        }
        else
        {
            Debug.Log(string.Format("改变宠物或坐骑的状态失败:{0}", data["desc"].ToString()));
            //UIPromptBox.Instance.ShowLabel(data["desc"].ToString());
            Control.ShowGUI(UIPanleID.UIPromptBox, EnumOpenUIType.DefaultUIOrSecond, false, data["desc"].ToString());
        }
        return(true);
    }
Example #4
0
 public void Update()
 {
     if (index == MountAndPetNodeData.Instance().seletIndex)
     {
         pitchOn.gameObject.SetActive(true);
     }
     else
     {
         pitchOn.gameObject.SetActive(false);
     }
 }
Example #5
0
 void StartRide()
 {
     riding         = true;
     rideBar.value += 0.01f;
     if (rideBar.value >= 0.99f)
     {
         long mountId = MountAndPetNodeData.Instance().currentMountID;
         ClientSendDataMgr.GetSingle().GetPetSend().SendChangeMountOrPetState(C2SMessageType.ActiveWait, 2, MountAndPetNodeData.Instance().currentMountID, 1);
         CharacterManager.playerCS.pm.isWaitingRideMsg = true;
         CancelRide();
     }
 }
Example #6
0
 /// <summary>
 /// 显示宠物
 /// </summary>
 public void ShowPet()
 {
     InitData();
     MountAndPetNodeData.Instance().seletIndex = 0;
     if (petObjs != null)
     {
         mountAndPetList.InSize(petObjs.Length, 1);
         mountAndPetList.Info(petObjs);
         if (petObjs.Length > 0)
         {
             SetInfo(petObjs[0], MountAndPet.Pet);
         }
     }
 }
Example #7
0
 private void OnIconClick()
 {
     MountAndPetNodeData.Instance().seletIndex = index;
     if (MountAndPetNodeData.Instance().ShowType)//true坐骑/false宠物
     {
         if (mountNode != null)
         {
             UIMountAndPet.Instance.SetInfo(mountNode, MountAndPet.Mount);
         }
         // UIMountAndPet.Instance().InsHero(mountNode.icon_name);
     }
     else
     {
         if (petNode != null)
         {
             UIMountAndPet.Instance.SetInfo(petNode, MountAndPet.Pet);
         }
     }
 }
Example #8
0
 void OnPetIcon()
 {
     if (null == CharacterManager.playerCS.pet || !CharacterManager.playerCS.pet.activeSelf)
     {
         if (MountAndPetNodeData.Instance().currentPetID == 0)
         {
             // CharacterManager.instance.ShowTip("未指定宠物");
             //UIMountAndPet.mountAndPets = MountAndPet.Pet;
             //Control.ShowGUI(GameLibrary.UIMountAndPet);
             Control.ShowGUI(UIPanleID.UIMountAndPet, EnumOpenUIType.OpenNewCloseOld, false, MountAndPet.Pet);
             return;
         }
         ClientSendDataMgr.GetSingle().GetPetSend().SendChangeMountOrPetState(C2SMessageType.ActiveWait, 1, MountAndPetNodeData.Instance().currentPetID, 1);
     }
     else
     {
         ClientSendDataMgr.GetSingle().GetPetSend().SendChangeMountOrPetState(C2SMessageType.ActiveWait, 1, MountAndPetNodeData.Instance().currentPetID, 0);
     }
 }
Example #9
0
    public bool UpdatePetInfoResult(CReadPacket packet)
    {
        Debug.Log("更新宠物信息结果");
        Dictionary <string, object> data = packet.data;
        int resolt = int.Parse(data["ret"].ToString());

        object[] itemList = data["item"] as object[];
        if (resolt == 0)
        {
            if (itemList != null)
            {
                for (int i = 0; i < itemList.Length; i++)
                {
                    Dictionary <string, object> itemDataDic = itemList[i] as Dictionary <string, object>;
                    ShoucangData shoucangData = new ShoucangData();
                    shoucangData.id = long.Parse(itemDataDic["id"].ToString());
                    //shoucangData.uuid = itemDataDic["uid"].ToString();
                    //shoucangData.level = int.Parse(itemDataDic["lv"].ToString());
                    //shoucangData.state = int.Parse(itemDataDic["st"].ToString());
                    if (MountAndPetNodeData.Instance().havePetList.ContainsKey(shoucangData.id))
                    {
                        MountAndPetNodeData.Instance().havePetList[shoucangData.id] = shoucangData;
                    }
                    else
                    {
                        MountAndPetNodeData.Instance().havePetList.Add(shoucangData.id, shoucangData);
                    }
                }
            }

            //if (Singleton<SceneManage>.Instance.Current == EnumSceneID.UI_MajorCity01 && Control.GetGUI(GameLibrary.UIMountAndPet).gameObject.activeSelf)
            //{
            //    UIMountAndPet.Instance.ShowPet();//刷新宠物
            //}
        }
        else
        {
            Debug.Log(string.Format("更新宠物信息失败:{0}", data["desc"].ToString()));
            //UIPromptBox.Instance.ShowLabel(data["desc"].ToString());
            Control.ShowGUI(UIPanleID.UIPromptBox, EnumOpenUIType.DefaultUIOrSecond, false, data["desc"].ToString());
        }
        return(true);
    }
Example #10
0
 void CreateMainPlayer()
 {
     // Globe.UseServerBattleAttrs = GameLibrary.isNetworkVersion;
     if ((currentScene == GameLibrary.UI_Major || currentScene == GameLibrary.LGhuangyuan) || currentScene == GameLibrary.PVP_1V1 && CharacterManager.instance != null)
     {
         CharacterManager.instance.CreateTownPlayer();
         if (MountAndPetNodeData.Instance().godefPetID != 0)
         {
             CharacterManager.playerCS.CreatePet(MountAndPetNodeData.Instance().godefPetID);
         }
         if (MountAndPetNodeData.Instance().goMountID > 0)
         {
             CharacterManager.playerCS.pm.Ride(true, MountAndPetNodeData.Instance().goMountID, false);
         }
     }
     if (FindObjectOfType <SceneBaseManager>() != null)
     {
         FindObjectOfType <SceneBaseManager>().StartCD();
         FindObjectOfType <SceneBaseManager>().InitScene();
     }
 }
Example #11
0
 void OnRide()
 {
     if (TaskAutoTraceManager._instance != null)
     {
         TaskAutoTraceManager._instance.StopTaskAutoFindWay();
     }
     if (!CheckCanRide((HeroData)CharacterManager.playerCS.CharData))
     {
         CharacterManager.instance.ShowTip("该英雄无法骑乘");
         return;
     }
     if (MountAndPetNodeData.Instance().currentMountID <= 0)
     {
         //MountAndPetNodeData.Instance().currentMountID = 601000100;
         // CharacterManager.instance.ShowTip("未指定坐骑");
         //UIMountAndPet.mountAndPets = MountAndPet.Mount;
         //Control.ShowGUI(GameLibrary.UIMountAndPet);
         Control.ShowGUI(UIPanleID.UIMountAndPet, EnumOpenUIType.OpenNewCloseOld, false, MountAndPet.Mount);
         return;
     }
     if (!CharacterManager.playerCS.pm.isRiding)
     {
         if (riding)
         {
             CancelRide();
         }
         else
         {
             rideBar.gameObject.SetActive(true);
             rideBar.value = 0f;
             InvokeRepeating("StartRide", 0f, 0.02f);
         }
     }
     else
     {
         CharacterManager.playerCS.pm.isWaitingRideMsg = true;
         ClientSendDataMgr.GetSingle().GetPetSend().SendChangeMountOrPetState(C2SMessageType.ActiveWait, 2, MountAndPetNodeData.Instance().currentMountID, 0);
         //CharacterManager.playerCS.pm.Ride(false);
     }
 }
Example #12
0
    private void OnCheckClick(int index, bool boo)
    {
        if (boo)
        {
            switch (index)
            {
            case 0:
                currentOperation = MountAndPet.Mount;
                MountAndPetNodeData.Instance().ShowType = true;
                canRide.gameObject.SetActive(true);
                heroList.gameObject.SetActive(true);
                //获取一下玩家拥有的坐骑
                Dictionary <string, object> newpacket = new Dictionary <string, object>();
                newpacket.Add("arg1", 2);    //1宠物 2坐骑
                Singleton <Notification> .Instance.Send(MessageID.pet_query_list_req, newpacket, C2SMessageType.ActiveWait);

                //ClientSendDataMgr.GetSingle().GetPetSend().SendGetHaveMountOrPetList(C2SMessageType.ActiveWait, 2);
                ShowMount();
                break;

            case 1:
                currentOperation = MountAndPet.Pet;
                MountAndPetNodeData.Instance().ShowType = false;
                canRide.gameObject.SetActive(false);
                heroList.gameObject.SetActive(false);
                //获取一下玩家拥有的宠物
                Dictionary <string, object> newpacket1 = new Dictionary <string, object>();
                newpacket1.Add("arg1", 1);    //1宠物 2坐骑
                Singleton <Notification> .Instance.Send(MessageID.pet_query_list_req, newpacket1, C2SMessageType.ActiveWait);

                //ClientSendDataMgr.GetSingle().GetPetSend().SendGetHaveMountOrPetList(C2SMessageType.ActiveWait, 1);
                ShowPet();
                break;
            }
        }
    }
Example #13
0
    protected override void ShowHandler()
    {
        if (itemdata != null)
        {
            ShowItemData();
        }
        else
        {
            goodsName.text   = goodsname;
            dec.text         = decs;
            kuang.spriteName = kuangs;

            if (goodsimg == "zuanshi")
            {
                goodsImg.atlas      = Propatlas;
                goodsImg.spriteName = goodsimg;
                debris.gameObject.SetActive(false);//钻石不显示灵魂石
                goodsNum.text = playerData.GetInstance().baginfo.diamond.ToString();
            }
            else
            {
                int goodsIDNum = int.Parse(ID.ToString().Substring(0, 3));
                if (goodsIDNum == 107 || goodsIDNum == 106)
                {
                    goodsImg.atlas      = UIHeroHeadatlas;
                    goodsImg.spriteName = goodsimg;
                    if (goodsIDNum == 106)//106时显示灵魂石
                    {
                        debris.gameObject.SetActive(true);
                    }
                    else
                    {
                        debris.gameObject.SetActive(false);
                    }
                    if (GameLibrary.Instance().ItemStateList.ContainsKey(ID))
                    {
                        if (GameLibrary.Instance().ItemStateList[ID].types == (int)ItemType.HeroCard)
                        {
                            goodsNum.text = MountAndPetNodeData.Instance().GetHeroCount(ID).ToString();
                        }
                        else
                        {
                            goodsNum.text = GoodsDataOperation.GetInstance().GetItemCountById(ID).ToString();
                        }
                    }
                }
                else
                {
                    goodsImg.atlas      = Propatlas;
                    goodsImg.spriteName = goodsimg;
                    debris.gameObject.SetActive(false);
                    if (GameLibrary.Instance().ItemStateList.ContainsKey(ID))
                    {
                        if (GameLibrary.Instance().ItemStateList[ID].types == (int)ItemType.Pet)
                        {
                            goodsNum.text = MountAndPetNodeData.Instance().GetMountOrPetCount(ID, MountAndPet.Pet).ToString();
                        }
                        else if (GameLibrary.Instance().ItemStateList[ID].types == (int)ItemType.Mount)
                        {
                            goodsNum.text = MountAndPetNodeData.Instance().GetMountOrPetCount(ID, MountAndPet.Mount).ToString();
                        }
                        else
                        {
                            goodsNum.text = GoodsDataOperation.GetInstance().GetItemCountById(ID).ToString();
                        }
                    }
                }
            }
        }
    }
Example #14
0
    private void InitData()
    {
        //mountObjs = MountAndPetNodeData.Instance().GetMPlist().ToArray();
        //petObjs = MountAndPetNodeData.Instance().Getpetlist().ToArray();
        mplist.Clear();
        petlist.Clear();
        //排列顺序  使用 拥有 为拥有
        List <UIMountNode> allMountList = new List <UIMountNode>();//临时的用于插入

        mplist = MountAndPetNodeData.Instance().GetMPlist();
        foreach (UIMountNode val in mplist)
        {
            if (MountAndPetNodeData.Instance().currentMountID == val.mount_id)
            {
            }
            if (MountAndPetNodeData.Instance().IsHaveThisMount(val.mount_id))
            {
                allMountList.Insert(0, val);
            }
            else
            {
                allMountList.Add(val);
            }
        }
        foreach (UIMountNode val in allMountList)
        {
            if (val.mount_id == MountAndPetNodeData.Instance().currentMountID)
            {
                allMountList.Remove(val);
                allMountList.Insert(0, val);
                break;
            }
        }


        List <UIPetNode> allPetList = new List <UIPetNode>();//临时的用于插入

        petlist = MountAndPetNodeData.Instance().Getpetlist();
        foreach (UIPetNode val in petlist)
        {
            if (MountAndPetNodeData.Instance().currentPetID == val.pet_id)
            {
            }
            if (MountAndPetNodeData.Instance().IsHaveThisPet(val.pet_id))
            {
                allPetList.Insert(0, val);
            }
            else
            {
                allPetList.Add(val);
            }
        }
        foreach (UIPetNode val in allPetList)
        {
            if (val.pet_id == MountAndPetNodeData.Instance().currentPetID)
            {
                allPetList.Remove(val);
                allPetList.Insert(0, val);
                break;
            }
        }


        mountObjs = allMountList.ToArray();
        petObjs   = allPetList.ToArray();

        allMountList = null;
        allPetList   = null;
    }
Example #15
0
 void CancelRiding()
 {
     if (CharacterManager.playerCS != null)
     {
         if (CharacterManager.playerCS.pm.isRiding)
         {
             ClientSendDataMgr.GetSingle().GetPetSend().SendChangeMountOrPetState(C2SMessageType.ActiveWait, 2, MountAndPetNodeData.Instance().currentMountID, 0);
         }
         else if (UIRole.instance != null && UIRole.instance.riding)
         {
             UIRole.instance.CancelRide();
         }
         else
         {
         }
     }
 }
Example #16
0
    void OnCloseOperating()
    {
        if ((null != heroPlayList[0] && heroPlayList[0].id != 0) || CheckArenaHaveHero())
        {
            switch (sourceType)
            {
            case OpenSourceType.City:
            case OpenSourceType.Dungeons:
                CheckToSave(heroPlayList, ref Globe.fightHero, 1);
                if (heroPlayList[0].id != GameLibrary.player)
                {
                    if (null != CharacterManager.playerCS.pet)
                    {
                        CharacterManager.playerCS.HidePet();
                        ClientSendDataMgr.GetSingle().GetPetSend().SendChangeMountOrPetState(C2SMessageType.ActiveWait, 1, MountAndPetNodeData.Instance().currentPetID, 0);
                    }
                    if (CharacterManager.playerCS.pm.isRiding)    //当主英雄改变 如果之前是上马状态 改成下马状态(通知后端)
                    {
                        // CharacterManager.playerCS.pm.Ride(false);
                        ClientSendDataMgr.GetSingle().GetPetSend().SendChangeMountOrPetState(C2SMessageType.ActiveWait, 2, MountAndPetNodeData.Instance().currentMountID, 0);
                    }
                    GameLibrary.player = heroPlayList[0].id;
                    CharacterManager.instance.CreateTownPlayer();
                    UIRole.Instance.RefreshIconId((int)GameLibrary.player);
                }
                break;

            case OpenSourceType.ArenaDefen:
                CheckToSave(heroPlayList, ref Globe.adFightHero, 2);
                break;

            case OpenSourceType.actGold:
                CheckToSave(heroPlayList, ref Globe.ed1FightHero, 3);
                break;

            case OpenSourceType.actExpe:
                CheckToSave(heroPlayList, ref Globe.ed2FightHero, 4);
                break;

            case OpenSourceType.actPower:
                CheckToSave(heroPlayList, ref Globe.ed3FightHero, 5);
                break;

            case OpenSourceType.actAgile:
                CheckToSave(heroPlayList, ref Globe.ed4FightHero, 6);
                break;

            case OpenSourceType.actIntel:
                CheckToSave(heroPlayList, ref Globe.ed5FightHero, 7);
                break;

            case OpenSourceType.Arena:
                CheckToSave(heroPlayList, ref Globe.arenaFightHero, 8);
                break;
            }
        }
        if (sourceType != OpenSourceType.Arena)
        {
            HeroPosEmbattle.instance.HideModel();
            //Hide();
        }
    }
Example #17
0
    void HandleLoginPacketData(CReadPacket packet)
    {
        playerData.GetInstance().selfData.playerId = packet.GetUint32("playerId");
        playerData.GetInstance().selfData.accountId = packet.GetUint32("account");
        playerData.GetInstance().selfData.playeName = packet.GetString("name");
        playerData.GetInstance().selfData.level = packet.GetInt("level");
        playerData.GetInstance().baginfo.strength = packet.GetInt("thew");           //体力
        playerData.GetInstance().baginfo.gold = packet.GetUint32("gold");            //金币
        playerData.GetInstance().baginfo.diamond = packet.GetUint32("diamond");      //钻石
        playerData.GetInstance().selfData.heroId = packet.GetUint32("heroId");
        playerData.GetInstance().selfData.changeCount = packet.GetInt("changeName"); //改名次数
        playerData.GetInstance().selfData.exprience = packet.GetInt("exps");
        playerData.GetInstance().selfData.maxExprience = packet.GetInt("maxExps");
        playerData.GetInstance().selfData.expPool = packet.GetLong("expsPool");//经验池经验值
        if (playerData.GetInstance().selfData.expPool < 0)
        {
            playerData.GetInstance().selfData.expPool = 0;
        }
        playerData.GetInstance().baginfo.areanCoin = packet.GetUint32("arenaCoin");        //竞技场币
        playerData.GetInstance().baginfo.pveCoin = packet.GetUint32("pveCoin");            //--龙鳞币
        playerData.GetInstance().baginfo.pvpCoin = packet.GetUint32("pvpCoin");            //角斗场币
        playerData.GetInstance().baginfo.rewardCoin = packet.GetUint32("rewardCoin");      //悬赏币
        playerData.GetInstance().baginfo.todayBuyStrengthCount = packet.GetInt("buyThew"); //购买体力次数
        playerData.GetInstance().actionData.energyBuyTimes = playerData.GetInstance().baginfo.todayBuyStrengthCount;
        playerData.GetInstance().selfData.vip = packet.GetInt("vip");
        playerData.GetInstance().selfData.keyId = packet.GetUint32("ky");
        playerData.GetInstance().actionData.energyRecoverEndTime = packet.GetLong("maxThewTime");
        playerData.GetInstance().InitActionData();
        Auxiliary.SetServerTime(packet.GetDouble("sysTime"));                              //同步系统时间

        long photoId = playerData.GetInstance().iconData.icon_id = packet.GetInt("photo"); //头像
        Dictionary <long, RoleIconAttrNode> pDict = FSDataNodeTable <RoleIconAttrNode> .GetSingleton().DataNodeList;

        if (pDict.ContainsKey(photoId))
        {
            playerData.GetInstance().iconData.icon_name = pDict[photoId].icon_name;
        }
        long photoFrameId = playerData.GetInstance().iconFrameData.iconFrame_id = packet.GetInt("photoFrame"); //头像框

        if (pDict.ContainsKey(photoFrameId))
        {
            playerData.GetInstance().iconFrameData.iconFrame_name = pDict[photoFrameId].icon_name;
        }

        SocietyManager.Single().mySocityID  = packet.GetLong("unionId");     //公会id
        SocietyManager.Single().societyName = packet.GetString("unionName"); //公会名称
        if (SocietyManager.Single().mySocityID != 0 && SocietyManager.Single().societyName != "")
        {
            SocietyManager.Single().isJoinSociety = true;
            Globe.isHaveSociety = true;
        }
        else
        {
            SocietyManager.Single().isJoinSociety = false;
            Globe.isHaveSociety = false;
        }
        if (packet.GetInt("unionPosition") == 1)
        {
            SocietyManager.Single().societyStatus = SocietyStatus.Member;
        }
        else if (packet.GetInt("unionPosition") == 5)
        {
            SocietyManager.Single().societyStatus = SocietyStatus.President;
        }
        else
        {
            SocietyManager.Single().societyStatus = SocietyStatus.Null;
        }

        MountAndPetNodeData.Instance().currentMountID = packet.GetLong("defMountsId"); //当前使用的坐骑id
        MountAndPetNodeData.Instance().currentPetID   = packet.GetLong("defPetId");    //当前使用的宠物id
        MountAndPetNodeData.Instance().goMountID      = packet.GetLong("mountsId");    //使用坐骑状态,0为没有骑乘坐骑
        MountAndPetNodeData.Instance().godefPetID     = packet.GetLong("petId");       //使用的宠物状态

        if (packet.data.ContainsKey("fightHero"))
        {
            LoadHeroList(packet.data["fightHero"], ref Globe.fightHero);
        }
        LoadHeroList(packet.data["adFightHero"], ref Globe.adFightHero);
        LoadHeroList(packet.data["ed1FightHero"], ref Globe.ed1FightHero);
        LoadHeroList(packet.data["ed2FightHero"], ref Globe.ed2FightHero);
        LoadHeroList(packet.data["ed3FightHero"], ref Globe.ed3FightHero);
        LoadHeroList(packet.data["ed4FightHero"], ref Globe.ed4FightHero);
        LoadHeroList(packet.data["ed5FightHero"], ref Globe.ed5FightHero);
        if (packet.data.ContainsKey("arenaFightHero"))
        {
            LoadHeroList(packet.data["arenaFightHero"], ref Globe.arenaFightHero);
        }

        //if (Globe.adFightHero[0] == 0)
        //    LoadHeroList(packet.data["fightHero"], ref Globe.adFightHero);

        serverMgr.GetInstance().saveData();
        // ClientSendDataMgr.GetSingle().GetWalkSend().ping = true;
    }
Example #18
0
    public void ShowItemData()
    {
        if (itemdata == null)
        {
            return;
        }
        goodsImg.atlas = itemdata.UiAtlas;
        //goodsName.text = itemdata.Name;
        goodsName.text = GoodsDataOperation.GetInstance().JointNameColour(itemdata.Name, itemdata.GradeTYPE);
        dec.text       = itemdata.Describe;
        if (itemdata.GoodsType == MailGoodsType.DiamomdType)
        {
            goodsNum.text       = playerData.GetInstance().baginfo.diamond.ToString() + "";
            goodsImg.spriteName = "zuanshi";
        }
        if (itemdata.GoodsType == MailGoodsType.GoldType)
        {
            goodsNum.text       = playerData.GetInstance().baginfo.gold.ToString() + "";
            goodsImg.spriteName = "jinbi";
        }
        if (itemdata.GoodsType == MailGoodsType.ExE)
        {
            goodsNum.text       = itemdata.Exe + "";
            goodsImg.spriteName = "zhandui-exp";
        }
        if (itemdata.GoodsType == MailGoodsType.PowerType)
        {
            goodsNum.text       = itemdata.Power + "";
            goodsImg.spriteName = "tili";
        }
        if (itemdata.GoodsType == MailGoodsType.HeroExp)
        {
            goodsNum.text       = itemdata.HeroExp + "";
            goodsImg.spriteName = "exp";
        }
        if (itemdata.GoodsType == MailGoodsType.XuanshangGold)
        {
            goodsNum.text       = itemdata.XuanshangGold + "";
            goodsImg.spriteName = "xuanshangbi";
        }
        if (itemdata.GoodsType == MailGoodsType.ItemType)
        {
            if (itemdata.Types == (int)ItemType.Pet)
            {
                goodsNum.text = MountAndPetNodeData.Instance().GetMountOrPetCount(itemdata.Id, MountAndPet.Pet).ToString();
            }
            else if (itemdata.Types == (int)ItemType.Mount)
            {
                goodsNum.text = MountAndPetNodeData.Instance().GetMountOrPetCount(itemdata.Id, MountAndPet.Mount).ToString();
            }
            else if (itemdata.Types == (int)ItemType.HeroCard)
            {
                goodsNum.text = MountAndPetNodeData.Instance().GetHeroCount(itemdata.Id).ToString();
            }
            else
            {
                goodsNum.text = GoodsDataOperation.GetInstance().GetItemCountById(itemdata.Id).ToString();
            }
            dec.text = GoodsDataOperation.GetInstance().ConvertGoodsDes(itemdata);
            if (GameLibrary.Instance().ItemStateList.ContainsKey(itemdata.Id))
            {
                goodsImg.spriteName = GameLibrary.Instance().ItemStateList[itemdata.Id].icon_name;
            }
        }
        if (itemdata.Types == 6)
        {
            debris.gameObject.SetActive(true);
        }
        else
        {
            debris.gameObject.SetActive(false);
        }
        switch (itemdata.GradeTYPE)
        {
        case GradeType.Gray:
            kuang.spriteName = "hui";
            break;

        case GradeType.Green:
            kuang.spriteName = "lv";
            break;

        case GradeType.Blue:
            kuang.spriteName = "lan";
            break;

        case GradeType.Purple:
            kuang.spriteName = "zi";
            break;

        case GradeType.Orange:
            kuang.spriteName = "cheng";
            break;

        case GradeType.Red:
            kuang.spriteName = "hong";
            break;

        default:
            break;
        }
    }
Example #19
0
 /// <summary>
 /// 设置宠物或者坐骑的详细信息
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="type"></param>
 public void SetInfo(object obj, MountAndPet type)
 {
     currentOperation = type;
     if (type == MountAndPet.Mount)
     {
         mountData = (UIMountNode)obj;
         //MountHeroViewItem.Instance().refreshUI(MountAndPetNodeData.Instance().GetHerolist(mountData.mount_types));
         heroList.InSize(MountAndPetNodeData.Instance().GetHerolist(mountData.mount_types).Count, 3);
         heroList.Info(MountAndPetNodeData.Instance().GetHerolist(mountData.mount_types).ToArray());
         morPName.text   = GoodsDataOperation.GetInstance().JointNameColour(mountData.name, GradeType.Purple);;
         des.text        = mountData.describe;
         levellimit.text = mountData.need_lv + "";
         // 先判断是否拥有
         //再判断是否使用
         if (MountAndPetNodeData.Instance().IsHaveThisMount(mountData.mount_id))
         {
             buyBtn.gameObject.SetActive(false);
             getWayLabel.gameObject.SetActive(false);
             if (MountAndPetNodeData.Instance().currentMountID == mountData.mount_id)
             {
                 useBtn.gameObject.SetActive(false);
             }
             else
             {
                 useBtn.gameObject.SetActive(true);
             }
         }
         else
         {
             useBtn.gameObject.SetActive(false);
             buyBtn.gameObject.SetActive(true);
             getWayLabel.gameObject.SetActive(true);
             getWayLabel.text = GetWayDetail(mountData.mount_id);
         }
         InsHero(int.Parse(mountData.model_id), MountAndPet.Mount);
     }
     else if (type == MountAndPet.Pet)
     {
         petData         = (UIPetNode)obj;
         morPName.text   = GoodsDataOperation.GetInstance().JointNameColour(petData.name, GradeType.Purple);;
         des.text        = petData.describe;
         levellimit.text = petData.need_lv + "";
         if (MountAndPetNodeData.Instance().IsHaveThisPet(petData.pet_id))
         {
             buyBtn.gameObject.SetActive(false);
             getWayLabel.gameObject.SetActive(false);
             if (MountAndPetNodeData.Instance().currentPetID == petData.pet_id)
             {
                 useBtn.gameObject.SetActive(false);
             }
             else
             {
                 useBtn.gameObject.SetActive(true);
             }
         }
         else
         {
             useBtn.gameObject.SetActive(false);
             buyBtn.gameObject.SetActive(true);
             getWayLabel.gameObject.SetActive(true);
             getWayLabel.text = GetWayDetail(petData.pet_id);
         }
         InsHero(int.Parse(petData.model_id), MountAndPet.Pet);
     }
 }
Example #20
0
    public override void Info(object obj)
    {
        if (MountAndPetNodeData.Instance().ShowType)
        {
            if (obj != null)
            {
                mountNode = (UIMountNode)obj;
                //判断是否有坐骑 在没有坐骑的情况下取表里第一个坐骑显示和被选中的状态
                icon.spriteName = mountNode.icon_name;


                // 先判断是否拥有
                //再判断是否使用
                if (MountAndPetNodeData.Instance().IsHaveThisMount(mountNode.mount_id))
                {
                    if (MountAndPetNodeData.Instance().currentMountID != mountNode.mount_id)
                    {
                        black.gameObject.SetActive(false);
                        lockSprite.gameObject.SetActive(false);
                        iconState.gameObject.SetActive(false);
                    }
                    else
                    {
                        black.gameObject.SetActive(false);
                        lockSprite.gameObject.SetActive(false);
                        iconState.gameObject.SetActive(true);
                    }
                }
                else
                {
                    black.gameObject.SetActive(true);
                    lockSprite.gameObject.SetActive(true);
                    iconState.gameObject.SetActive(false);
                }
            }
        }
        else
        {
            if (obj != null)
            {
                petNode = (UIPetNode)obj;
                //判断是否有宠物 在没有宠物的情况下取表里第一个坐骑显示和被选中的状态
                icon.spriteName = petNode.icon_name;
                if (MountAndPetNodeData.Instance().IsHaveThisPet(petNode.pet_id))
                {
                    if (MountAndPetNodeData.Instance().currentPetID != petNode.pet_id)
                    {
                        black.gameObject.SetActive(false);
                        lockSprite.gameObject.SetActive(false);
                        iconState.gameObject.SetActive(false);
                    }
                    else
                    {
                        black.gameObject.SetActive(false);
                        lockSprite.gameObject.SetActive(false);
                        iconState.gameObject.SetActive(true);
                    }
                }
                else
                {
                    black.gameObject.SetActive(true);
                    lockSprite.gameObject.SetActive(true);
                    iconState.gameObject.SetActive(false);
                }
            }
        }
    }