public bool FromBytes(byte[] bodyData)
 {
     Result           = (ERROR_CODE)BitConverter.ToInt16(bodyData, 0);
     RoomNumber       = BitConverter.ToInt32(bodyData, 2);
     RoomUserUniqueID = BitConverter.ToUInt64(bodyData, 6);
     return(true);
 }
Esempio n. 2
0
 private void CheckHandleResult(ERROR_CODE hresult)
 {
     if (hresult < 0)
     {
         throw new Exception("Invalid HRESULT: " + hresult.ToString());
     }
 }
Esempio n. 3
0
    /// <summary>
    /// エラーログを表示する
    /// </summary>
    public static void ErrorLog(ERROR_CODE code)
    {
        string str = "no message";

        switch (code)
        {
        case ERROR_CODE.NONE:
            str = "no message";
            break;

        case ERROR_CODE.SYSTEM_SINGLETON_OBJECT_NONE:
            str = "シングルトンオブジェクト未検地";
            break;

        case ERROR_CODE.AUDIO_SE_NONE:
            str = "存在しないSEです";
            break;

        case ERROR_CODE.AUDIO_BGM_NONE:
            str = "存在しないBGMです";
            break;

        default:
            break;
        }

        Debug.LogError(str);
    }
Esempio n. 4
0
        private async void RunTask(TaskName taskName, string arg1, string arg2, Action <ERROR_CODE> callback)
        {
            // 비동기로 Worker Thread에서 도는 task1
            // Task.Run(): .NET Framework 4.5+
            ERROR_CODE result = ERROR_CODE.NONE;

            switch (taskName)
            {
            case TaskName.OPEN_DEVICE:
                result = await ble.OpenDevice(arg1);

                listStatus.Items.Add($"ErrorCode: {result}");
                break;

            case TaskName.SET_SERVICE:
                //task1 = Task.Run(() => bleservice.SetService(deviceName));
                //result = await task1;
                result = await ble.SetService(arg2);

                listStatus.Items.Add($"ErrorCode: {result}");
                break;

            case TaskName.READ_CHARACTERISTIC:
                result = await ble.ReadCharacteristic(arg1, arg2);

                listStatus.Items.Add($"ErrorCode: {result}");
                if (result == ERROR_CODE.NONE)
                {
                    var readstring = ble.getCharacteristic();
                    listStatus.Items.Add($"Result: {readstring}");
                }
                break;
            }
            callback(result);
        }
Esempio n. 5
0
        public void AddError(string Key, ERROR_CODE Value)
        {
            if (string.IsNullOrEmpty(BaseLanguage))
            {
                BaseLanguage = "VN";
            }
            if (Errors == null)
            {
                Errors = new Dictionary <string, string>();
            }
            string content = "";

            try
            {
                JToken token = ErrorResource[_BaseLanguage].SelectToken(ErrorPath + "." + Key + "." + Value.ToString());
                content = token.ToString();
            }
            catch
            {
                content = "Lack definition of " + ErrorPath + "." + Key + "." + Value.ToString();
            }

            if (Errors.ContainsKey(Key))
            {
                Errors[Key] = content;
            }
            else
            {
                Errors.Add(Key, content);
            }
        }
    /// <summary>
    /// Copies the given ZEDMat to a given OpenCV mat, creating either or both mats if necessary, then calls an ImageUpdatedEvent with them.
    /// Used in OnZEDGrabbed to call different events, and to make it easy to add more kinds of images/events by just adding more calls to this method.
    /// </summary>
    /// <param name="cam">Unity Camera object that represents the ZED camera. Usually from ZEDManager.GetLeftCamera() or ZEDManager.GetRightCamera().</param>
    /// <param name="zedmat">ZEDMat used to get the ZED image. Passing an empty one is okay - it'll get filled appropriately.</param>
    /// <param name="view">Type of image requested, like LEFT or LEFT_GRAY.</param>
    /// <param name="mattype">Data type and channel of required ZEDMat. See summaries over each enum entry to know which is correct for your image type.</param>
    /// <param name="cvMat">OpenCV mat to copy to. Passing an empty one is okay - it'll get filled appropriately.</param>
    /// <param name="updateevent">Event to call if the method retrieves the image successfully.</param>
    private void DeployGrabbedEvent(Camera cam, ref ZEDMat zedmat, VIEW view, ZEDMat.MAT_TYPE mattype, ref Mat cvMat, ImageUpdatedEvent updateevent,
                                    OpenCVConversion conversionatend = OpenCVConversion.NONE)
    {
        if (zedmat == null)
        {
            zedmat = new ZEDMat((uint)zedCam.ImageWidth, (uint)zedCam.ImageHeight, mattype);
        }

        /*if (cvMat == null)
         * {
         *  cvMat = SLMat2CVMat(zedmat, mattype);
         * }*/

        ERROR_CODE err = zedManager.zedCamera.RetrieveImage(zedmat, view, ZEDMat.MEM.MEM_CPU, zedmat.GetResolution());

        if (err == ERROR_CODE.SUCCESS)
        {
            Mat buffermat = GetOpenCVBufferMat(zedCam.ImageHeight, zedCam.ImageWidth, SLMatType2CVMatType(mattype));

            //copyToMat(zedmat.GetPtr(), cvMat);
            Utils.copyToMat(zedmat.GetPtr(), buffermat);

            ConvertColorSpace(buffermat, ref cvMat, conversionatend);
            //Mat convertedmat = ConvertColorSpace(buffermat, conversionatend);

            //updateevent.Invoke(cam, camMat, cvMat);
            updateevent.Invoke(cam, camMat, cvMat);
        }
    }
