/// <summary> /// 创建玩家分数UI界面 /// </summary> void CreatePlayerFenShuUI(SSGlobalData.PlayerEnum indexPlayer) { int index = (int)indexPlayer + 1; if (index < 1 || index > SSGlobalData.MAX_PLAYER) { return; } if (m_SSPlayerFenShu[index - 1] != null) { return; } string prefabPath = "GUI/FenShu/FenShuP" + index; GameObject gmDataPrefab = (GameObject)Resources.Load(prefabPath); if (gmDataPrefab != null) { //SSDebug.Log("CreatePlayerFenShuUI......................................................"); GameObject obj = (GameObject)Instantiate(gmDataPrefab, m_GameUIData.PanelCenterTr); SSPlayerFenShu com = obj.GetComponent <SSPlayerFenShu>(); if (com != null) { m_SSPlayerFenShu[index - 1] = com; com.Init(indexPlayer); } } else { SSDebug.LogWarning("CreatePlayerFenShuUI -> gmDataPrefab was null! prefabPath == " + prefabPath); } }
/// <summary> /// 产生选择游戏场景UI. /// </summary> void SpawnLevelSelectUI() { if (mUICamera == null) { SSDebug.LogWarning("SpawnLevelSelectUI -> mUICamera was null"); return; } if (mLevelSelectUI == null) { GameObject objPrefab = (GameObject)Resources.Load("Prefab/Gui/LevelSelect/LevelSelect"); if (objPrefab != null) { SSDebug.Log("SpawnLevelSelectUI..."); GameObject obj = (GameObject)Instantiate(objPrefab, mUICamera.transform); mLevelSelectUI = obj.GetComponent <LevelSelectUI>(); mLevelSelectUI.Init(this); if (m_pTishiTexture != null) { m_pTishiTexture.gameObject.SetActive(false); } } else { SSDebug.LogWarning("SpawnLevelSelectUI -> objPrefab was null"); } } }
//void OnDestroy() //{ // SSDebug.LogWarning("WebSocketSimpet::OnDestroy............"); // if (_wabData != null && _wabData.WebSocket != null && _wabData.WebSocket.IsOpen == true) // { // SSDebug.LogWarning("WebSocketSimpet::WebSocket.Close............"); // _wabData.WebSocket.Close(); // } //} /// <summary> /// 打开WebSocket. /// </summary> public void OpenWebSocket(string url) { //if (url.Contains("https://game.hdiandian.com") == true) //{ // SSDebug.LogWarning("SendPost -> url ======= " + url); //test //} if (IsClosedWebSocket == true) { //游戏已经关闭WebScoket SSDebug.Log("The game have been closed webSocket..."); return; } //if (_wabData != null) //{ // //设置服务器地址信息. // _wabData.Address = url; // if (_wabData.WebSocket == null) // { // _wabData.OpenWebSocket(); // Debug.Log("Unity:" + "Opening Web Socket -> url == " + url); // } // else // { // //Debug.Log("Unity:" + "Close Web Socket..."); // //_wabData.WebSocket.Close(); // Debug.Log("Unity:" + "Restart Open WebSocket..."); // _wabData.RestartOpenWebSocket(); // } //} }
XKPlayerZhuiYaUI GetXKPlayerZhuiYaUI() { //GameObject obj = null; //int valTmp = 0; //for (int i = 0; i < MaxPlayerFS; i++) { // obj = ZhuiYaUIList[i].gameObject; // if (obj.activeSelf) { // continue; // } // valTmp = i; // break; //} //return ZhuiYaUIList[valTmp]; GameObject gmDataPrefab = (GameObject)Resources.Load("Prefabs/GUI/PlayerZhuiYa/PlayerZhuiYaUI"); if (gmDataPrefab == null) { SSDebug.LogWarning("GetXKPlayerZhuiYaUI -> gmDataPrefab was null"); return(null); } GameObject obj = (GameObject)Instantiate(gmDataPrefab); obj.transform.parent = transform; obj.transform.localScale = new Vector3(1f, 1f, 1f); obj.transform.localPosition = Vector3.zero; return(obj.GetComponent <XKPlayerZhuiYaUI>()); }
public string ReadFromFileXml(string fileName, string attribute) { string filepath = fileName; string valueStr = ""; if (File.Exists(filepath)) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filepath); XmlNodeList nodeList = xmlDoc.SelectSingleNode("gameConfig").ChildNodes; foreach (XmlElement xe in nodeList) { valueStr = xe.GetAttribute(attribute); } File.SetAttributes(filepath, FileAttributes.Normal); xmlDoc.Save(filepath); } catch (Exception exception) { File.SetAttributes(filepath, FileAttributes.Normal); File.Delete(filepath); SSDebug.LogError("error: xml was wrong! " + exception); } } return(valueStr); }
public static void NetLog(string msg) { if (Net) { SSDebug.Log(msg); } }
private void ChangeAndSend(E_DIR dir, bool isMove) { bool isChange = false; if (this.dir != dir) { this.dir = dir; isChange = true; } if (this.isMove != isMove) { this.isMove = isMove; isChange = true; } if (isChange) { MceControl msg = new MceControl(); msg.dir = dir; msg.isMove = isMove; SSDebug.Log("send isMove = " + msg.isMove); SSSocketManager.getInstance().SendProto(NetProtoType.MceControl, msg); } }
/// <summary> /// 当玩家击出的住曲棍球碰上道具时,给该玩家创建道具加分UI界面 /// </summary> internal void CreateDaoJuJiaFenUI(SSGlobalData.PlayerEnum indexPlayer, int fenShu) { int index = (int)indexPlayer + 1; if (index < 1) { return; } string prefabPath = "GUI/JiaFen/DaoJuJiaFenP" + index; GameObject gmDataPrefab = (GameObject)Resources.Load(prefabPath); if (gmDataPrefab != null) { //SSDebug.Log("CreateDaoJuJiaFenUI......................................................"); GameObject obj = (GameObject)Instantiate(gmDataPrefab, m_GameUIData.PanelCenterTr); SSDaoJuJiaFen com = obj.GetComponent <SSDaoJuJiaFen>(); if (com != null) { com.ShowNumUI(fenShu); } } else { SSDebug.LogWarning("CreateDaoJuJiaFenUI -> gmDataPrefab was null! prefabPath == " + prefabPath); } }
/// <summary> /// 读取单条数据. /// </summary> string ReadFromFileXml(string fileName, string elementName, string attribute) { string filepath = Application.dataPath + "/" + fileName; #if UNITY_ANDROID //filepath = Application.persistentDataPath + "//" + fileName; #endif string valueStr = null; if (File.Exists(filepath)) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filepath); XmlNodeList nodeList = xmlDoc.SelectSingleNode("ConfigShangHuData").ChildNodes; foreach (XmlElement xe in nodeList) { if (xe.Name == elementName) { valueStr = xe.GetAttribute(attribute); break; } } File.SetAttributes(filepath, FileAttributes.Normal); xmlDoc.Save(filepath); } catch (Exception exception) { File.SetAttributes(filepath, FileAttributes.Normal); File.Delete(filepath); SSDebug.LogError("error: xml was wrong! " + exception); } } return(valueStr); }
/// <summary> /// 创建开始发球界面 /// </summary> internal void CreateStartFireBall(SSGlobalData.PlayerEnum indexPlayer) { int index = (int)indexPlayer + 1; if (index < 1) { return; } string prefabPath = "GUI/DaoJiShi/StartGame/StartFireBallP" + index; GameObject gmDataPrefab = (GameObject)Resources.Load(prefabPath); if (gmDataPrefab != null) { //SSDebug.Log("CreateStartFireBall......................................................"); GameObject obj = (GameObject)Instantiate(gmDataPrefab, m_GameUIData.PanelCenterTr); SSStartGameGo com = obj.GetComponent <SSStartGameGo>(); if (com != null) { IsCreateStartFireBall = true; com.Init(); } } else { SSDebug.LogWarning("CreateStartFireBall -> gmDataPrefab was null! prefabPath == " + prefabPath); } }
/// <summary> /// 创建游戏倒计时 /// </summary> internal void CreateGameDaoJiShi() { if (IsCreateDaoJiShi == true) { return; } string prefabPath = "GUI/DaoJiShi/DaoJiShi"; GameObject gmDataPrefab = (GameObject)Resources.Load(prefabPath); if (gmDataPrefab != null) { //SSDebug.Log("CreateGameDaoJiShi......................................................"); GameObject obj = (GameObject)Instantiate(gmDataPrefab, m_GameUIData.PanelCenterTr); SSGameDaoJiShi com = obj.GetComponent <SSGameDaoJiShi>(); if (com != null) { IsCreateDaoJiShi = true; com.Init(); } } else { SSDebug.LogWarning("CreateGameDaoJiShi -> gmDataPrefab was null! prefabPath == " + prefabPath); } }
internal void Run() { try { //smtp.163.com string senderServerIp = "123.125.50.133"; //smtp.gmail.com //string senderServerIp = "74.125.127.109"; //smtp.qq.com //string senderServerIp = "58.251.149.147"; //string senderServerIp = "smtp.sina.com"; //string toMailAddress = "*****@*****.**"; //string fromMailAddress = "*****@*****.**"; string toMailAddress = "*****@*****.**"; string fromMailAddress = "*****@*****.**"; string subjectInfo = "LeiTingZhanChe_" + SSGameLogoData.m_GameVersionState + " sending e_mail"; string bodyInfo = m_Msg; string mailUsername = "******"; double num = Math.Pow(2, 10) + Math.Pow(2, 9) + Math.Pow(2, 8) + Math.Pow(2, 7) + 66; string tmp = "shen"; string mailPassword = num.ToString() + tmp; //发送邮箱的密码() string mailPort = "25"; MyEmail email = new MyEmail(senderServerIp, toMailAddress, fromMailAddress, subjectInfo, bodyInfo, mailUsername, mailPassword, mailPort, false, false); //string attachPath = "E:\\123123.txt; E:\\haha.pdf"; //email.AddAttachments(attachPath); email.Send(); } catch (Exception ex) { SSDebug.LogWarning("ThreadSendOpenGameMsgToEmail -> ex == " + ex.ToString()); } }
///<summary> /// 邮件的发送 ///</summary> public void Send() { try { if (mMailMessage != null) { mSmtpClient = new SmtpClient(); //mSmtpClient.Host = "smtp." + mMailMessage.From.Host; mSmtpClient.Host = this.mSenderServerHost; mSmtpClient.Port = this.mSenderPort; mSmtpClient.UseDefaultCredentials = false; mSmtpClient.EnableSsl = this.mEnableSsl; if (this.mEnablePwdAuthentication) { System.Net.NetworkCredential nc = new System.Net.NetworkCredential(this.mSenderUsername, this.mSenderPassword); //mSmtpClient.Credentials = new System.Net.NetworkCredential(this.mSenderUsername, this.mSenderPassword); //NTLM: Secure Password Authentication in Microsoft Outlook Express mSmtpClient.Credentials = nc.GetCredential(mSmtpClient.Host, mSmtpClient.Port, "NTLM"); } else { mSmtpClient.Credentials = new System.Net.NetworkCredential(this.mSenderUsername, this.mSenderPassword); } mSmtpClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; mSmtpClient.Send(mMailMessage); } } catch (Exception ex) { SSDebug.LogWarning("MyEmail::Send -> ex == " + ex.ToString()); } }
/// <summary> /// 创建玩家的球拍 /// </summary> void CreatePlayerPaddle(SSGlobalData.PlayerEnum indexPlayer) { if (indexPlayer == SSGlobalData.PlayerEnum.Null) { return; } int index = (int)indexPlayer + 1; string prefabPath = "Player/Paddle_" + index; GameObject gmDataPrefab = (GameObject)Resources.Load(prefabPath); if (gmDataPrefab != null) { //SSDebug.Log("CreatePlayerPaddle................. indexPlayer == " + indexPlayer); GameObject obj = (GameObject)Instantiate(gmDataPrefab); SSPlayerPaddle com = obj.GetComponent <SSPlayerPaddle>(); if (com != null) { com.Init(m_PaddleData, indexPlayer); SetPlayerPaddle(com); } } else { SSDebug.LogWarning("CreatePlayerPaddle -> gmDataPrefab was null! prefabPath == " + prefabPath); } }
/// <summary> /// 创建纷腾服务器消息接口组件. /// </summary> void CreatFTServerInterface() { SSDebug.Log("CreatFTServerInterface+++++++++++++++++++++++++++++++++++"); if (m_FTServerInterface == null) { GameObject obj = new GameObject("_FTServerInterface"); m_FTServerInterface = obj.AddComponent <FTServerInterface>(); } }
void OnTriggerEnter(Collider otherObj) { SSDebug.Log("trigger:" + otherObj.tag); if (!m_triggerMap.ContainsKey(otherObj.tag)) { return; } m_triggerMap [otherObj.tag] (otherObj); }
private UserNode getUserNodeByUID(string uid) { if (!userNodeDic.ContainsKey(uid)) { SSDebug.Log("Error:can't find user by " + uid); return(null); } return(userNodeDic[uid]); }
void InitInfo() { SSDebug.Log("FTServerManage::InitInfo......................."); if (MsgList == null) { MsgList = new List <string>(); MsgListButton = new List <string>(); MsgListDirection = new List <string>(); } }
void OnCollisionEnter(Collision collision) { GameObject tempGameObject = collision.gameObject; SSDebug.Log("collisionEnter:" + tempGameObject.tag); if (!m_collisionMap.ContainsKey(tempGameObject.tag)) { return; } m_collisionMap [tempGameObject.tag] (collision); }
void handleHitPaddle() { if (rigidbody.isKinematic == true) { return; } Vector3 vel = rigidbody.velocity.normalized; SSDebug.Log("handleHitPaddle -> vel == " + vel); }
/// <summary> /// 当二维码加载之后. /// </summary> void OnErWeiMaLoad(Texture2D val) { if (m_FTServerInterface != null) { SSDebug.Log("OnErWeiMaLoad -> loaded erWeiMa.........................."); m_FTServerInterface.OnErWeiMaLoad(val); } else { SSDebug.LogWarning("OnErWeiMaLoad -> m_FTServerInterface was null"); } }
/// <summary> /// 当接收心跳消息超时. /// </summary> void OnTimeOutReceiveXinTiaoMsg() { if (m_SSBoxPostNet != null && IsDelaySendPostLoginBox == false) { SSDebug.LogWarning("OnTimeOutReceiveXinTiaoMsg ........ time == " + Time.time.ToString("f2")); //重置心跳消息标记. IsCheckXinTiaoMsg = false; m_TimeLastXinTiao = Time.time; OnXinTiaoMsgTimeOutCloseWebScoket(); StartCoroutine(DelaySendPostLoginBox()); } }
/// <summary> /// 下载玩家微信头像. /// </summary> IEnumerator DownloadImage(string url, Material image) { Texture2D tex2d = null; //Debug.Log("Unity:"+"downloading new image:" + url.GetHashCode());//url转换HD5作为名字. WWW www = null; try { www = new WWW(url); } catch (System.Exception) { } yield return(www); try { if (www != null) { if (www.error == null) { tex2d = www.texture; } else { if (www.error.Contains("404") == false) { tex2d = www.texture; } else { SSDebug.LogWarning("DownloadImage -> www.error ===== " + www.error); } } } else { SSDebug.LogWarning("DownloadImage -> www was null"); } } catch (System.Exception ex) { SSDebug.LogWarning("DownloadImage -> ex ======= " + ex); } if (tex2d != null && image != null) { //Debug.Log("Unity: DownloadImage..."); image.mainTexture = tex2d; //添加玩家微信数据. AddPlayerWXDt(new PlayerWXDt(url, tex2d)); } }
/// <summary> /// 向配置文件写入玩家的数据信息. /// </summary> void WriteGamePlayerData() { string filepath = Application.dataPath + "/" + m_FileName; #if UNITY_ANDROID filepath = Application.persistentDataPath + "//" + m_FileName; #endif //create file if (!File.Exists(filepath)) { CreatGamePlayerData(filepath); } //update value if (File.Exists(filepath)) { try { string elementName = "PlayerData"; string attribute1 = "UserId"; string attribute2 = "TimeVal"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filepath); XmlNodeList nodeList = xmlDoc.SelectSingleNode("ConfigData").ChildNodes; int countNum = m_FreePlayGamePlayerDataList.Count; if (countNum > 0) { int indexVal = 0; foreach (XmlElement xe in nodeList) { if (xe.Name == elementName && countNum > indexVal) { //SSDebug.Log("WriteGamePlayerData -> userId == " + m_FreePlayGamePlayerDataList[indexVal].UserId // + ", timeVal == " + m_FreePlayGamePlayerDataList[indexVal].TimeVal.ToString("G")); xe.SetAttribute(attribute1, m_FreePlayGamePlayerDataList[indexVal].UserId.ToString()); xe.SetAttribute(attribute2, m_FreePlayGamePlayerDataList[indexVal].TimeVal.ToString("G")); indexVal++; } } } File.SetAttributes(filepath, FileAttributes.Normal); xmlDoc.Save(filepath); } catch (System.Exception exception) { File.SetAttributes(filepath, FileAttributes.Normal); File.Delete(filepath); SSDebug.LogError("error: xml was wrong! " + exception); } } }
/// <summary> /// 玩家从纷腾服务器登陆游戏. /// </summary> internal void OnPlayerLoginFromFTServer(WebSocketSimpet.PlayerWeiXinData playerDt) { if (playerDt == null) { SSDebug.LogWarning("OnPlayerLoginFromFTServer -> playerDt was null"); return; } if (m_HongDDGamePadCom != null) { m_HongDDGamePadCom.OnPlayerLoginFromFTServer(playerDt); } }
/// <summary> /// 创建纷腾服务器管理组件. /// </summary> public static void CreateFTServerManage() { SSDebug.Log("CreateFTServerManage----------------------------------"); if (_Instance == null) { GameObject obj = new GameObject("_FTServerManage"); _Instance = obj.AddComponent <FTServerManage>(); } if (_Instance != null) { _Instance.Init(); } }
void SetGameWindows() { IntPtr ptr = GetProcessWnd(); bool isMinWindows = IsIconic(ptr); if (isMinWindows == true) { //游戏窗口被设置为最小化了. //SSDebug.LogWarning("SetGameWindows -> isMinWindows ====== " + isMinWindows); bool isShow = ShowWindow(ptr, SW_RESTORE);//恢复窗口. SSDebug.LogWarning("SetGameWindows -> isShow ====== " + isShow); StartCoroutine(DelayShowFullScreenGame()); } }
/// <summary> /// 从配置文件读取游戏发送邮件的时间信息. /// </summary> string ReadGameSendEmailTime() { string filepath = Application.dataPath + "/" + m_FileName; #if UNITY_ANDROID filepath = Application.persistentDataPath + "//" + m_FileName; #endif //create file if (!File.Exists(filepath)) { CreatGamePlayerData(filepath); } string time = ""; if (File.Exists(filepath)) { try { string elementName = "Config"; string attribute1 = "TimeVal"; string valueStr1 = ""; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filepath); XmlNodeList nodeList = xmlDoc.SelectSingleNode("ConfigData").ChildNodes; foreach (XmlElement xe in nodeList) { if (xe.Name == elementName) { valueStr1 = xe.GetAttribute(attribute1); if (valueStr1 != null && valueStr1 != "") { time = valueStr1; //SSDebug.Log("ReadGamePlayerData -> userId == " + valueStr1 + ", timeVal == " + valueStr2); //AddFreePlayGamePlayerInfo(System.Convert.ToInt32(valueStr1), System.Convert.ToDateTime(valueStr1)); } } } File.SetAttributes(filepath, FileAttributes.Normal); xmlDoc.Save(filepath); } catch (Exception exception) { File.SetAttributes(filepath, FileAttributes.Normal); File.Delete(filepath); SSDebug.LogError("error: xml was wrong! " + exception); } } return(time); }
void OnTriggerEnter(Collider other) { #if TEST_YULE_TRIGER SSDebug.Log("SSTriggerCameraSpeed::OnTriggerEnter -> 11111 m_CameraSpeed == " + m_CameraSpeed + ", TriggerSt ====== " + TriggerSt); #endif if (other.GetComponent <XkPlayerCtrl>() == null) { return; } #if TEST_YULE_TRIGER IsHit = true; SSDebug.Log("SSTriggerCameraSpeed::OnTriggerEnter -> 22222 m_CameraSpeed == " + m_CameraSpeed + ", TriggerSt ====== " + TriggerSt); #endif if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_AiPathGroup != null) { //修改娱乐阶段主角镜头运动速度. XkGameCtrl.GetInstance().m_AiPathGroup.m_YuLeMoveSpeed = m_CameraSpeed; XkGameCtrl.GetInstance().m_YuLeState = TriggerSt; } switch (TriggerSt) { case TriggerEnum.Open: { //打开娱乐阶段. //关闭战车npc的刷怪逻辑. if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_AiPathGroup != null) { XkGameCtrl.GetInstance().m_AiPathGroup.SetCameraMoveType(AiPathGroupCtrl.MoveState.YuLe); //释放游戏游离资源. XkGameCtrl.GetInstance().UnloadUnusedAssets(); } break; } case TriggerEnum.Close: { //关闭娱乐阶段. //打开战车npc的刷怪逻辑. if (XkGameCtrl.GetInstance() != null && XkGameCtrl.GetInstance().m_AiPathGroup != null) { XkGameCtrl.GetInstance().m_AiPathGroup.SetCameraMoveType(AiPathGroupCtrl.MoveState.Default); } break; } } }
// override public override void decode(short msgType, byte[] msgBytes) { if (msgType == NetProtoType.MseAuth) { ReceivePackType <AppProto.MseAuth> (msgType, msgBytes); } else if (msgType == NetProtoType.MseEnterGame) { ReceivePackType <AppProto.MseEnterGame> (msgType, msgBytes); } else if (msgType == NetProtoType.MseHeartbeat) { ReceivePackType <AppProto.MseHeartbeat> (msgType, msgBytes); } else if (msgType == NetProtoType.MseUserInfo) { ReceivePackType <AppProto.MseUserInfo> (msgType, msgBytes); } else if (msgType == NetProtoType.MseSceneObjAppear) { ReceivePackType <AppProto.MseSceneObjAppear> (msgType, msgBytes); } else if (msgType == NetProtoType.MseSceneObjAppearList) { ReceivePackType <AppProto.MseSceneObjAppearList> (msgType, msgBytes); } else if (msgType == NetProtoType.MseSceneObjMove) { ReceivePackType <AppProto.MseSceneObjMove> (msgType, msgBytes); } else if (msgType == NetProtoType.MseSceneObjMoveList) { ReceivePackType <AppProto.MseSceneObjMoveList> (msgType, msgBytes); } else if (msgType == NetProtoType.MseSceneObjAppearList) { ReceivePackType <AppProto.MseSceneObjDisappear> (msgType, msgBytes); } else if (msgType == NetProtoType.MseSceneObjAppearList) { ReceivePackType <AppProto.MseSceneObjDisappearList> (msgType, msgBytes); } else { SSDebug.Log("unkown msgType = " + msgType); } }