예제 #1
0
    /// <summary>
    /// 选择奥义
    /// </summary>
    /// <param name="go"></param>
    void ChooseArcane(GameObject go)
    {
        panel.arcaneAni.gameObject.SetActive(true);
        go.GetComponent <Animation>().Play("aoyi_scale");
        panel.arcaneAni.Play("UIEffect101_load");
        cardInfoList.arcaneId = UtilTools.IntParse(go.name);
        TD_Skill skillInfo = SkillConfig.GetItem(cardInfoList.arcaneId);

        if (skillInfo == null)
        {
            Debug.LogError("缺少配置");
            return;
        }
        panel.arcaneName.text  = skillInfo.name;
        panel.arcaneDes.text   = skillInfo.des;
        panel.arcanePoint.text = skillInfo.point.ToString();
        if (HeroTeamMediator.heroTeamMediator.dropInfo != null)
        {
            HeroTeamMediator.heroTeamMediator.dropInfo.arcaneId = cardInfoList.arcaneId;
        }
        if (firstInArcaneUI)
        {
            return;
        }
        firstInArcaneUI = false;
        ArcaneMsg msg = new ArcaneMsg
        {
            teamUUid     = cardInfoList.teamId,
            teamHeroUUid = cardInfoList.heroId,
            arcaneId     = cardInfoList.arcaneId,
        };

        NSocket.GetInstance().SendData(Request.ChangeArcane, msg);
    }
예제 #2
0
    /// <summary>
    /// 交换两个英雄位置
    /// </summary>
    /// <param name="start"></param>
    /// <param name="end"></param>
    void SwitchTwoHeroPosition(UIGridItem start, UIGridItem end)
    {
        if (start == null || end == null || start.miCurIndex == end.miCurIndex)
        {
            return;
        }
        Vector3 temp = start.transform.localPosition;

        TweenPosition.Begin(start.gameObject, 0.2f, end.transform.localPosition);
        TweenPosition.Begin(end.gameObject, 0.2f, temp);
        HeroInfo         startInfo = start.oData as HeroInfo;
        HeroInfo         endInfo   = end.oData as HeroInfo;
        ChangeHeroPosMsg msg       = new ChangeHeroPosMsg
        {
            teamId   = heroListMsg.id,
            type     = 1,
            heroId   = startInfo.heroUUId,
            startPos = startInfo.pos,
            changId  = endInfo.heroUUId,
            endPos   = endInfo.pos,
        };

        startInfo.pos = msg.endPos;
        endInfo.pos   = msg.startPos;
        NSocket.GetInstance().SendData(Request.ChangeHeroPos, msg);
    }
예제 #3
0
    /// <summary>
    /// 删除套牌
    /// </summary>
    /// <param name="fightIndex"></param>
    public void DeleteCardTeam(int fightIndex)
    {
        HeroInfo          downInfo = panel.cardGrid.GetCustomDataItem(fightIndex) as HeroInfo;
        DeleteSuitCardMsg msg      = new DeleteSuitCardMsg
        {
            teamUUid     = heroListMsg.id,
            teamHeroUUid = downInfo.heroUUId,
        };

        NSocket.GetInstance().SendData(Request.HeroDeleteCardReq, msg);
        HeroInfo info;

        if (downInfo.pos > 0)
        {
            for (int i = 0; i < panel.heroGrid.mDataSource.Count; ++i)
            {
                info = panel.heroGrid.GetCustomDataItem(i) as HeroInfo;
                if (info.configId == downInfo.configId)
                {
                    info.heroUUId = 0;
                    info.configId = 0;
                    panel.heroGrid.UpdateCustomData(info);
                    break;
                }
            }
        }
        downInfo.heroUUId = 0;
        downInfo.pos      = 0;
        downInfo.configId = 0;
        panel.cardGrid.UpdateCustomData(downInfo);
    }
예제 #4
0
    /// <summary>发送加载进度</summary>
    /// <param name="per"></param>
    public void SendRoomLoading(int per)
    {
        RoomLoadMsg msg = new RoomLoadMsg();

        msg.load = per;

        NSocket.GetInstance().SendData(Request.RoomLoadReq, msg);
    }
예제 #5
0
    /// <summary>匹配战斗</summa
    /// <param name="selectTeamId"></param>
    public void SendMatchFight(int selectTeamId)
    {
        MatchFightMsg msg = new MatchFightMsg();

        msg.selectTeam = selectTeamId;

        NSocket.GetInstance().SendData(Request.MatchFightReq, msg);
    }