Esempio n. 7
0
        // Render loop
        private void NativeWindow_Render(object sender, NativeWindowEventArgs e)
        {
            OpenGL.CoreUI.NativeWindow nativeWindow = (OpenGL.CoreUI.NativeWindow)sender;
            Gl.Viewport(0, 0, (int)nativeWindow.Width, (int)nativeWindow.Height);
            Gl.Clear(ClearBufferMask.ColorBufferBit);

            ERROR_CODE err = ERROR_CODE.FAILURE;

            if (viewer.isAvailable() && zedCamera.Grab(ref runtimeParameters) == ERROR_CODE.SUCCESS)
            {
                if (zedMat.IsInit())
                {
                    // Retrieve left image
                    err = zedCamera.RetrieveImage(zedMat, sl.VIEW.LEFT, sl.MEM.CPU);
                    if (err == ERROR_CODE.SUCCESS)
                    {
                        // Retrieve Objects
                        zedCamera.RetrieveObjects(ref object_frame, ref obj_runtime_parameters);

                        //Update GL View
                        viewer.update(zedMat, object_frame);
                        viewer.render();
                    }
                }
            }
        }
        // 끝났다...
        public void EndPerform()
        {
            Debug.LogFormat(">>> Perform (End) :{0} / {1} /  {2}\r\n", state, this.curr_task.state, err_code);

            if (try_count > 5 && _err_code != ERROR_CODE.SUCCESS)               // 켄슬이나 다른 에러가 많으면 실패 처리해야지
            {
                _err_code = ERROR_CODE.FAIL;
            }

            switch (err_code)
            {
            case ERROR_CODE.SUCCESS:
            case ERROR_CODE.FAIL:
            case ERROR_CODE.CANCEL:
                break;

            case ERROR_CODE.NOT_ENOUGH_CANDY:
                this.SetPreDesire(new DesireKey(DesireState.Buy)
                {
                    contents = { new Content(eDesireItem.Candy) }
                });                                                                                                                     // 사탕이 부족합니다.
                break;

            default:
                break;
            }
        }
 // 끝났어요
 public void Done(ERROR_CODE error_code)
 {
     _error_code = error_code;
     Debug.LogFormat("[End] Task: {0} / {1}", _jobTaskRun.curr_task.state, error_code);
     // 동작중 이상 상태로 실패하면 기록 해야지
     //workTaskRun.nowTask.err_code = error_code; // Done 처리 할지 말지 결정 하는부분
 }
