Пример #1
0
        protected virtual void HandleClientCmd(FSPPlayer player, FSPMessage msg)
        {
            uint playerId = player.id;

            //处理鉴权
            if (!player.HasAuthed)
            {
                if (msg.cmd == FSPBasicCmd.AUTH)
                {
                    player.SetAuth(msg.args[0]);
                }
                else
                {
                    Debuger.LogWarning("当前Player未鉴权,无法处理该Cmd:{0}", msg.cmd);
                }
                return;
            }

            switch (msg.cmd)
            {
            case FSPBasicCmd.GAME_BEGIN:
            {
                Debuger.Log("GAME_BEGIN, playerId = {0}, cmd = {1}", playerId, msg);
                SetFlag(playerId, ref m_GameBeginFlag, "m_GameBeginFlag");
                break;
            }

            case FSPBasicCmd.ROUND_BEGIN:
            {
                Debuger.Log("ROUND_BEGIN, playerId = {0}, cmd = {1}", playerId, msg);
                SetFlag(playerId, ref m_RoundBeginFlag, "m_RoundBeginFlag");
                break;
            }

            case FSPBasicCmd.CONTROL_START:
            {
                Debuger.Log("CONTROL_START, playerId = {0}, cmd = {1}", playerId, msg);
                SetFlag(playerId, ref m_ControlStartFlag, "m_ControlStartFlag");
                break;
            }

            case FSPBasicCmd.ROUND_END:
            {
                Debuger.Log("ROUND_END, playerId = {0}, cmd = {1}", playerId, msg);
                SetFlag(playerId, ref m_RoundEndFlag, "m_RoundEndFlag");
                break;
            }

            case FSPBasicCmd.GAME_END:
            {
                Debuger.Log("GAME_END, playerId = {0}, cmd = {1}", playerId, msg);
                SetFlag(playerId, ref m_GameEndFlag, "m_GameEndFlag");
                break;
            }

            case FSPBasicCmd.GAME_EXIT:
            {
                Debuger.Log("GAME_EXIT, playerId = {0}, cmd = {1}", playerId, msg);
                HandleGameExit(playerId, msg);
                break;
            }

            default:
            {
                Debuger.Log("playerId = {0}, cmd = {1}", playerId, msg);
                AddCmdToCurrentFrame(playerId, msg);
                break;
            }
            }
        }
Пример #2
0
 public void SendGameBegin()
 {
     Debuger.Log();
     SendFSP(FSPBasicCmd.GAME_BEGIN, 0);
 }
Пример #3
0
 public void SendControlStart()
 {
     Debuger.Log();
     SendFSP(FSPBasicCmd.CONTROL_START, 0);
 }
Пример #4
0
        public static IPEndPoint GetHostEndPoint(string host, int port)
        {
            IPAddress address = null;

            if (IPAddress.TryParse(host, out address))
            {
#if TestIPv6
                Debuger.Log("UdpSocket.GetHostEndPoint() TestIPv6: 如果已经是IP了,则封装成IPv6格式");
                //已经是一个IP了。在外网下不应该出现IP的情况
                if (!address.IsIPv6LinkLocal && !address.IsIPv6SiteLocal)
                {
                    string    tmp     = "64:ff9b::" + address.ToString();
                    IPAddress addr_v6 = null;
                    if (IPAddress.TryParse(tmp, out addr_v6))
                    {
                        return(new IPEndPoint(addr_v6, port));
                    }
                    else
                    {
                        Debuger.LogError("UdpSocket.GetHostEndPoint() TestIPv6,封装IPv6失败:" + tmp);
                    }
                }
#endif
                return(new IPEndPoint(address, port));
            }
            else
            {
                //如果不是IP,就当作域名来处理
                IPAddress[] ips = Dns.GetHostAddresses(host);
                //如果是IPv6环境,则会返回IPv6的地址,否则会返回IPv4的地址。

                if (Debuger.EnableLog)
                {
                    Debuger.Log("UdpSocket.GetHostEndPoint() Dns GetHostAddresses:");
                    for (int i = 0; i < ips.Length; i++)
                    {
                        Debuger.Log("[" + i + "] " + ips[i] + ", " + ips[i].AddressFamily);
                    }
                }


                List <IPAddress> listIPv4 = new List <IPAddress>();
                List <IPAddress> listIPv6 = new List <IPAddress>();

                for (int i = 0; i < ips.Length; i++)
                {
                    if (ips[i].AddressFamily == AddressFamily.InterNetwork)
                    {
                        listIPv4.Add(ips[i]);
                    }
                    else
                    {
                        listIPv6.Add(ips[i]);
                    }
                }


#if UNITY_ANDROID
                if (listIPv4.Count > 0)
                {
                    return(new IPEndPoint(listIPv4[0], port));
                }

                if (listIPv6.Count > 0)
                {
                    return(new IPEndPoint(listIPv6[0], port));
                }
#else
                //加一个静态变量开关,方便以后用Lua设置
                if (IOS_IPv6_First)
                {
                    //IPv6优先
                    if (listIPv6.Count > 0)
                    {
                        return(new IPEndPoint(listIPv6[0], port));
                    }

                    if (listIPv4.Count > 0)
                    {
                        return(new IPEndPoint(listIPv4[0], port));
                    }
                }
                else
                {
                    //IPv4优先
                    if (listIPv4.Count > 0)
                    {
                        return(new IPEndPoint(listIPv4[0], port));
                    }

                    if (listIPv6.Count > 0)
                    {
                        return(new IPEndPoint(listIPv6[0], port));
                    }
                }
#endif
            }

            return(null);
        }
