public void PrintList() { for (int i = 0; i < _itemList.Count; ++i) { MyDebug.LogError("Item Name: " + _itemList[i].item.name + ", Index: " + _itemList[i]._index); } }
protected virtual void Update() { if (status == ClientStatus.ConnectedSuccess) {//已经连接 //checkNetwork();//暂时关闭重新登录功能 if (status == ClientStatus.Disconnected) { //重新连接 _isReconnect = true; socket.isLoginSuccess = false; //重连后记录没有登录成功 MyDebug.Log("[Socket] NetWork has disconnected, then reconnect"); eventDispatcher.dispatchEvent(new SocketEvent(SocketEvent.DISCONNECTED)); //SystemBusy.show(); connect(); } } else if (status == ClientStatus.ConnectTimeout) { MyDebug.LogError("登录游戏服务器失败。");//先通知断开,重连以后做 status = ClientStatus.None; } else {//未连接 if (socket.isConneted()) { status = ClientStatus.ConnectedSuccess; onConnectedSuccess(null); _isReconnect = false; } } }
private static void BuyProductID(string productId) { if (!IsInitialized) { MyDebug.LogWarning("BuyProductID FAIL. Not initialized."); return; } if (string.IsNullOrEmpty(productId)) { MyDebug.LogError("BuyProductID FAIL. Empty productId"); return; } IAPProduct product = storeController.products.WithID(productId); if (product != null && product.availableToPurchase) { MyDebug.Log($"Purchasing product asychronously: {product.definition.id}"); currentProductId = productId; storeController.InitiatePurchase(product); } else { MyDebug.LogError("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase"); } }
void Set_Manual_MVP() { if (!compass) { MyDebug.LogError("Traget Object was not assigned", matrixPWD); } inverseZ.SetTRS(Vector3.zero, Quaternion.identity, new Vector3(1, 1, -1)); world2View.SetTRS( Vector3.zero, Camera.main.transform.localRotation, Vector3.one); world2View = world2View.transpose; Vector4 dp = world2View * Camera.main.transform.position; dp = new Vector4(dp.x, dp.y, dp.z, -1); world2View.SetColumn(3, -dp); world2View = inverseZ * world2View; manual_MVP = Camera.main.projectionMatrix * world2View * compass.localToWorldMatrix; Shader.SetGlobalMatrix("Manual_MVP", manual_MVP); }
public void OnCreateRoomReply(ClientResponse response) { MyDebug.Log(response.message); if (response.status == 1) { var roomid = Int32.Parse(response.message); sendVo.roomId = roomid; MyDebug.LogError(sendVo.roomId); GlobalDataScript.roomVo = sendVo; GlobalDataScript.loginResponseData.roomId = roomid; GlobalDataScript.loginResponseData.isOnLine = true; GlobalDataScript.type = ModeType.Create; if (GlobalDataScript.homePanel != null) { GlobalDataScript.homePanel.SetActive(false); } CloseDialog(); } else { TipsManagerScript.getInstance.setTips(response.message); } }
private void onReceiveCompleted(object sender, SocketAsyncEventArgs e) { if (e.LastOperation != SocketAsyncOperation.Receive) { MyDebug.LogError("[Socket] connect error:" + e.SocketError); return; } if (e.SocketError == SocketError.ConnectionAborted) { MyDebug.LogError("[Socket] connect has broken:" + e.SocketError); disconnect(); return; } if (e.BytesTransferred <= 0 || e.SocketError != SocketError.Success) { if (GlobalConsts.EnableLogNetwork) { MyDebug.LogError("[Socket] ProcessReceive e.BytesTransferred " + e.BytesTransferred + ",LastOperation:" + e.LastOperation + ",SocketError:" + e.SocketError); MyDebug.LogError("看到这条日志,因为收到空包,可能服务器把客户端踢掉了。请检查上条发送的指令逻辑"); } disconnect(); return; } try { if (GlobalConsts.EnableLogNetwork) { MyDebug.Log("[Socket] Receive data len:" + e.BytesTransferred); } if (e.BytesTransferred >= MAX_READ) { MyDebug.LogError("[Socket] Receive data too long. len:" + e.BytesTransferred); } doOnReceive(_byteBuffer, e.BytesTransferred); } catch (Exception ex) { OnDataError(NetError.ReadException, ex.Message); } Array.Clear(_byteBuffer, 0, _byteBuffer.Length); //清空数组 _recvArgs.SetBuffer(_byteBuffer, 0, _byteBuffer.Length); //继续接受 try { //post next recive bool willRaiseEvent = socket.ReceiveAsync(this._recvArgs); if (!willRaiseEvent) { onReceiveCompleted(sender, this._recvArgs); } } catch (ObjectDisposedException ode) // socket already closed { MyDebug.LogError("[Socket] ProcessReceive2 " + ode.Message); } catch (SocketException exp) { MyDebug.LogError("[Socket] ProcessReceive3 " + exp.Message); } }
/// <summary> /// 退出当前状态.执行指定状态 (切换状态) /// </summary> /// <param name="id"></param> /// <param name="param1"></param> /// <param name="param2"></param> /// <returns></returns> public virtual bool ChangeState(int id, object param1 = null, object param2 = null) { StateBase <T> state; if (_states.TryGetValue(id, out state)) { if (state.IsValidChange(_currState, param1)) { if (_currState != null) { _currState.OnExit(param1); //退出当前状态 } _lastState = _currState; _currState = state; //进入状态前可以提前设置参数 //state 指定状态 state.BeforeEnter(param2); state.OnEnter(_lastState, param1); if (!state.IsFinished) { state.OnAfterEnter(param1); } return(true); } return(false); } MyDebug.LogError("ChangeState not exist state id:" + id.ToString()); return(false); }
public void send(byte[] dataBytes, int maxSend) { if (dataBytes.Length >= maxSend) { MyDebug.LogError(string.Format("[Socket] send data is more than{0}. len:{1}", maxSend, dataBytes.Length)); return; } sendComplete = false; SocketAsyncEventArgs args = new SocketAsyncEventArgs(); args.SetBuffer(dataBytes, 0, dataBytes.Length); args.Completed += new EventHandler <SocketAsyncEventArgs>(onSendCompleted); try { bool willRaiseEvent = socket.SendAsync(args); if (!willRaiseEvent) { onSendError(socket, args); } } catch (Exception ex) { sendComplete = true; MyDebug.LogError("[Socket] send Exception:" + ex.Message); } }
private void onSocketConnectCompleted(object sender, SocketAsyncEventArgs e) { if (e.SocketError == SocketError.NotConnected) { MyDebug.LogError("[Socket] has connected:" + e.SocketError); return; } if (e.LastOperation != SocketAsyncOperation.Connect || e.SocketError != SocketError.Success) { MyDebug.LogError("[Socket] connect error:" + e.SocketError); return; } Socket socket = e.UserToken as Socket; _recvArgs = new SocketAsyncEventArgs(); _recvArgs.Completed += new EventHandler <SocketAsyncEventArgs>(onReceiveCompleted); _recvArgs.SetBuffer(_byteBuffer, 0, _byteBuffer.Length); bool willRaiseEvent = socket.ReceiveAsync(_recvArgs); if (!willRaiseEvent) { MyDebug.LogError("[Socket] willRaiseEvent:"); this.disconnect(); } else { status = NetStatus.Connected; startConnectTime = Environment.TickCount; MyDebug.Log(string.Format("[Socket] Client has connected successful from server:{0}:{1}", host, port)); } }
void Set_Manual_MVP() { if (!compass) { MyDebug.LogError("Traget Object was not assigned", matrixPWD); } n = Camera.main.nearClipPlane; f = Camera.main.farClipPlane; aspect = Camera.main.aspect; fov = Camera.main.fieldOfView * Mathf.Deg2Rad; d = 1f / Mathf.Tan(fov / 2f); projection.m00 = d / aspect; projection.m11 = d; projection.m22 = (n + f) / (n - f); projection.m23 = 2f * n * f / (n - f); projection.m32 = -1f; projection.m33 = 0; manual_MVP = projection * Camera.main.worldToCameraMatrix * compass.localToWorldMatrix; Shader.SetGlobalMatrix("Manual_MVP", manual_MVP); }
public static void SetSprite(string name) { MyDebug.LogError("设置图片:" + name); //asset = FrameworkMain.Instance.ResMgr.LoadAsset<Sprite>(name); //sprite.sprite = asset.asset as Sprite; MyDebug.LogError("背景图片名称:" + BG.sprite); }
//用户进入返回用户信息 public void UserInfoHead(byte[] tmpBuf, int size) { if (GlobalDataScript.Instance.playerInfos == null) { GlobalDataScript.Instance.playerInfos = new List <PlayerGameRoomInfo>();//登录完成初玩家始化信息 } MyDebug.Log("USerID:" + GlobalDataScript.userData.dwUserID); tagMobileUserInfoHead tagUserInfo = NetUtil.BytesToStruct <tagMobileUserInfoHead>(tmpBuf); if (tagUserInfo.wTableID != tableId) { return; } MyDebug.Log(tagUserInfo.dwUserID + "=======================" + size + "===table ID=========================" + tagUserInfo.wTableID); PlayerGameRoomInfo info = new PlayerGameRoomInfo(); info.chairId = tagUserInfo.wChairID; info.tableId = tagUserInfo.wTableID; info.userID = (int)tagUserInfo.dwUserID; info.wFaceID = tagUserInfo.wFaceID; MyDebug.Log(tagUserInfo.szNickName.Length); try { info.name = NetUtil.ChatsToString(tagUserInfo.szNickName); } catch { MyDebug.LogError("---------------------------------------------------------------------+++++++++++++++++++++++++++"); } MyDebug.Log(info.name); if (tagUserInfo.cbUserStatus == 2) { if (GlobalDataScript.type == ModeType.None) { SocketEventHandle.Instance.SetClientResponse(APIS.JOIN_ROOM_NOICE, NetUtil.ObjToJson(info)); } } if (GlobalDataScript.userData.dwUserID == info.userID) { GlobalDataScript.Instance.myGameRoomInfo = info; } for (int i = 0; i < GlobalDataScript.Instance.playerInfos.Count; i++) { if (GlobalDataScript.Instance.playerInfos[i].userID == info.userID) { return; } } if (GlobalDataScript.Instance.roomInfo != null) { MyDebug.Log(GlobalDataScript.Instance.roomInfo.PlayGameCount); } MyDebug.Log(isDisConnect); GlobalDataScript.Instance.playerInfos.Add(info); }
// private string loadPath = "E:/Game/3D/Assets"; //{ // get // { // if (AssetBundleManager.instance.LoadMode == AssetBundleLoadMode.LoadFromFileAsync) // return AssetBundleConfig.ASSETBUNDLE_PATH_E; // return AssetBundleConfig.ASSETBUNDLE_PATH_PERSIS; // } //} public static void Load <T>(string resource, UnityAction <T> onLoaded, bool localCache = true) where T : Object { if (string.IsNullOrEmpty(resource)) { MyDebug.LogError("Passed NULL resource name in ResourcesLoader.Load()"); return; } // MyDebug.Log("Load"); ResourcesLoader.instance.LoadAsset <T>(resource, onLoaded, localCache); }
/// <summary> /// 提供给外部的方法,删除指定位置的Item /// </summary> public void DelItem(int index) { if (index < 0 || index > _dataCount - 1) { MyDebug.LogError("删除错误:" + index); return; } DataCount -= 1; DelItemFromPanel(index); }
/// <summary> /// 立即执行回调 /// </summary> /// <param name="action"> callback </param> /// <param name="obj"> 回调参数 </param> private static void DoActionImd(Action <object> action, object obj) { try { action(obj); } catch (Exception e) { MyDebug.LogError(e); } }
public static void SetFileValue(string str) { if (text_2 != null) { text_2.text = str; } else { MyDebug.LogError("不存在 fileName fileName fileName!!!!!!"); } }
void Set_UNITY_MATRIX_MVP() { if (!neoSpace) { MyDebug.LogError("Traget Space was not assigned", matrixPWD); } model2World.SetTRS(compass.position, Quaternion.identity, Vector3.one); model2MySpace = Camera.main.projectionMatrix * Camera.main.worldToCameraMatrix * model2World; Shader.SetGlobalMatrix("Manual_MVP", model2MySpace); }
void SetModel2MySpace() { if (!neoSpace) { MyDebug.LogError("Traget Space was not assigned", matrixPWD); } model2MySpace.SetTRS(neoSpace.position, Quaternion.identity, Vector3.one); model2World.SetTRS(compass.position, Quaternion.identity, Vector3.one); model2MySpace = Camera.main.projectionMatrix * Camera.main.worldToCameraMatrix * model2World * model2MySpace; Shader.SetGlobalMatrix("_neoMatrix", model2MySpace); }
/// <summary> /// 加载角色模板 /// </summary> /// <param name="name"></param> /// <returns></returns> public static GameObject LoadRole(string name) { GameObject obj = null; obj = Resources.Load("Role/" + name) as GameObject; if (obj == null) { MyDebug.LogError("未找到Role:" + name); return(null); } return(obj); }
public InvalidSaveOperationException(string message) : base(message) { string lastLogs = ""; if (File.Exists(logPath)) { lastLogs = File.ReadAllText(logPath); } File.WriteAllText(logPath, $"{lastLogs}\n{message}"); MyDebug.LogError(message); }
void Set_Manual_MVP() { if (!compass) { MyDebug.LogError("Target Object was not assigned", matrixPWD); } manual_MVP = Camera.main.projectionMatrix * Camera.main.worldToCameraMatrix * compass.localToWorldMatrix; Shader.SetGlobalMatrix("Manual_MVP", manual_MVP); }
void Set_Manual_MVP() { if (!compass) { MyDebug.LogError("Target Object was not assigned", matrixPWD); } model2World.SetTRS(compass.position, compass.rotation, compass.lossyScale); manual_MVP = Camera.main.projectionMatrix * Camera.main.worldToCameraMatrix * model2World; Shader.SetGlobalMatrix("Manual_MVP", manual_MVP); }
public void Load(PackageManifest manifestAsset) { if (manifestAsset == null) { MyDebug.LogError("Manifest初始化失败!manifestAsset == null"); return; } Init(); assetsMaps = manifestAsset.GetManifestAssetDic(); bundleMaps = manifestAsset.GetManifestDic(); bundleNameMaps = manifestAsset.GetManifestNameDic(); assetBundleName = manifestAsset.GetManifestAssetBundleDic(); }
private static void AddLocale(string locale) { if (!ConfigManager.dictCfgBytes.ContainsKey("General.txt")) { MyDebug.LogError("Zip 未解析到:General.txt"); return; } string str = Encoding.UTF8.GetString(ConfigManager.dictCfgBytes["General.txt"]); //Debug.Log("Locale parse1=" + Time.realtimeSinceStartup); Parse(str); //Debug.Log("Locale parse2=" + Time.realtimeSinceStartup); MyDebug.Log("本地化完成:" + locale); }
public int intOf(string key) { string v = stringOf(key); try { return(int.Parse(v)); } catch { MyDebug.LogError("数据不是int:file=" + fileName + ",key=" + key + ",value=" + v); } return(0); }
public static void PlaySound(SoundTypes sound) { if (!sfx.ContainsKey(sound)) { MyDebug.LogError($"Sound {sound} not found"); return; } if (!enabled) { return; } sfx[sound].Play(); }
void LoadPictureAPI(string url, LoadPictureCallback callback) { FB.API(url, HttpMethod.GET, result => { if (result.Error != null) { MyDebug.LogError(result.Error); return; } var imageUrl = DeserializePictureURLString(result.RawResult); StartCoroutine(LoadPictureEnumerator(imageUrl, callback)); }); }
/// <summary> /// 加载Sprite /// </summary> /// <param name="spriteName"></param> /// <returns></returns> private Sprite LoadSprite(string spriteName) { GameObject go = Resources.Load <GameObject>("Sprite/" + spriteName); Sprite sprite = null; if (go != null) { sprite = go.GetComponent <SpriteRenderer>().sprite; } else { MyDebug.LogError("spriteName:" + spriteName + "加载失败!"); } return(sprite); }
public InvalidSaveOperationException(int exceptionCode, Exception inner) : base(inner.Message, inner) { string lastLogs = ""; string currentLog = $"*** Error {exceptionCode}: {inner.Message}\n{inner.StackTrace} ***\n"; if (File.Exists(logPath)) { lastLogs = File.ReadAllText(logPath); } File.WriteAllText(logPath, $"{lastLogs}\n{currentLog}"); MyDebug.LogError(currentLog); }
/// <summary> /// 加载Sprite /// </summary> /// <param name="name"></param> /// <returns></returns> public static Sprite LoadSprite(string name) { Sprite sprite = null; GameObject obj = Resources.Load("Sprite/" + name) as GameObject; if (obj == null) { MyDebug.LogError("未找到Sprite:" + name); return(null); } SpriteRenderer render = obj.GetComponent <SpriteRenderer>(); sprite = render.sprite; return(sprite); }