Esempio n. 10
0
        // Render loop
        private void NativeWindow_Render(object sender, NativeWindowEventArgs e)
        {
            OpenGL.CoreUI.NativeWindow nativeWindow = (OpenGL.CoreUI.NativeWindow)sender;
            Gl.Viewport(0, 0, (int)nativeWindow.Width, (int)nativeWindow.Height);
            Gl.Clear(ClearBufferMask.ColorBufferBit);

            ERROR_CODE err = ERROR_CODE.FAILURE;

            if (viewer.isAvailable() && zedCamera.Grab(ref runtimeParameters) == ERROR_CODE.SUCCESS)
            {
                if (imageLeft.IsInit())
                {
                    // Retrieve left image
                    zedCamera.RetrieveMeasure(pointCloud, sl.MEASURE.XYZRGBA, sl.MEM.CPU, pcRes);
                    zedCamera.RetrieveImage(imageLeft, sl.VIEW.LEFT, sl.MEM.CPU, displayRes);
                    zedCamera.GetPosition(ref camPose, REFERENCE_FRAME.WORLD);

                    // Retrieve Objects
                    zedCamera.RetrieveObjects(ref objects, ref obj_runtime_parameters);

                    TrackingViewer.render_2D(ref imageLeftOcv, imgScale, ref objects, isTrackingON);

                    //Update GL View
                    viewer.update(pointCloud, objects, camPose);
                    viewer.render();

                    if (isPlayback && zedCamera.GetSVOPosition() == zedCamera.GetSVONumberOfFrames())
                    {
                        return;
                    }

                    Cv2.ImShow(window_name, imageLeftOcv);
                }
            }
        }
Esempio n. 11
0
        /**
         * 获取错误描述
         * @param [in] code 错误代码
         * @return 错误代码对应的错误描述
         */
        public static string GetErrorDescription(ERROR_CODE code)
        {
            string error = string.Empty;

            switch (code)
            {
            case ERROR_CODE.INVALID_CHANNEL_NAME:
                error = "无效的房间名称";
                break;

            case ERROR_CODE.ENTER_TIMEOUT:
                error = "超时,10秒未收到服务器返回结果";
                break;

            case ERROR_CODE.ENTER_FAILED:
                error = "无法连接服务器";
                break;

            case ERROR_CODE.ENTER_VERIFYFAILED:
                error = "验证码错误";
                break;

            case ERROR_CODE.ENTER_BADVERSION:
                error = "版本错误";
                break;

            case ERROR_CODE.ENTER_UNKNOWN:
                error = "未知错误";
                break;
            }
            ;
            return(error);
        }
Esempio n. 12
0
        // Render loop
        private void NativeWindow_Render(object sender, NativeWindowEventArgs e)
        {
            OpenGL.CoreUI.NativeWindow nativeWindow = (OpenGL.CoreUI.NativeWindow)sender;
            Gl.Viewport(0, 0, (int)nativeWindow.Width, (int)nativeWindow.Height);
            Gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            ERROR_CODE err = ERROR_CODE.FAILURE;

            if (viewer.isAvailable() && zedCamera.Grab(ref runtimeParameters) == ERROR_CODE.SUCCESS)
            {
                if (point_cloud.IsInit())
                {
                    // Retrieve Objects
                    err = zedCamera.RetrieveObjects(ref object_frame, ref obj_runtime_parameters);

                    if (err == ERROR_CODE.SUCCESS && object_frame.isNew != 0)
                    {
                        // Retrieve left image
                        zedCamera.RetrieveMeasure(point_cloud, sl.MEASURE.XYZRGBA, sl.MEM.CPU, res);
                        zedCamera.GetPosition(ref cam_pose, REFERENCE_FRAME.WORLD);
                        //Update GL View
                        viewer.update(point_cloud, object_frame, cam_pose);
                        viewer.render();
                    }
                }
            }
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            // Set Initialization parameters
            InitParameters init_params = new InitParameters();

            init_params.resolution       = RESOLUTION.HD720;
            init_params.cameraFPS        = 60;
            init_params.coordinateUnits  = UNIT.METER;
            init_params.coordinateSystem = COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP;
            init_params.depthMode        = DEPTH_MODE.PERFORMANCE;

            Camera zedCamera = new Camera(0);
            // Open the camera
            ERROR_CODE err = zedCamera.Open(ref init_params);

            if (err != ERROR_CODE.SUCCESS)
            {
                Environment.Exit(-1);
            }

            // Initialize runtime parameters and frame counter
            int i = 0;

            // Get resolution of camera
            uint mWidth  = (uint)zedCamera.ImageWidth;
            uint mHeight = (uint)zedCamera.ImageHeight;

            // Initialize the Mat that will contain the Point Cloud
            Mat depth_map = new Mat();

            depth_map.Create(mWidth, mHeight, MAT_TYPE.MAT_32F_C1, MEM.CPU); // Mat need to be created before use.

            // To avoid Nan Values, set to FILL to remove holes.
            RuntimeParameters runtimeParameters = new RuntimeParameters();

            runtimeParameters.sensingMode = SENSING_MODE.FILL;
            while (i < 1000)
            {
                if (zedCamera.Grab(ref runtimeParameters) == ERROR_CODE.SUCCESS)
                {
                    // Get the pose of the left eye of the camera with reference to the world frame
                    zedCamera.RetrieveMeasure(depth_map, MEASURE.XYZRGBA);
                    // Display the X, Y , Z at the center of the image
                    if (i % 10 == 0)
                    {
                        float4 xyz_value;
                        depth_map.GetValue((int)mWidth / 2, (int)mHeight / 2, out xyz_value, MEM.CPU);
                        Console.WriteLine("Depth At Image Center : (" + xyz_value.x + "," + xyz_value.y + "," + xyz_value.z + ")");
                    }

                    // increment frame count
                    i++;
                }
            }

            // Disable positional tracking and close the camera
            zedCamera.DisablePositionalTracking("");
            zedCamera.Close();
        }
 // 복사해와
 public void Copy(ActionContext info)
 {
     _error_code        = info._error_code;      // 에러 코드
     _jobTaskRun        = info._jobTaskRun;
     _runContexts       = info._runContexts;
     _callbackException = info._callbackException;
     isDone             = info.isDone;
 }