Пример #5
0
 public void Initialize()
 {
     Debuger.Log("Script initialize finished");
 }
Пример #6
0
 public static void Log(string str)
 {
     Debuger.Log(str);
 }
Пример #7
0
 void SetEvent()
 {
     mToggle_Mount.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_Mount.value)
         {
             OpenUI(UI_Panel_Mount.gameObject);
             //mLabel_Title.text = Localization.Get("WaiGuan_Mount");
         }
     }));
     mToggle_Pet.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_Pet.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Pet");
             if (SystemFunctionData.GetSingleton().GetSystemInfoBool(SystemID.WaiGuan_Pet))
             {
                 OpenUI(UI_Panel_Pet.gameObject);
             }
             else
             {
                 QiuMo.Systemfuciton tmpSystemfuciton = QiuMo.LocalTypeSystemfuction.GetSingleton().GetSystemfuciton((int)SystemID.WaiGuan_Pet);
                 if (tmpSystemfuciton != null)
                 {
                     WindowManager.GetSingleton().OpenFlyUpFont(tmpSystemfuciton.mDescribe);
                 }
             }
         }
     }));
     mToggle_Wing.onChange.Add(new EventDelegate(delegate()
     {
         if (Debuger.EnableLog)
         {
             Debuger.Log(mToggle_Wing.name + mToggle_Wing.value + "---------------5----------------");
         }
         if (mToggle_Wing.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Wing");
             OpenUI(UI_Wings.gameObject);
         }
     }));
     mToggle_Title.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_Title.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Title");
             OpenUI(UI_Title.gameObject);
         }
     }));
     mToggle_FaQi.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_FaQi.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_FaQi");
             OpenUI(UI_FaBao.gameObject);
         }
     }));
     //mButton_FaQi.onClick.Add(new EventDelegate(delegate ()
     //{
     //    if (PlayerManager.GetSingleton().PlayerFullRoleInfoSelf.zhuansheng < 1 || PlayerManager.GetSingleton().PlayerFullRoleInfoSelf.level < 50)
     //    {
     //        WindowManager.GetSingleton().OpenFlyUpFont(Localization.Get("WaiGuan_FaQiWeiJieSuo"));
     //    }
     //    else
     //    {
     //        mToggle_FaQi.enabled = true;
     //        mToggle_FaQi.value = true;
     //    }
     //}));
     mToggle_LingQi.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_LingQi.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_LingQi");
             OpenUI(UI_XianQi.gameObject);
         }
     }));
     mToggle_ZuJi.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_ZuJi.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_ZuJi");
             OpenUI(UI_ZuJi.gameObject);
         }
     }));
     mToggle_WaiGuan.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_WaiGuan.value)
         {
             Panel_WaiGuan.gameObject.SetActive(true);
             if (IsFrist && mSystemID != SystemID.None)
             {
                 //StartCoroutine(StartUI(mSystemID));
                 new CoroutineTask(StartUI(mSystemID));
             }
             else
             {
                 //StartCoroutine(StartUI(mSystemID2));
                 new CoroutineTask(StartUI(mSystemID2));
             }
         }
         else
         {
             Panel_WaiGuan.gameObject.SetActive(false);
         }
     }));
     mToggle_HuanHua.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_HuanHua.value)
         {
             Panel_HuanHua.gameObject.SetActive(true);
             if (IsFrist && mSystemID != SystemID.None)
             {
                 //StartCoroutine(StartUI(mSystemID));
                 new CoroutineTask(StartUI(mSystemID));
             }
             else
             {
                 //StartCoroutine(StartUI(SystemID.WaiGuan_HuanHua_ShiZhuang));
                 new CoroutineTask(StartUI(SystemID.WaiGuan_HuanHua_ShiZhuang));
             }
         }
         else
         {
             Panel_HuanHua.gameObject.SetActive(false);
         }
     }));
     mClose.onClick.Add(new EventDelegate(delegate()
     {
         WindowManager.GetSingleton().CloseWindow(UIPath.UI_WaiGuan_Path);
     }));
     mToggle_Clothes.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_Clothes.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Clothes");
             OpenUI(UI_ClothesFashion.gameObject);
         }
     }));
     mToggle_Mount_HuanHua.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_Mount_HuanHua.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Mount_HuanHua");
             OpenUI(UI_FantasticChange.gameObject);
         }
     }));
     mToggle_Wuqi_HuanHua.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_Wuqi_HuanHua.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Wuqi_HuanHua");
             OpenUI(UI_WeaponFashion.gameObject);
         }
     }));
     mToggle_LingQi_HuanHua.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_LingQi_HuanHua.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Wuqi_HuanHua");
             OpenUI(UI_XianQiFashion.gameObject);
         }
     }));
     mToggle_ZuJi_HuanHua.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_ZuJi_HuanHua.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Wuqi_HuanHua");
             OpenUI(UI_FootPrintFashion.gameObject);
         }
     }));
     mToggle_Wing_HuanHua.onChange.Add(new EventDelegate(delegate()
     {
         if (mToggle_Wing_HuanHua.value)
         {
             //mLabel_Title.text = Localization.Get("WaiGuan_Wuqi_HuanHua");
             OpenUI(UI_WingsFashion.gameObject);
         }
     }));
     mScrollBar_Toggle_WaiGuan.onChange.Add(new EventDelegate(() =>
     {
         if (mScrollBar_Toggle_WaiGuan.value < 0.1f)
         {
             mButton_Up_WaiGuan.gameObject.SetActive(false);
         }
         else
         {
             mButton_Up_WaiGuan.gameObject.SetActive(true);
         }
         if (mScrollBar_Toggle_WaiGuan.value > 0.9f)
         {
             mButton_Down_WaiGuan.gameObject.SetActive(false);
         }
         else
         {
             mButton_Down_WaiGuan.gameObject.SetActive(true);
         }
     }));
     mScrollBar_Toggle_HuanHua.onChange.Add(new EventDelegate(() =>
     {
         if (mScrollBar_Toggle_HuanHua.value < 0.1f)
         {
             mButton_Up_HuanHua.gameObject.SetActive(false);
         }
         else
         {
             mButton_Up_HuanHua.gameObject.SetActive(true);
         }
         if (mScrollBar_Toggle_HuanHua.value > 0.9f)
         {
             mButton_Down_HuanHua.gameObject.SetActive(false);
         }
         else
         {
             mButton_Down_HuanHua.gameObject.SetActive(true);
         }
     }));
 }