예제 #6
0
    /// <summary>
    /// 创建角色
    /// </summary>
    public void CreateAvatar(string myName)
    {
        ParamStrMsg msg = new ParamStrMsg
        {
            strValue = myName
        };

        NSocket.GetInstance().SendData(Request.Create, msg);
    }
예제 #7
0
    /// <summary>
    /// 重置小队
    /// </summary>
    void ResetTeam()
    {
        ParamIntMsg info = new ParamIntMsg
        {
            intValue = heroListMsg.id,
        };

        NSocket.GetInstance().SendData(Request.ResetCardTeam, info);
    }
예제 #8
0
    /// <summary>结束回合</summary>
    public void SendOverRound()
    {
        if (PVPManager.Instance.InPlayMainAnimation())
        {
            return;
        }

        NSocket.GetInstance().SendData(Request.OverRoundReq);
    }
예제 #9
0
    /// <summary>
    /// 发送登录请求
    /// </summary>
    /// <param name="account"></param>
    /// <param name="pwd"></param>
    public void SendLogin(string account, string pwd)
    {
        LoginMsg msg = new LoginMsg
        {
            accountId  = account,
            accountPwd = pwd
        };

        NSocket.GetInstance().SendData(Request.Login, msg);
    }
예제 #10
0
    /// <summary>
    /// 创建新的小队
    /// </summary>
    void CeateTeam()
    {
        int         cardList = HeroProxy.Instance.cardListMsg.cardList.Count + 1;
        ParamStrMsg info     = new ParamStrMsg
        {
            strValue = string.Format(TextManager.GetUIString("UI1017"), cardList)
        };

        NSocket.GetInstance().SendData(Request.CreateCardTeam, info);
    }
예제 #11
0
    /// <summary>
    /// 改变套牌名字后提交验证
    /// </summary>
    void OnSubmitCardName()
    {
        ChangeTeamHeroNameMsg msg = new ChangeTeamHeroNameMsg
        {
            teamId = cardInfoList.teamId,
            heroId = cardInfoList.heroId,
            name   = panel.changeCardName.label.text,
        };

        NSocket.GetInstance().SendData(Request.ChangeTeamHeroNameReq, msg);
    }
예제 #12
0
    /// <summary>
    /// 设置英雄奥义 卡牌
    /// </summary>
    /// <param name="item"></param>
    void SetHeroItem(UIGridItem item)
    {
        dropInfo = item.oData as HeroInfo;
        CardMsg info = new CardMsg
        {
            teamHeroUUid = dropInfo.heroUUId,
            teamUUid     = heroListMsg.id,
            oldCardId    = 0,
        };

        NSocket.GetInstance().SendData(Request.TeamHeroCardListReq, info);
    }
예제 #13
0
    /// <summary>
    /// 设置英雄奥义 卡牌
    /// </summary>
    /// <param name="item"></param>
    void SetHeroItem(UIGridItem item)
    {
        HeroInfoMsg       info = item.oData as HeroInfoMsg;
        CreateCardTeamMsg msg  = new CreateCardTeamMsg
        {
            teamId       = HeroTeamMediator.heroTeamMediator.heroListMsg.id,
            heroConfigId = info.configId,
        };

        NSocket.GetInstance().SendData(Request.CreateCardTeamReq, msg);
        ClosePanel(null);
    }
예제 #14
0
    /// <summary>
    /// 复制当前小队
    /// </summary>
    void CopyTeam()
    {
        int         cardList = HeroProxy.Instance.cardListMsg.cardList.Count + 1;
        CopyTeamMsg msg      = new CopyTeamMsg
        {
            type   = 1,
            teamId = heroListMsg.id,
            name   = string.Format(TextManager.GetUIString("UI1017"), cardList),
        };

        NSocket.GetInstance().SendData(Request.CopyCardTeam, msg);
    }
예제 #15
0
    /// <summary>是否替换</summary>
    /// <param name="replace"></param>
    public void SendReplaceCardReq(bool replace)
    {
        if (PVPManager.Instance.InPlayMainAnimation())
        {
            return;
        }

        ReplaceCardMsg msg = new ReplaceCardMsg();

        msg.replace = replace;

        NSocket.GetInstance().SendData(Request.ReplaceCardReq, msg);
    }