Esempio n. 15
0
        public ApiResultDto Result(ERROR_CODE code, object data = null)
        {
            if (code == ERROR_CODE.SUCCESS)
            {
                return(ResultSuccess(data));
            }

            return(ResultError(code));
        }
Esempio n. 16
0
        protected void SetStatus(bool valid, ERROR_CODE error, IPropertyDto <T> targetProperty)
        {
            targetProperty.Status = valid ? PROPERTY_STATUS.VALID : PROPERTY_STATUS.INVALID;

            if (!valid)
            {
                targetProperty.Code = error;
            }
        }
Esempio n. 17
0
        private void Reload_Click(object sender, RoutedEventArgs e)
        {
            ERROR_CODE res = LoadMap(buttons, MatrixSelection.SelectedIndex);

            if (res > ERROR_CODE.LOAD_WARNING_FILE_NOT_FOUND)
            {
                LogMessage(res.ToString());
            }
        }
Esempio n. 18
0
        void ResponseErrorLobbyChat(int sessionID, ERROR_CODE result)
        {
            var response = new JsonPacketNoticeChat()
            {
                Result = ERROR_CODE.ERROR
            };

            ServerNetworkRef.Send <JsonPacketNoticeChat>(sessionID, PACKET_ID.NOTICE_CHAT, response);
        }
        void ResponseLoginToClient(ERROR_CODE errorCode, string sessionID)
        {
            var resLogin = new LoginResPacket()
            {
                Result = (short)errorCode
            };

            ServerNetwork.SendData(sessionID, (UInt16)CL_PACKET_ID.RES_GAME_LOGIN, resLogin.ToBytes());
        }
Esempio n. 20
0
        public bool FromBytes(byte[] bodyData)
        {
            var unpack_msgpack = new SimpleMsgPack.MsgPack();

            unpack_msgpack.DecodeFromBytes(bodyData);

            ErrorCode = (ERROR_CODE)unpack_msgpack.ForcePathObject("ErrorCode").AsInteger;
            return(true);
        }