Пример #8
0
 //---------------------------------------------------------------------------------------------------------//
 public static void Log(string log)
 {
     Debuger.Log(log);
 }
Пример #9
0
        //---------------------------------------------------------

        /// <summary>
        /// 处理来自客户端的 Cmd
        /// 对其中的关键VKey进行处理
        /// 并且收集业务VKey
        /// </summary>
        /// <param name="player"></param>
        /// <param name="cmd"></param>
        protected virtual void HandleClientCmd(FSPPlayer player, FSPVKey cmd)
        {
            uint playerId = player.Id;

            //处理鉴权
            if (!player.HasAuth)
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() hasAuth = false! Wait AUTH!");
                if (cmd.vkey == FSPVKeyBase.AUTH)
                {
                    Debuger.Log(LOG_TAG, "HandleClientCmd() AUTH, playerId={0}", playerId);
                    player.SetAuth(cmd.args[0]);
                }
                return;
            }


            switch (cmd.vkey)
            {
            case FSPVKeyBase.GAME_BEGIN:
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() GAME_BEGIN, playerId = {0}, cmd = {1}", playerId, cmd);
                SetFlag(playerId, ref m_GameBeginFlag, "m_GameBeginFlag");
                break;
            }

            case FSPVKeyBase.ROUND_BEGIN:
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() ROUND_BEGIN, playerId = {0}, cmd = {1}", playerId, cmd);
                SetFlag(playerId, ref m_RoundBeginFlag, "m_RoundBeginFlag");
                break;
            }

            case FSPVKeyBase.CONTROL_START:
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() CONTROL_START, playerId = {0}, cmd = {1}", playerId, cmd);
                SetFlag(playerId, ref m_ControlStartFlag, "m_ControlStartFlag");
                break;
            }

            case FSPVKeyBase.ROUND_END:
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() ROUND_END, playerId = {0}, cmd = {1}", playerId, cmd);
                SetFlag(playerId, ref m_RoundEndFlag, "m_RoundEndFlag");
                break;
            }

            case FSPVKeyBase.GAME_END:
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() GAME_END, playerId = {0}, cmd = {1}", playerId, cmd);
                SetFlag(playerId, ref m_GameEndFlag, "m_GameEndFlag");
                break;
            }

            case FSPVKeyBase.GAME_EXIT:
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() GAME_EXIT, playerId = {0}, cmd = {1}", playerId, cmd);
                HandleGameExit(playerId, cmd);
                break;
            }

            default:
            {
                Debuger.Log(LOG_TAG, "HandleClientCmd() playerId = {0}, cmd = {1}", playerId, cmd);
                AddCmdToCurrentFrame(playerId, cmd);
                break;
            }
            }
        }