예제 #16
0
    /// <summary>
    /// 选择小队
    /// </summary>
    void ChooseItem(UIGridItem item)
    {
        SelectTeamMsg info = item.oData as SelectTeamMsg;

        if (info.teamId != HeroTeamMediator.heroTeamMediator.heroListMsg.id)
        {
            ParamIntMsg msg = new ParamIntMsg
            {
                intValue = info.teamId,
            };
            NSocket.GetInstance().SendData(Request.CardHeroList, msg);
        }
        ClosePanel(null);
    }
예제 #17
0
    /// <summary>
    /// 更换上阵卡牌
    /// </summary>
    /// <param name="card"></param>
    /// <param name="index"></param>
    public void ChangeFightCard(int index)
    {
        CardDataMsg info = panel.fightGrid.GetCustomDataItem(index) as CardDataMsg;
        CardMsg     msg  = null;

        // 此位置无上阵卡牌
        if (info.configId < 4)
        {
            msg = new CardMsg
            {
                teamUUid     = cardInfoList.teamId,
                teamHeroUUid = cardInfoList.heroId,
                oldCardId    = 0,
                newCardId    = changeCardId,
            };
        }
        // 此位置有上阵卡牌,进行替换
        else
        {
            msg = new CardMsg
            {
                teamUUid     = cardInfoList.teamId,
                teamHeroUUid = cardInfoList.heroId,
                oldCardId    = info.configId,
                newCardId    = changeCardId,
            };
            TD_Card card = null;
            for (int i = 0; i < listObj.Count; ++i)
            {
                card = listObj[i] as TD_Card;
                if (card.id == info.configId)
                {
                    card.isFight = 0;
                    panel.cardGrid.UpdateCustomData(card);
                }
            }
            HeroTeamMediator.heroTeamMediator.dropInfo.skillID.Remove(info.configId);
        }
        HeroTeamMediator.heroTeamMediator.dropInfo.skillID.Add(changeCardId);
        NSocket.GetInstance().SendData(Request.CardEnterTeamReq, msg);
        info.configId    = changeCardId;
        info.isFight     = 1; // 上阵的卡牌
        drapCard.isFight = 1;
        int fightCount = UtilTools.IntParse(panel.cardCount.text.Split('/')[0]) + 1;

        panel.cardCount.text = string.Format("{0}/{1}", fightCount, cardInfoList.cardList.Count);
        panel.fightGrid.UpdateCustomData(info);
        panel.cardGrid.UpdateCustomData(drapCard);
        HeroTeamMediator.heroTeamMediator.panel.cardGrid.UpdateCustomData(HeroTeamMediator.heroTeamMediator.dropInfo);
    }
예제 #18
0
    /// <summary>移动目标</summary>
    /// <param name="posId"></param>
    /// <param name="addPos">移动方向(+1后退-1前进)</param>
    public void SendMove(int posId, int addPos)
    {
        if (PVPManager.Instance.InPlayMainAnimation())
        {
            return;
        }

        UseMsg msg = new UseMsg();

        msg.index  = posId;
        msg.type   = UseType.MoveType;
        msg.target = addPos;

        NSocket.GetInstance().SendData(Request.UseReq, msg);
    }
예제 #19
0
    /// <summary>使用卡牌 </summary>
    /// <param name="index">卡牌序列号</param>
    /// <param name="type"></param>
    /// <param name="target">目标id(对人使用传站位pos对卡牌使用传卡牌序列号index)</param>
    public void SendUseCard(int index, UseType type, int target)
    {
        if (PVPManager.Instance.InPlayMainAnimation())
        {
            return;
        }

        UseMsg msg = new UseMsg();

        msg.index  = index;
        msg.type   = type;
        msg.target = target;

        NSocket.GetInstance().SendData(Request.UseReq, msg);
    }