Esempio n. 21
0
        private async Task <ERROR_CODE> BleConnect(DeviceList idx, string devName)
        {
            ERROR_CODE result = ERROR_CODE.NONE;

            switch (idx)
            {
            case DeviceList.BLE1:
                result = ble1.StartScan(devName, (d) => { });
                showmessage1(result.ToString());
                if (result.Equals(ERROR_CODE.BLE_FOUND_DEVICE))
                {
                    result = await ble1.OpenDevice(devName);

                    showmessage1($"Connection Result: {result}");
                }
                ;
                break;

            case DeviceList.BLE2:
                result = ble2.StartScan(devName, (d) => { });
                showmessage2(result.ToString());
                if (result.Equals(ERROR_CODE.BLE_FOUND_DEVICE))
                {
                    result = await ble2.OpenDevice(devName);

                    showmessage2($"Connection Result: {result}");
                }
                ;
                break;

            case DeviceList.BLE3:
                result = ble3.StartScan(devName, (d) => { });
                showmessage3(result.ToString());
                if (result.Equals(ERROR_CODE.BLE_FOUND_DEVICE))
                {
                    result = await ble3.OpenDevice(devName);

                    showmessage3($"Connection Result: {result}");
                }
                ;
                break;

            case DeviceList.BLE4:
                result = ble4.StartScan(devName, (d) => { });
                showmessage4(result.ToString());
                if (result.Equals(ERROR_CODE.BLE_FOUND_DEVICE))
                {
                    result = await ble4.OpenDevice(devName);

                    showmessage4($"Connection Result: {result}");
                }
                ;
                break;
            }
            return(result);
        }
Esempio n. 22
0
        static void Main(string[] args)
        {
            // Set Initialization parameters
            InitParameters init_params = new InitParameters();

            init_params.resolution       = RESOLUTION.HD720;
            init_params.cameraFPS        = 60;
            init_params.coordinateUnits  = UNIT.METER;
            init_params.coordinateSystem = COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP;
            init_params.depthMode        = DEPTH_MODE.PERFORMANCE;

            Camera zedCamera = new Camera(0);
            // Open the camera
            ERROR_CODE err = zedCamera.Open(ref init_params);

            if (err != ERROR_CODE.SUCCESS)
            {
                Environment.Exit(-1);
            }

            PositionalTrackingParameters positionalTrackingParameters = new PositionalTrackingParameters();

            err = zedCamera.EnablePositionalTracking(ref positionalTrackingParameters);
            if (err != ERROR_CODE.SUCCESS)
            {
                Environment.Exit(-1);
            }

            int i = 0;

            sl.Pose pose = new Pose();

            RuntimeParameters runtimeParameters = new RuntimeParameters();

            while (i < 1000)
            {
                if (zedCamera.Grab(ref runtimeParameters) == ERROR_CODE.SUCCESS)
                {
                    // Get the pose of the left eye of the camera with reference to the world frame
                    zedCamera.GetPosition(ref pose, REFERENCE_FRAME.WORLD);

                    // Display the translation and timestamp each 10 frames
                    if (i % 10 == 0)
                    {
                        Console.WriteLine("Translation : " + pose.translation + ", Rotation : " + pose.rotation + ", Timestamp : " + pose.timestamp);
                    }

                    i++;
                }
            }

            // Disable positional tracking and close the camera
            zedCamera.DisablePositionalTracking("");
            zedCamera.Close();
        }
Esempio n. 23
0
    public static void DXLog(int code)
    {
        ERROR_CODE error_code = (ERROR_CODE)code;

        if (error_code != ERROR_CODE.NO_ERROR_CODE)
        {
            System.Windows.Forms.MessageBox.Show($"DirectX error:{error_code}");
        }

        Log($"DirectX error:{error_code}");
    }