Пример #10
0
 static public void Log(string str, string color)
 {
     str = String.Format("<color=#{0}> {1} </color>", color, str);
     Debuger.Log(str);
 }
Пример #11
0
 static public void LogFormat(string str, params object[] args)
 {
     Debuger.Log(string.Format(str, args));
 }
Пример #12
0
        protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null)
        {
            // Check the window control state
            if (!this.IsWindowInControl(id))
            {
                Debuger.Log("## UIManager has no control power of " + id.ToString());
                return(null);
            }

            // If the window in shown list just return
            if (dicShownWindows.ContainsKey((int)id))
            {
                return(null);
            }

            UIBaseWindow baseWindow = GetGameWindow(id);

            // If window not in scene start Instantiate new window to scene
            bool newAdded = false;

            if (!baseWindow)
            {
                newAdded = true;
                if (UIResourceDefine.windowPrefabPath.ContainsKey((int)id))
                {
                    string     prefabPath = UIResourceDefine.UIPrefabPath + UIResourceDefine.windowPrefabPath[(int)id];
                    GameObject prefab     = Resources.Load <GameObject>(prefabPath);
                    if (prefab != null)
                    {
                        GameObject uiObject = (GameObject)GameObject.Instantiate(prefab);
                        NGUITools.SetActive(uiObject, true);
                        // NOTE: You can add component to the window in the inspector
                        // Or just AddComponent<UIxxxxWindow>() to the target
                        baseWindow = uiObject.GetComponent <UIBaseWindow>();
                        if (baseWindow.ID != id)
                        {
                            Debuger.LogError(string.Format("<color=cyan>[BaseWindowId :{0} != shownWindowId :{1}]</color>", baseWindow.ID, id));
                            return(null);
                        }
                        // Get the window target root parent
                        Transform targetRoot = GetTargetRoot(baseWindow.windowData.windowType);
                        GameUtility.AddChildToTarget(targetRoot, baseWindow.gameObject.transform);
                        dicAllWindows[(int)id] = baseWindow;
                    }
                }
            }

            if (baseWindow == null)
            {
                Debuger.LogError("[window instance is null.]" + id.ToString());
            }

            // Call reset window when first load new window
            // Or get forceResetWindow param
            if (newAdded || (showData != null && showData.forceResetWindow))
            {
                baseWindow.ResetWindow();
            }

            if (showData == null || (showData != null && showData.executeNavLogic))
            {
                // refresh the navigation data
                ExecuteNavigationLogic(baseWindow, showData);
            }

            // Adjust the window depth
            AdjustBaseWindowDepth(baseWindow);

            // Add common background collider to window
            AddColliderBgForWindow(baseWindow);
            return(baseWindow);
        }
Пример #13
0
        //====================================================================


        public void ClearRound()
        {
            Debuger.Log();
            m_FrameCache.Clear();
            m_LastAddFrameId = 0;
        }
Пример #14
0
        //====================================================================
        //鉴权相关逻辑

        public void SetAuth(int authId)
        {
            Debuger.Log(authId);
            //这里暂时不做真正的鉴权,只是让流程完整
            m_hasAuthed = m_authId == authId;
        }
Пример #15
0
 public void SetReceiveListener(Action <FSPDataC2S> listener)
 {
     Debuger.Log();
     m_listener = listener;
 }
Пример #16
0
        //--------------------------------------------------------------------
        #region Player 状态标志工具函数

        private void SetFlag(uint playerId, ref int flag, string flagname)
        {
            flag |= (0x01 << ((int)playerId - 1));
            Debuger.Log(LOG_TAG, "SetFlag() player = {0}, flag = {1}", playerId, flagname);
        }