예제 #20
0
    // Use this for initialization
    void Start()
    {
        Screen.orientation = ScreenOrientation.AutoRotation;
        Screen.autorotateToLandscapeLeft      = true;
        Screen.autorotateToLandscapeRight     = true;
        Screen.autorotateToPortrait           = false;
        Screen.autorotateToPortraitUpsideDown = false;
        Time.timeScale = 1f;

        Application.runInBackground = true;

        DontDestroyOnLoad(gameObject);

        //if (null == m_demo)
        //m_demo = gameObject.AddComponent<BuglyCrash>();

        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        Ins = this;
        //启动MVC
        GameFacade.Instance().Startup();

        GetUIRoot();
        Transform root3 = UIRoot3D;

        //初始化资源管理器
        ResourceManager.Instance.Init(ResourceManagerInitComplete);
        //初始化各种SDK

        //设置全局对象池
        PoolManager.Init();
        m_defaultsprite = Resources.Load <Sprite>("notfount");

        Application.targetFrameRate = Define.GameFrameRate;

        NSocket.GetInstance().SetIpAddress("47.96.5.212", 12345);
        //NSocket.GetInstance().SetIpAddress("192.168.2.55", 12345);
        //NSocket.GetInstance().SetIpAddress("192.168.2.144", 12345);
        //NSocket.GetInstance().SetIpAddress("192.168.2.127", 12345);
        //NSocket.GetInstance().SetIpAddress("47.96.5.212",12345);
        NSocket.GetInstance().ConnectServer();
        NetDataMgr.Instance.Init();

        PanelManager pm = PanelManager.Instance;

        Debug.Log("程序集版本:" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
    }
예제 #21
0
 private void OnClick(GameObject go)
 {
     if (go == commonBtn.gameObject)
     {
         CardTeamInfo info = new CardTeamInfo
         {
             id   = HeroTeamMediator.heroTeamMediator.heroListMsg.id,
             name = heroTeamName.label.text,
         };
         NSocket.GetInstance().SendData(Request.ChangeTeamName, info);
         Main.blurCamera.gameObject.SetActive(false);
         Main.CameraUI.GetComponent <Blur>().enabled = false;
         MonoBehaviour.DestroyImmediate(this.gameObject);
     }
     else if (go == cancelBtn.gameObject)
     {
         Main.blurCamera.gameObject.SetActive(true);
         Main.CameraUI.GetComponent <Blur>().enabled = false;
         MonoBehaviour.DestroyImmediate(this.gameObject);
     }
 }
예제 #22
0
 /// <summary>
 /// 点击事件
 /// </summary>
 private void OnClick(GameObject go)
 {
     if (go == panel.pveBtn.gameObject)
     {
         FightProxy.Instance.SendMatchFight(PlayerProxy.Instance.Info.selectTeamId);
     }
     else if (go == panel.pvpBtn.gameObject)
     {
         // 选择默认小队
         NSocket.GetInstance().SendData(Request.CardAssemblyList);
         //SendNotification(NotificationID.ChooseCardOpen);
     }
     else if (go == panel.pvpInBtn.gameObject)
     {
         if (Define.VSTest)
         {
             SendNotification(NotificationID.VSLoadingOpen);
         }
     }
     else
     {
     }
 }
예제 #23
0
 /// <summary>
 /// 点击事件
 /// </summary>
 private void OnClick(GameObject go)
 {
     if (go == panel.backBtn.gameObject)
     {
         ClosePanel(null);
     }
     else if (go == panel.createTeamBtn.gameObject)
     {
         GUIManager.ShowPromptPanel(TextManager.GetUIString("UI1032"), "", PromtType.CreateTeam, null, CeateTeam, CopyTeam);
     }
     else if (go == panel.changeNameBtn.gameObject)
     {
         ResourceManager.Instance.LoadPrefab("changeteamnamepanel", ChangeTeamNamePanelComplete, LoadFail);
     }
     else if (go == panel.showTeamUIBtn.gameObject)
     {
         NSocket.GetInstance().SendData(Request.TeamListReq);
     }
     else if (go == panel.reset.gameObject)
     {
         GUIManager.ShowPromptPanel(TextManager.GetUIString("UI1012"), TextManager.GetUIString("UI1031"), PromtType.Normal, ResetTeam, null, null);
     }
 }
예제 #24
0
 void Destroy()
 {
     NSocket.GetInstance().Destroy();
 }
예제 #25
0
 void FixedUpdate()
 {
     NSocket.GetInstance().Update();
 }
예제 #26
0
    void Update()
    {
        if (null == m_netHelp)
        {
            m_netHelp = Instance.Get <NetHelper>();
        }

        Define.VSTest = Test;
        //if (Input.GetKey(KeyCode.F1))
        //{
        //    PureMVC.Patterns.Facade.Instance.SendNotification(NotificationID.Hide_Main);
        //    PureMVC.Patterns.Facade.Instance.SendNotification(NotificationID.CHANGE_SCENE, new SceneVO("s_match1", "s_match1", false, EScene.PVE));
        //}
        //else if(Input.GetKey(KeyCode.F2))
        //{
        //    GUIManager.CloseAllUI();
        //    UnityEngine.SceneManagement.SceneManager.LoadScene("S_ShootTest");
        //}
        //else if(Input.GetKey(KeyCode.A) && !Define.WaiWangDebug)
        //{
        //    SandTableMediator.IsEdit = true;
        //    PureMVC.Patterns.Facade.Instance.SendNotification(NotificationID.SandTable_Show);
        //}
        //else if (Input.GetKey(KeyCode.F))
        //{
        //    PureMVC.Patterns.Facade.Instance.SendNotification(NotificationID.SandTable_Show);
        //}

        //当网络不可用时
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            //GUIManager.BrokenNetWork();
            Debug.LogError("Not Have Net!");
        }

        if (null != NoNetLab)
        {
            NoNetLab.gameObject.SetActive(!NSocket.GetInstance().IsConnected());
        }

        //当用户使用WiFi时
        else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
        {
            //if (GUIManager.CurrentNetState != NetState.Wifi && GUIManager.IsConnect)
            //{
            //    TimerManager.Destroy("reloginApp");
            //}

            //GUIManager.CurrentNetState = NetState.Wifi;
        }

        //当用户使用移动网络时
        else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
        {
            //if (GUIManager.CurrentNetState != NetState.Phone && GUIManager.IsConnect)
            //{
            //    TimerManager.Destroy("reloginApp");
            //}

            //GUIManager.CurrentNetState = NetState.Phone;
        }
    }