Esempio n. 24
0
        // Render loop
        private void NativeWindow_Render(object sender, NativeWindowEventArgs e)
        {
            OpenGL.CoreUI.NativeWindow nativeWindow = (OpenGL.CoreUI.NativeWindow)sender;
            Gl.Viewport(0, 0, (int)nativeWindow.Width, (int)nativeWindow.Height);
            Gl.Clear(ClearBufferMask.ColorBufferBit);

            ERROR_CODE err = ERROR_CODE.FAILURE;

            if (viewer.isAvailable() && zedCamera.Grab(ref runtimeParameters) == ERROR_CODE.SUCCESS)
            {
                if (zedMat.IsInit())
                {
                    // Retrieve left image
                    err = zedCamera.RetrieveImage(zedMat, sl.VIEW.LEFT, sl.MEM.CPU);
                    // Update pose data (used for projection of the mesh over the current image)
                    tracking_state = zedCamera.GetPosition(ref cam_pose);

                    if (tracking_state == POSITIONAL_TRACKING_STATE.OK)
                    {
                        timer++;
                        if (userAction.hit)
                        {
                            Vector2 imageClick = new Vector2((float)userAction.hitCoord.X * (float)zedCamera.ImageWidth, (float)userAction.hitCoord.Y * (float)zedCamera.ImageHeight);
                            findPlaneStatus = zedCamera.findPlaneAtHit(ref plane, imageClick);
                            if (findPlaneStatus == ERROR_CODE.SUCCESS)
                            {
                                zedCamera.convertHitPlaneToMesh(planeMeshVertices, planeMeshTriangles, out nbVertices, out nbTriangles);
                            }
                            userAction.clear();
                        }
                        //if 500ms have spend since last request (for 60fps)
                        if (timer % 30 == 0 && userAction.pressSpace)
                        {
                            // Update pose data (used for projection of the mesh over the current image)
                            Quaternion priorQuat  = Quaternion.Identity;
                            Vector3    priorTrans = Vector3.Zero;
                            findPlaneStatus = zedCamera.findFloorPlane(ref plane, out float playerHeight, priorQuat, priorTrans);

                            if (findPlaneStatus == ERROR_CODE.SUCCESS)
                            {
                                zedCamera.convertFloorPlaneToMesh(planeMeshVertices, planeMeshTriangles, out nbVertices, out nbTriangles);
                            }
                            userAction.clear();
                        }
                    }
                    if (findPlaneStatus == ERROR_CODE.SUCCESS)
                    {
                        viewer.updateMesh(planeMeshVertices, planeMeshTriangles, nbVertices, nbTriangles, plane.Type, plane.Bounds, userAction);
                    }
                    viewer.updateImageAndState(zedMat, cam_pose, tracking_state);
                    viewer.render();
                }
            }
        }
Esempio n. 25
0
    public static string GetErrorString(ERROR_CODE errorcode, FontColor fc = FontColor.White)
    {
        int code = (int)errorcode;

        if (!DataManager.ErrorCodeStringTable.ContainsKey(code))
        {
            return("");
        }
        ErrorStringTableItem item = DataManager.ErrorCodeStringTable[code] as ErrorStringTableItem;

        return(fc == FontColor.White ? item.str : StringWithColor(fc, item.str));
    }
Esempio n. 26
0
        public async Task <ERROR_CODE> BleConnect(int index, string devName)
        {
            ERROR_CODE result = ERROR_CODE.NONE;

            result = ble[index].StartScan(devName, (d) => { });
            if (result.Equals(ERROR_CODE.BLE_FOUND_DEVICE))
            {
                result = await ble[index].OpenDevice(devName);
            }
            ;
            return(result);
        }
    private void Awake()
    {
        oldInitStatus = ERROR_CODE.ERROR_CODE_LAST;
        if (!ZEDManager.IsStereoRig) //Without VR, we use a Screen Space - Overlay canvas.
        {
            warningmono = Instantiate(Resources.Load("PrefabsUI/Warning") as GameObject, transform);
            warningmono.SetActive(true);
            textmono       = warningmono.GetComponentInChildren <Text>();
            textmono.color = Color.white;

            if (!ZEDCamera.CheckPlugin())
            {
                textmono.text = ZEDLogMessage.Error2Str(ZEDLogMessage.ERROR.SDK_NOT_INSTALLED);
            }
            imagemono = warningmono.transform.GetChild(0).GetChild(1).gameObject;
            imagemono.transform.parent.gameObject.SetActive(true);
            ready = false;
        }
        else //In VR, we use two Screen Space - Camera canvases, one for each eye.
        {
            //Setup the left warning prefab
            warningleft = Instantiate(Resources.Load("PrefabsUI/Warning_VR") as GameObject,
                                      ZEDManager.Instance.GetLeftCameraTransform());
            warningleft.SetActive(true);
            warningleft.GetComponent <Canvas>().worldCamera =
                ZEDManager.Instance.GetLeftCameraTransform().GetComponent <Camera>();
            warningleft.GetComponent <Canvas>().planeDistance = 1;
            textleft       = warningleft.GetComponentInChildren <Text>();
            textleft.color = Color.white;
            imageleft      = warningleft.transform.GetChild(0).GetChild(1).gameObject;
            imageleft.transform.parent.gameObject.SetActive(true);

            //Setup the right warning prefab
            warningright = Instantiate(Resources.Load("PrefabsUI/Warning_VR") as GameObject,
                                       ZEDManager.Instance.GetRightCameraTransform());
            warningright.SetActive(true);
            warningright.GetComponent <Canvas>().worldCamera =
                ZEDManager.Instance.GetRightCameraTransform().GetComponent <Camera>();
            warningright.GetComponent <Canvas>().planeDistance = 1;
            textright       = warningright.GetComponentInChildren <Text>();
            textright.color = Color.white;
            imageright      = warningright.transform.GetChild(0).GetChild(1).gameObject;
            imageright.transform.parent.gameObject.SetActive(true);

            if (!ZEDCamera.CheckPlugin())
            {
                textleft.text  = ZEDLogMessage.Error2Str(ZEDLogMessage.ERROR.SDK_NOT_INSTALLED);
                textright.text = ZEDLogMessage.Error2Str(ZEDLogMessage.ERROR.SDK_NOT_INSTALLED);
            }

            ready = false;
        }
    }