Пример #17
0
        public string ResolveName(string guid)
        {
            if (!this.objects.ContainsKey(guid))
            {
                Debuger.LogWarning(this + " ResolveName could not resolve " + guid);
                return(string.Empty);                //"UNRESOLVED GUID:" + guid;
            }

            object entity = this.objects[guid];

            if (entity is PBXBuildFile)
            {
                return(ResolveName(((PBXBuildFile)entity).fileRef));
            }
            else if (entity is PBXFileReference)
            {
                PBXFileReference casted = (PBXFileReference)entity;
                return(casted.name != null ? casted.name : casted.path);
            }
            else if (entity is PBXGroup)
            {
                PBXGroup casted = (PBXGroup)entity;
                return(casted.name != null ? casted.name : casted.path);
            }
            else if (entity is PBXProject || guid == this.rootObject)
            {
                return("Project object");
            }
            else if (entity is PBXFrameworksBuildPhase)
            {
                return("Frameworks");
            }
            else if (entity is PBXResourcesBuildPhase)
            {
                return("Resources");
            }
            else if (entity is PBXShellScriptBuildPhase)
            {
                return("ShellScript");
            }
            else if (entity is PBXSourcesBuildPhase)
            {
                return("Sources");
            }
            else if (entity is PBXCopyFilesBuildPhase)
            {
                return("CopyFiles");
            }
            else if (entity is XCConfigurationList)
            {
                XCConfigurationList casted = (XCConfigurationList)entity;
                //Debuger.LogWarning ("XCConfigurationList " + guid + " " + casted.ToString());

                if (casted.data.ContainsKey("defaultConfigurationName"))
                {
                    //Debuger.Log ("XCConfigurationList " + (string)casted.data[ "defaultConfigurationName" ] + " " + guid);
                    return((string)casted.data["defaultConfigurationName"]);
                }

                return(null);
            }
            else if (entity is PBXNativeTarget)
            {
                PBXNativeTarget obj = (PBXNativeTarget)entity;
                //Debuger.LogWarning ("PBXNativeTarget " + guid + " " + obj.ToString());

                if (obj.data.ContainsKey("name"))
                {
                    //Debuger.Log ("PBXNativeTarget " + (string)obj.data[ "name" ] + " " + guid);
                    return((string)obj.data["name"]);
                }

                return(null);
            }
            else if (entity is XCBuildConfiguration)
            {
                XCBuildConfiguration obj = (XCBuildConfiguration)entity;
                //Debuger.LogWarning ("XCBuildConfiguration UNRESOLVED GUID:" + guid + " " + (obj==null?"":obj.ToString()));

                if (obj.data.ContainsKey("name"))
                {
                    //Debuger.Log ("XCBuildConfiguration " + (string)obj.data[ "name" ] + " " + guid + " " + (obj==null?"":obj.ToString()));
                    return((string)obj.data["name"]);
                }
            }
            else if (entity is PBXObject)
            {
                PBXObject obj = (PBXObject)entity;

                if (obj.data.ContainsKey("name"))
                {
                    Debuger.Log("PBXObject " + (string)obj.data["name"] + " " + guid + " " + (obj == null?"":obj.ToString()));
                }
                return((string)obj.data["name"]);
            }

            //return "UNRESOLVED GUID:" + guid;
            Debuger.LogWarning("UNRESOLVED GUID:" + guid);
            return(null);
        }
Пример #18
0
 public void Clean()
 {
     Debuger.Log();
     m_mapGame.Clear();
 }
Пример #19
0
    IEnumerator DownUserInfo(string Token, string TimeChuo, string userid)
    {
        WWW www = new WWW("http://" + GameManage.GetInstan.IPAdress + ":8080/csmj/user/info?uid=" + userid +
                          "&timestamp=" + TimeChuo +
                          "&token=" + Token);

        yield return(www);

        if (www.error != null)
        {
            Debuger.Log("获取个人信息失败" + www.error);
            yield break;
        }
        Debuger.Log(www.text);
        Dictionary <string, object> Dic = Json.Deserialize(www.text) as Dictionary <string, object>;

        if (((int)Dic["ret"]) != 0)
        {
            Debuger.Log("获取个人信息出错");
            yield break;
        }
        if (!Dic.ContainsKey("data"))
        {
            yield break;
        }
        Dictionary <string, object> data = Dic["data"] as Dictionary <string, object>;

        if (data.ContainsKey("nickname"))
        {
            GameManage.GetInstan.Nick = data["nickname"] as string;
            Nick.text = GameManage.GetInstan.Nick;
        }
        if (data.ContainsKey("gender"))
        {
            int sx = (int)data["gender"];
            GameManage.GetInstan.Sex = sx == 2 ? 0 : 1;
        }
        string strHttpImag = "";

        if (data.ContainsKey("headImg"))
        {
            strHttpImag = data["headImg"] as string;
        }
        Debuger.Log("TOUXIANGDIZHI" + strHttpImag);
        if (strHttpImag == "")
        {
            Debuger.Log("没头像");
            yield break;
        }
        if (data.ContainsKey("cards"))
        {
            FangKaShu.text = ((int)data["cards"]).ToString();
        }

        if (GameManage.GetInstan.DicTX.ContainsKey(strHttpImag))
        {
            TouXiang.sprite = GameManage.GetInstan.DicTX[strHttpImag];
        }
        else
        {
            WWW downLoadHead = new WWW(strHttpImag);
            yield return(downLoadHead);

            GameManage.GetInstan.DicTX.Add(strHttpImag, Sprite.Create(downLoadHead.texture, new Rect(0, 0, downLoadHead.texture.width, downLoadHead.texture.height), new Vector2(0.5f, 0.5f)));
            GameManage.GetInstan.TouXiang = GameManage.GetInstan.DicTX[strHttpImag];
            TouXiang.sprite = GameManage.GetInstan.DicTX[strHttpImag];
        }
    }