예제 #27
0
 /// <summary>
 /// 创建英雄卡组
 /// </summary>
 /// <param name="go"></param>
 void CreateCardTeam(GameObject go)
 {
     dropInfo = go.GetComponentInParent <UIGridItem>().oData as HeroInfo;
     NSocket.GetInstance().SendData(Request.HeroListReq);
 }
예제 #28
0
    /// <summary>
    /// 上阵英雄
    /// </summary>
    public void SetHeroFight(int fightIndex, int index)
    {
        HeroInfo info      = panel.heroGrid.GetCustomDataItem(index) as HeroInfo;
        HeroInfo downInfo  = panel.cardGrid.GetCustomDataItem(fightIndex) as HeroInfo;
        int      replaceId = 0;

        replaceId = info.heroUUId;
        bool haveFight = false;

        for (int i = 0; i < panel.heroGrid.mDataSource.Count; ++i)
        {
            if ((panel.heroGrid.GetCustomDataItem(i) as HeroInfo).configId == downInfo.configId)
            {
                if (index == i)
                {
                    continue;
                }
                haveFight = true;
                break;
            }
        }
        if (haveFight || downInfo.pos > 0)
        {
            Debug.LogError("已经存在");
            panel.cardGrid.UpdateCustomData(downInfo);
            return;
        }
        TD_Hero hero = HeroConfig.GetItem(downInfo.configId);

        if (downInfo.skillID.Count < hero.deck_build || downInfo.arcaneId == 0)
        {
            Debug.LogError("技能没有全或者奥义没有选奥义");
            panel.cardGrid.UpdateCustomData(downInfo);
            return;
        }
        if (info.heroUUId != 0)
        {
            HeroInfo infos = null;
            for (int i = 0; i < panel.cardGrid.mDataSource.Count; ++i)
            {
                infos = panel.cardGrid.GetCustomDataItem(i) as HeroInfo;
                if (infos.heroUUId == info.heroUUId)
                {
                    infos.pos = 0;
                    panel.cardGrid.UpdateCustomData(infos);
                    break;
                }
            }
        }
        info.heroUUId     = downInfo.heroUUId;
        info.configId     = downInfo.configId;
        info.cardTeamName = downInfo.cardTeamName;
        panel.heroGrid.UpdateCustomData(info);
        downInfo.pos = index + 1;
        panel.cardGrid.UpdateCustomData(downInfo);
        HeroOnFightMsg msg = new HeroOnFightMsg
        {
            teamId    = heroListMsg.id,
            heroId    = downInfo.heroUUId,
            replaceId = replaceId,
            pos       = downInfo.pos,
        };

        NSocket.GetInstance().SendData(Request.HeroOnFight, msg);
    }