Esempio n. 28
0
        public void ResponseLoginToClient(ERROR_CODE errorCode, string sessionID)
        {
            var resLogin = new PKTResLogin()
            {
                Result = (short)errorCode
            };

            var bodyData = MessagePackSerializer.Serialize(resLogin);
            var sendData = PacketToBytes.Make(PACKETID.RES_LOGIN, bodyData);

            ServerNetwork.SendData(sessionID, sendData);
        }
Esempio n. 29
0
        public void NotifyMustCloseToClient(ERROR_CODE errorCode, string sessionID)
        {
            var resLogin = new PKNtfMustClose()
            {
                Result = (short)errorCode
            };

            var bodyData = MessagePackSerializer.Serialize(resLogin);
            var sendData = PacketToBytes.Make(PACKETID.NTF_MUST_CLOSE, bodyData);

            ServerNetwork.SendData(sessionID, sendData);
        }
Esempio n. 30
0
        void ResponseEnterRoomToClient(ERROR_CODE errorCode, string sessionID)
        {
            var resRoomEnter = new PKTResRoomEnter()
            {
                Result = (short)errorCode
            };

            var bodyData = MessagePackSerializer.Serialize(resRoomEnter);
            var sendData = PacketToBytes.Make(PACKETID.RES_ROOM_ENTER, bodyData);

            ServerNetwork.SendData(sessionID, sendData);
        }
Esempio n. 31
0
        ResponseData RequestLoginValue(ERROR_CODE result, RequestData dbRequest)
        {
            var reqponseData = new ResponseData()
            {
                PacketID = PACKET_ID.DB_RESPONSE_LOGIN,
                SessionID = dbRequest.SessionID,
                PacketProcessIndex = dbRequest.PacketProcessIndex,
            };

            var response = new DB.ResponseLogin() { Result = result, UserID = dbRequest.UserID };
            var serializer = MessagePackSerializer.Get<DB.ResponseLogin>();
            reqponseData.Datas = serializer.PackSingleObject(response);

            return reqponseData;
        }
Esempio n. 32
0
        void ResponseLeaveLobby(ERROR_CODE result, short lobbyID, string userID)
        {
            if (result == ERROR_CODE.NONE)
            {
                DevLog.Write(string.Format("[LeaveLobby] lobbyID:{0}, UserID:{1}", lobbyID, userID), LOG_LEVEL.INFO);
            }
            else
            {
                DevLog.Write(string.Format("[LeaveLobby 실패] lobbyID:{0}, UserID:{1}, result:{2}", lobbyID, userID, result.ToString()), LOG_LEVEL.ERROR);
            }

            var jsonData = new JsonPacketInnerNotifyLeaveLobby() { Result = result, LobbyID = lobbyID, UserID = userID };
            var bodyData = CGSFNETCommon.JsonEnDecode.Encode<JsonPacketInnerNotifyLeaveLobby>(jsonData);

            var InnerPacket = new CgsfNET64Lib.SFNETPacket();
            InnerPacket.SetData(-1, (ushort)PACKET_ID.INNER_NOTIFY_LEAVE_LOBBY, bodyData);
            RelayPacketPacketProcess.RelayPacket(0, InnerPacket);
        }