Пример #20
0
 //=======================================================================
 //设置FSP参数
 public void SetFrameInterval(int serverFrameInterval, int clientFrameRateMultiple) //MS
 {
     Debuger.Log("serverFrameInterval:{0}, clientFrameRateMultiple:{1}", serverFrameInterval, clientFrameRateMultiple);
     m_param.serverFrameInterval     = serverFrameInterval;
     m_param.clientFrameRateMultiple = clientFrameRateMultiple;
 }
Пример #21
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        if (Debuger.EnableLog)
        {
            Debuger.Log(mToggle_Wing.name + mToggle_Wing.value + "---------------2----------------");
        }
        if (Helper.SetToggleState(SystemID.WaiGuan_Pet, mToggle_Pet.gameObject))
        {
            mSystemID2 = SystemID.WaiGuan_Pet;
        }
        if (Helper.SetToggleState(SystemID.WaiGuan_WaiGuan_Mount, mToggle_Mount.gameObject))
        {
            mSystemID2 = SystemID.WaiGuan_WaiGuan_Mount;
        }
        //Helper.SetToggleState(SystemID.WaiGuan_Wing, mToggle_Wing.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_ChengHao, mToggle_Title.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_FaBao, mToggle_FaQi.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_WaiGuan_LingQi, mToggle_LingQi.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_WaiGuan_ZuJi, mToggle_ZuJi.gameObject);
        Helper.SetToggleState(SystemID.WaiGuan_HuanHua, mToggle_HuanHua.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_HuanHua_ShiZhuang, mToggle_Clothes.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_HuanHua_Equip, mToggle_Wuqi_HuanHua.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_HuanHua_Mount, mToggle_Mount_HuanHua.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_HuanHua_LingQi, mToggle_LingQi_HuanHua.gameObject);
        //Helper.SetToggleState(SystemID.WaiGuan_HuanHua_ZuJi, mToggle_ZuJi_HuanHua.gameObject);


        int tempToggleNum = 0;

        GetToggleNum(SystemID.WaiGuan_Pet, mToggle_Pet.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_WaiGuan_Mount, mToggle_Mount.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_Wing, mToggle_Wing.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_ChengHao, mToggle_Title.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_FaBao, mToggle_FaQi.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_WaiGuan_LingQi, mToggle_LingQi.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_WaiGuan_ZuJi, mToggle_ZuJi.gameObject, ref tempToggleNum);

        mWaiGuanMoreTran.transform.localScale = tempToggleNum > 4 ? Vector3.one : Vector3.zero;

        tempToggleNum = 0;
        GetToggleNum(SystemID.WaiGuan_HuanHua_ShiZhuang, mToggle_Clothes.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_HuanHua_Equip, mToggle_Wuqi_HuanHua.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_HuanHua_Mount, mToggle_Mount_HuanHua.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_HuanHua_LingQi, mToggle_LingQi_HuanHua.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_HuanHua_ZuJi, mToggle_ZuJi_HuanHua.gameObject, ref tempToggleNum);
        GetToggleNum(SystemID.WaiGuan_HuanHua_Wings, mToggle_Wing_HuanHua.gameObject, ref tempToggleNum);

        mHuanHuaMoreTran.transform.localScale = tempToggleNum > 4 ? Vector3.one : Vector3.zero;


        mGrid_WaiGuan_Toggle.enabled = true;
        mGrid_HuanHua_Toggle.enabled = true;
        if (mSystemID == SystemID.None)
        {
            mToggle_WaiGuan.value = true;
        }
        else
        {
            if ((int)mSystemID / 1000000 == 132)
            {
                mToggle_HuanHua.value = true;
            }
            else
            {
                mToggle_WaiGuan.value = true;
            }
        }
        //mToggle_LingQi.gameObject.SetActive(false);

        ShowGuide();
    }
Пример #22
0
    /// <summary>
    /// 加载csv为obj实例
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="csvFileName"></param>
    private static void LoadCsv <T>(string csvFileName) where T : CsvBase
    {
        Debuger.Log("Parse file... : " + csvFileName);

        Type _type = typeof(T);

        // 创建字典
        IDictionary innerDic = null;

        if (!dic.TryGetValue(_type, out innerDic))
        {
            innerDic = new Dictionary <int, T>();
            dic.Add(_type, innerDic);
        }
        else
        {
            Debuger.Log("csv repeate ! type = " + _type.Name + " csv file = " + csvFileName);
            return;
        }

        FileInfo csvFile = new FileInfo(csvFolder + "\\" + csvFileName);

        // 读取
        List <string> csvList = new List <string>();

        using (StreamReader sr = new StreamReader(csvFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
        {
            while (sr.Peek() > 0)
            {
                csvList.Add(sr.ReadLine());
            }
        }

        // 匹配字段顺序
        string[]    keyList    = csvList[2].Split(',');
        FieldInfo[] fieldInfos = new FieldInfo[keyList.Length];
        for (int i = 0; i < fieldInfos.Length; i++)
        {
            fieldInfos[i] = _type.GetField(keyList[i]);
        }

        // 生成实例
        for (int i = 3; i < csvList.Count; i++)
        {
            string[] fileValues = csvList[i].Split(',');

            T obj = Activator.CreateInstance <T>();
            obj.ID = int.Parse(fileValues[0]);

            for (int j = 1; j < fieldInfos.Length; j++)
            {
                SetField(fieldInfos[j], obj, fileValues[j]);
            }

            if (innerDic.Contains(obj.ID))
            {
                Debuger.Log("配置表ID重复! csv文件:" + csvFileName + " ID : " + obj.ID);
            }

            innerDic.Add(obj.ID, obj);
        }
    }
Пример #23
0
 private void ResetUserTalent()
 {
     AdaptiveDifficultyManager.Instance.ResetUserTalentToDefault();
     Debuger.Log("reset user talent");
 }
Пример #24
0
 void OnEquipHeadClicked()
 {
     Debuger.Log(" btn clicked and equipment ");
 }
Пример #25
0
 /// <summary>
 /// 设置帧数据的监听
 /// </summary>
 /// <param name="listener"></param>
 public void SetFrameListener(Action <int, FSPFrame> listener)
 {
     Debuger.Log();
     m_FrameListener = listener;
 }
Пример #26
0
 private void NotifyGameResult(int reason)
 {
     Debuger.Log("reason:{0}", reason);
     //onNotifyGameResult.Invoke();
 }
Пример #27
0
 public void SendRoundBegin()
 {
     Debuger.Log();
     SendFSP(FSPBasicCmd.ROUND_BEGIN, 0);
 }
Пример #28
0
    private void ChangePartShareSkeletonReal(PartData partData, Action callback)
    {
        if (this == null)
        {
            //当加载完成的时候,avatar自身已经被销毁了,所以这里要做判断
            if (callback != null)
            {
                callback();
            }

            if (partData != null && partData.mObj != null)
            {
                AvatarManager.Instance.CachePart(partData);
            }

            Debuger.Log("other", "ChangePartShareSkeletonReal this is null");
            return;
        }

        if (partData == null || partData.mObj == null)
        {
            if (callback != null)
            {
                callback();
            }

            Debuger.Log("other", "ChangePartShareSkeletonReal partData is null");
            return;
        }

        Transform parentTrans = GetPartParent(partData.mType);

        if (parentTrans != null)
        {
            partData.mObj.SetActive(true);
            mPartDic[partData.mType] = partData;
            partData.mObj.transform.SetParent(parentTrans, false);
            ResetTransform(partData.mObj);
            SkinnedMeshRenderer[] allmr = partData.mObj.GetComponentsInChildren <SkinnedMeshRenderer>();
            if (allmr != null)
            {
                for (int m = 0; m < allmr.Length; m++)
                {
                    if (allmr[m] != null && mPartDic[PartType.eSkeleton].mObj != null)
                    {
                        SkinnedMeshRenderer mr = allmr[m];
                        //首先缓存骨骼名字
                        List <string> bonesNameList;
                        if (!partData.mBonesDict.TryGetValue(mr.gameObject.name, out bonesNameList))
                        {
                            bonesNameList = new List <string>();
                            partData.mBonesDict[mr.gameObject.name] = bonesNameList;
                            for (int i = 0; i < mr.bones.Length; i++)
                            {
                                if (mr.bones[i] == null)
                                {
                                    Debuger.LogError("other", "ChangePartShareSkeletonReal mr.bones[i] is null please check!!!!");
                                    break;
                                }
                                else
                                {
                                    bonesNameList.Add(mr.bones[i].gameObject.name);
                                }
                            }
                        }

                        //将骨骼部件 替换到 指定的部件
                        Transform[] skeletonTrans = mPartDic[PartType.eSkeleton].mObj.GetComponentsInChildren <Transform>();
                        if (skeletonTrans != null && bonesNameList != null)
                        {
                            List <Transform> newBoneList = new List <Transform>();
                            for (int i = 0; i < bonesNameList.Count; i++)
                            {
                                for (int j = 0; j < skeletonTrans.Length; j++)
                                {
                                    if (skeletonTrans[j] != null)
                                    {
                                        if (bonesNameList[i] == skeletonTrans[j].name)
                                        {
                                            newBoneList.Add(skeletonTrans[j]);
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        Debuger.LogError("other", "ChangePartShareSkeletonReal mr.bones[i] skeletonTrans[j] is null");
                                    }
                                }
                            }

                            mr.bones = newBoneList.ToArray();
                            mr.updateWhenOffscreen = true;
                        }
                        else
                        {
                            Debuger.LogError("other", "ChangePartShareSkeletonReal skeletonTrans is null");
                        }
                    }
                    else
                    {
                        Debuger.LogError("other", "ChangePartShareSkeletonReal allmr is null");
                    }
                }
            }

            switch (partData.mType)
            {
            case PartType.eFace:
            {
                if (partData.mObj.GetComponent <Animator>() == null)
                {
                    Animator animator = partData.mObj.AddComponent <Animator>();
                    animator.runtimeAnimatorController = SkeletonAnimator.runtimeAnimatorController;
                    animator.avatar  = SkeletonAnimator.avatar;
                    animator.enabled = true;
                }
                else
                {
                    Animator animator = partData.mObj.GetComponent <Animator>();
                    animator.enabled = true;
                }
            }
            break;
            }
        }

        if (callback != null)
        {
            callback();
        }
    }
Пример #29
0
 public void SendRoundEnd()
 {
     Debuger.Log();
     SendFSP(FSPBasicCmd.ROUND_END, 0);
 }
Пример #30
0
    static public void CorrectUILayer()
    {
        DirectoryInfo dir          = new DirectoryInfo(System.IO.Path.Combine(Application.dataPath, "UI/Resources"));
        var           uiLayer      = LayerMask.NameToLayer("UI");
        var           uiHightLayer = LayerMask.NameToLayer("UIHight");
        var           extension    = ".prefab";
        var           excluded     = new HashSet <string> {
            "UIResMgr", "UIRoot"
        };
        var errStrs = new List <string>();

        foreach (var file in dir.GetFiles())
        {
            if (!file.Extension.Equals(extension, StringComparison.OrdinalIgnoreCase))
            {
                continue;
            }
            if (excluded.Contains(System.IO.Path.GetFileNameWithoutExtension(file.Name)))
            {
                continue;
            }
            GameObject panelGo       = AssetDatabase.LoadAssetAtPath <GameObject>(System.IO.Path.Combine("Assets/UI/Resources", file.Name));
            var        panelLayer    = panelGo.layer;
            var        panelLayerStr = LayerMask.LayerToName(panelLayer);
            if (panelLayer != uiLayer && panelLayer != uiHightLayer)
            {
                errStrs.Add(string.Format("发现Panel层不对,名字:{0},层次:{1},由于是Panel,不自动校正,请手动校正后再执行本命令\r\n", panelGo.name, panelLayerStr));
                continue;
            }
            var changed   = false;
            var childrens = panelGo.GetComponentsInChildren <Transform>(true);
            foreach (var child in childrens)
            {
                var childLayer    = child.gameObject.layer;
                var childLayerStr = LayerMask.LayerToName(childLayer);
                if (childLayer != panelLayer)
                {
                    changed = true;
                    child.gameObject.layer = panelLayer;
                    errStrs.Add(string.Format("发现UI子控件不跟Panel同层,Panel名字:{0},控件路径:{1},Panel层次:{2},控件层次:{3},已校正\r\n", panelGo.name, Util.GetGameObjectPath(child.gameObject), panelLayerStr, childLayerStr));
                }
            }
            if (changed)
            {
                UnityEditor.EditorUtility.SetDirty(panelGo);
            }
        }

        UnityEditor.AssetDatabase.Refresh();
        UnityEditor.AssetDatabase.SaveAssets();
        if (errStrs.Count > 0)
        {
            var temp = "";
            for (var i = 0; i < errStrs.Count; ++i)
            {
                var str = errStrs[i];
                temp += str;
                if ((i + 1) % 30 == 0)
                {
                    Debuger.Log(temp);
                    temp = "";
                }
            }
            if (temp.Length > 0)
            {
                Debuger.Log(temp);
            }
        }
        else
        {
            Debuger.Log("没有检查出问题");
        }
    }