Esempio n. 33
0
 /// <summary>
 /// "Throw" error, displays MessageBox with error information
 /// </summary>
 /// <param name="err"></param>
 /// <param name="line"></param>
 /// <param name="comment"></param>
 public static void Error(ERROR_CODE err, int line, string comment)
 {
     c_curErr = err;
     // error string
     string s = string.Format("Error {0}: {1} at line: {2}\r\n{3}",
         (int) err, err.ToString(), line, comment);
     // add error to log
     AddToLog(s);
     // display window
     if (c_bShowWindow)  MessageBox.Show(
         s,
         "ERROR",
         MessageBoxButtons.OK,
         MessageBoxIcon.Error,
         MessageBoxDefaultButton.Button1,
         MessageBoxOptions.RightAlign);
 }
Esempio n. 34
0
 void ResponseErrorLobbyChat(int sessionID, ERROR_CODE result)
 {
     var response = new JsonPacketNoticeChat() { Result = ERROR_CODE.ERROR };
     ServerNetworkRef.Send<JsonPacketNoticeChat>(sessionID, PACKET_ID.NOTICE_CHAT, response);
 }
Esempio n. 35
0
        void ResponseLeaveLobby(int sessionID, ERROR_CODE result, short lobbyID)
        {
            if (result == ERROR_CODE.NONE)
            {
                DevLog.Write(string.Format("[LeaveLobby] lobbyID:{0}, sessionID:{1}", lobbyID, sessionID), LOG_LEVEL.INFO);
            }
            else
            {
                DevLog.Write(string.Format("[LeaveLobby 실패] lobbyID:{0}, sessionID:{1}, result:{2}", lobbyID, sessionID, result.ToString()), LOG_LEVEL.ERROR);
            }

            var response = new JsonPacketResponseLeaveLobby() { Result = result };
            ServerNetworkRef.Send<JsonPacketResponseLeaveLobby>(sessionID, PACKET_ID.RESPONSE_LEAVE_LOBBY, response);
        }
Esempio n. 36
0
		/// <summary>
		/// ChatをあらわすXmlを解析する
		/// </summary>
		/// <param name="str"></param>
		void parse(string str)
		{

			if (string.IsNullOrEmpty(str)) {
				throw new ArgumentException();
			}

			System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();

			try {

				xdoc.LoadXml(str);
				this.parse(xdoc.FirstChild);

			} catch (Exception) {
				this._errorCode = ERROR_CODE.Undefined;
			}


		}
Esempio n. 37
0
		/// <summary>
		/// ChatをあらわすXmlを解析する
		/// </summary>
		/// <param name="node"></param>
		void parse(System.Xml.XmlNode node)
		{

			if (node == null || !node.Name.Equals("chat")) {
				this._errorCode = ERROR_CODE.ParseError;
				return;
			}

			this._anonymity = (node.Attributes["anonymity"] != null);
			this._message = Utility.Unsanitizing(node.InnerText);
			this._no = Utility.SelectInt(node, "@no", 0);
			this._vpos = Utility.SelectInt(node, "@vpos", 0);
			this._mail = Utility.SelectString(node, "@mail");
			this._userId = Utility.SelectString(node, "@user_id");
			this._thread = Utility.SelectInt(node, "@thread", 0);
			this._date = Utility.SelectDateTime(node, "@date");
			this._premium = Utility.SelectInt(node, "@premium", 0);

			if (this.IsOwnerComment && this._message.StartsWith("/hb")) {
				this._userId = "hb";
			}

			//改行文字を統一
			this._message = this._message.Replace("\r\n", "\n").Replace("\n", "\r\n");
		}
Esempio n. 38
0
 /// <summary>
 /// Sets CPS_Exception error code
 /// </summary>
 /// <param name="code">Error code</param>
 /// <returns>Self (CPS_Exception).</returns>
 public CPS_Exception SetCode(ERROR_CODE code)
 {
     this.p_code = (int)code;
     return this;
 }