示例#1
0
 private void TrayIcon_Shown(object o, EventArgs e)
 {
     try
     {
         Hide();
         GlobalHandle            = Handle;
         Globals.ProgramShutDown = ProgramShutDown;
         InitFunction.Init();
         KeyboardHooker.HookStart();
         if (Settings.IsFixClipboard)
         {
             ClipboardConverter.FixStart();
         }
         MainWorker.RunWorkers();
         commandList.Register("rl", "기", args => Invoke(new Action <string[]>(InitRoomListForm), args));
         channel = new ChannelChatForm();
         InitBanList();
         channel.ChatTimer.Enabled = Settings.IsChannelChatDetect;
         InitMainForm();
         main.Show();
         main.Activate();
         CheckLatestVersion();
         DebugWarcraftOutput();
     }
     catch (Exception ex)
     {
         ExceptionSender.ExceptionSendAsync(ex, true);
         MessageBox.Show(this, "설정 불러오기에 실패하여, 설정을 초기화 해야합니다.", "불러오기 실패", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         Application.ExitThread();
         Environment.Exit(0);
     }
 }
示例#2
0
        public Task <TransactionReceipt> InitRequestAndWaitForReceiptAsync(string newDestination, CancellationTokenSource cancellationToken = null)
        {
            var initFunction = new InitFunction();

            initFunction.NewDestination = newDestination;

            return(ContractHandler.SendRequestAndWaitForReceiptAsync(initFunction, cancellationToken));
        }
示例#3
0
        public Task <string> InitRequestAsync(string newDestination)
        {
            var initFunction = new InitFunction();

            initFunction.NewDestination = newDestination;

            return(ContractHandler.SendRequestAsync(initFunction));
        }
示例#4
0
 public Animation(InitFunction init, UpdateFunction update, CompletionPredicate pred, Callback callback = null, bool autoUpdate = true)
 {
     initFn              = init;
     updateFn            = update;
     completionPredicate = pred;
     this.callback       = callback;
     initialised         = false;
     completed           = false;
     this.autoUpdate     = autoUpdate;
 }
示例#5
0
        public string GetFullCode()
        {
            string code = "scheme {\r\n";

            foreach (ObjectVariable param in Parameters)
            {
                code += $"\tparam {param.Type} {param.Name}\r\n";
            }

            foreach (ObjectVariable variable in Variables)
            {
                code += $"\t{variable.Type} {variable.Name}\r\n";
            }

            code += "\r\n";
            if (BodyFunction != null)
            {
                string bodyCode = BodyFunction.GetCode(1);
                if (bodyCode != "")
                {
                    code += bodyCode + "\r\n";
                }
            }

            code += "\tinit {\r\n";
            if (InitFunction != null)
            {
                code += InitFunction.GetCode(2);
            }
            code += "\t}\r\n";

            foreach (SchemeFunction action in ActionFunctions)
            {
                code += $"\r\n\taction {action.Name} ({action.ActionPoints}) " + "{\r\n";
                code += action.GetCode(2);
                code += "\t}\r\n";
            }

            code += "}";
            return(code);
        }
示例#6
0
 public void Init(Object @object, Game game)
 {
     InitFunction?.Execute(@object, null, game);
 }
        internal static Vector3 DoPlanarHandle(int id, PrincipleAxis2 planeID, Vector3 position, Quaternion rotation, float handleSize, bool snapping, Vector3[] snapVertices, CSGHandles.InitFunction initFunction, InitFunction shutdownFunction = null)
        {
            int axis1index = 0;
            int axis2index = 0;
            var isStatic   = (!Tools.hidden && EditorApplication.isPlaying && ContainsStatic(Selection.gameObjects));

            switch (planeID)
            {
            case PrincipleAxis2.XZ:
            {
                axis1index    = 0;
                axis2index    = 2;
                Handles.color = isStatic? staticColor : Handles.yAxisColor;
                break;
            }

            case PrincipleAxis2.XY:
            {
                axis1index    = 0;
                axis2index    = 1;
                Handles.color = isStatic? staticColor : Handles.zAxisColor;
                break;
            }

            case PrincipleAxis2.YZ:
            {
                axis1index    = 1;
                axis2index    = 2;
                Handles.color = isStatic? staticColor : Handles.xAxisColor;
                break;
            }
            }

            int axisNormalIndex = 3 - axis2index - axis1index;
            var prevColor       = Handles.color;

            var handleTransform             = Matrix4x4.TRS(position, rotation, Vector3.one);
            var sceneView                   = SceneView.currentDrawingSceneView;
            var cameraToTransformToolVector = handleTransform.inverse.MultiplyPoint(sceneView.camera.transform.position).normalized;

            if (Mathf.Abs(cameraToTransformToolVector[axisNormalIndex]) < 0.05f && GUIUtility.hotControl != id)
            {
                Handles.color = prevColor;
                return(position);
            }

            if (EditorGUIUtility.hotControl == 0)
            {
                s_PlanarHandlesOctant[axis1index] = (cameraToTransformToolVector[axis1index] < -0.01f ? -1 : 1);
                s_PlanarHandlesOctant[axis2index] = (cameraToTransformToolVector[axis2index] < -0.01f ? -1 : 1);
            }
            var handleOffset = s_PlanarHandlesOctant;

            handleOffset[axisNormalIndex] = 0;
            handleOffset = rotation * (handleOffset * handleSize * 0.5f);

            var axis1      = Vector3.zero;
            var axis2      = Vector3.zero;
            var axisNormal = Vector3.zero;

            axis1[axis1index]           = 1;
            axis2[axis2index]           = 1;
            axisNormal[axisNormalIndex] = 1;
            axis1      = rotation * axis1;
            axis2      = rotation * axis2;
            axisNormal = rotation * axisNormal;

            s_Vertices[0] = position + handleOffset + (axis1 + axis2) * handleSize * 0.5f;
            s_Vertices[1] = position + handleOffset + (-axis1 + axis2) * handleSize * 0.5f;
            s_Vertices[2] = position + handleOffset + (-axis1 - axis2) * handleSize * 0.5f;
            s_Vertices[3] = position + handleOffset + (axis1 - axis2) * handleSize * 0.5f;

            var innerColor = Handles.color;
            var outerColor = Color.black;

            innerColor = new Color(innerColor.r, innerColor.g, innerColor.b, 0.1f);
            if (CSGHandles.disabled)
            {
                innerColor = Handles.secondaryColor;
                outerColor = innerColor;
            }
            Handles.DrawSolidRectangleWithOutline(s_Vertices, innerColor, outerColor);

            position = Slider2D(id, position, handleOffset, axisNormal, axis1, axis2, handleSize * 0.5f, RectangleHandleCap, snapping, snapVertices, initFunction, shutdownFunction);

            Handles.color = prevColor;

            return(position);
        }
        internal static Vector3 DoPlanarHandle(PrincipleAxis2 planeID, Vector3 position, Quaternion rotation, float handleSize, bool snapping, Vector3[] snapVertices, CSGHandles.InitFunction initFunction, InitFunction shutdownFunction = null)
        {
            int moveHandleHash = 0;

            switch (planeID)
            {
            case PrincipleAxis2.XZ:
            {
                moveHandleHash = s_xzAxisMoveHandleHash;
                break;
            }

            case PrincipleAxis2.XY:
            {
                moveHandleHash = s_xyAxisMoveHandleHash;
                break;
            }

            case PrincipleAxis2.YZ:
            {
                moveHandleHash = s_yzAxisMoveHandleHash;
                break;
            }
            }
            int id = GUIUtility.GetControlID(moveHandleHash, FocusType.Keyboard);

            return(DoPlanarHandle(id, planeID, position, rotation, handleSize, snapping, snapVertices, initFunction, shutdownFunction));
        }
        public static Vector3 PositionHandle(Vector3 position, Quaternion rotation, bool snapping, Vector3[] snapVertices = null, InitFunction initFunction = null, InitFunction shutdownFunction = null)
        {
            var xAxisSlider   = GUIUtility.GetControlID(s_SliderHash, FocusType.Keyboard);
            var yAxisSlider   = GUIUtility.GetControlID(s_SliderHash, FocusType.Keyboard);
            var zAxisSlider   = GUIUtility.GetControlID(s_SliderHash, FocusType.Keyboard);
            var xzPlaneSlider = GUIUtility.GetControlID(s_xzAxisMoveHandleHash, FocusType.Keyboard);
            var xyPlaneSlider = GUIUtility.GetControlID(s_xyAxisMoveHandleHash, FocusType.Keyboard);
            var yzPlaneSlider = GUIUtility.GetControlID(s_yzAxisMoveHandleHash, FocusType.Keyboard);


            var size          = HandleUtility.GetHandleSize(position);
            var originalColor = Handles.color;
            var isStatic      = (!Tools.hidden && EditorApplication.isPlaying && ContainsStatic(Selection.gameObjects));

            var prevDisabled = CSGHandles.disabled;

            CSGHandles.disabled = prevDisabled || RealtimeCSG.CSGSettings.LockAxisX;
            {
                Handles.color = isStatic ? Color.Lerp(Handles.xAxisColor, staticColor, staticBlend) : Handles.xAxisColor;
                GUI.SetNextControlName("xAxis");
                position = CSGSlider1D.Do(xAxisSlider, position, rotation * Vector3.right, size, ArrowHandleCap, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || RealtimeCSG.CSGSettings.LockAxisY;
            {
                Handles.color = isStatic ? Color.Lerp(Handles.yAxisColor, staticColor, staticBlend) : Handles.yAxisColor;
                GUI.SetNextControlName("yAxis");
                position = CSGSlider1D.Do(yAxisSlider, position, rotation * Vector3.up, size, ArrowHandleCap, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || RealtimeCSG.CSGSettings.LockAxisZ;
            {
                Handles.color = isStatic ? Color.Lerp(Handles.zAxisColor, staticColor, staticBlend) : Handles.zAxisColor;
                GUI.SetNextControlName("zAxis");
                position = CSGSlider1D.Do(zAxisSlider, position, rotation * Vector3.forward, size, ArrowHandleCap, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || (RealtimeCSG.CSGSettings.LockAxisX || RealtimeCSG.CSGSettings.LockAxisZ);
            if (!CSGHandles.disabled)
            {
                position = DoPlanarHandle(xzPlaneSlider, PrincipleAxis2.XZ, position, rotation, size * 0.25f, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || (RealtimeCSG.CSGSettings.LockAxisX || RealtimeCSG.CSGSettings.LockAxisY);
            if (!CSGHandles.disabled)
            {
                position = DoPlanarHandle(xyPlaneSlider, PrincipleAxis2.XY, position, rotation, size * 0.25f, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || (RealtimeCSG.CSGSettings.LockAxisY || RealtimeCSG.CSGSettings.LockAxisZ);
            if (!CSGHandles.disabled)
            {
                position = DoPlanarHandle(yzPlaneSlider, PrincipleAxis2.YZ, position, rotation, size * 0.25f, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled;
            Handles.color       = originalColor;

            return(position);
        }
 public static Vector3 Slider2D(int id, Vector3 handlePos, Vector3 offset, Vector3 handleDir, Vector3 slideDir1, Vector3 slideDir2, float handleSize, CapFunction capFunction, bool snapping, Vector3[] snapVertices, InitFunction initFunction, InitFunction shutdownFunction)
 {
     return(CSGSlider2D.Do(id, handlePos, offset, handleDir, slideDir1, slideDir2, handleSize, capFunction, snapping, snapVertices, initFunction, shutdownFunction));
 }
        public static Vector3 Slider(Vector3 position, Vector3 direction, float size, CapFunction capFunction, bool snapping, Vector3[] snapVertices, InitFunction initFunction, InitFunction shutdownFunction)
        {
            var id = GUIUtility.GetControlID(s_SliderHash, FocusType.Keyboard);

            return(CSGSlider1D.Do(id, position, direction, size, capFunction, snapping, snapVertices, initFunction, shutdownFunction));
        }
示例#12
0
 public Task <TransactionReceipt> InitRequestAndWaitForReceiptAsync(InitFunction initFunction, CancellationTokenSource cancellationToken = null)
 {
     return(ContractHandler.SendRequestAndWaitForReceiptAsync(initFunction, cancellationToken));
 }
示例#13
0
 public Task <string> InitRequestAsync(InitFunction initFunction)
 {
     return(ContractHandler.SendRequestAsync(initFunction));
 }
示例#14
0
        public static Vector3 PositionHandle(Camera camera, Vector3 position, Quaternion rotation, SnapMode snapMode, Vector3[] snapVertices = null, InitFunction initFunction = null, InitFunction shutdownFunction = null)
        {
            GUI.SetNextControlName("xAxis");   var xAxisSlider   = GUIUtility.GetControlID(s_xAxisMoveHandleHash, FocusType.Passive);
            GUI.SetNextControlName("yAxis");   var yAxisSlider   = GUIUtility.GetControlID(s_yAxisMoveHandleHash, FocusType.Passive);
            GUI.SetNextControlName("zAxis");   var zAxisSlider   = GUIUtility.GetControlID(s_zAxisMoveHandleHash, FocusType.Passive);
            GUI.SetNextControlName("xzPlane"); var xzPlaneSlider = GUIUtility.GetControlID(s_xzAxisMoveHandleHash, FocusType.Passive);
            GUI.SetNextControlName("xyPlane"); var xyPlaneSlider = GUIUtility.GetControlID(s_xyAxisMoveHandleHash, FocusType.Passive);
            GUI.SetNextControlName("yzPlane"); var yzPlaneSlider = GUIUtility.GetControlID(s_yzAxisMoveHandleHash, FocusType.Passive);

            var isStatic     = (!Tools.hidden && EditorApplication.isPlaying && ContainsStatic(Selection.gameObjects));
            var prevDisabled = CSGHandles.disabled;

            var hotControl = GUIUtility.hotControl;

            var xAxisIsHot  = (xAxisSlider == hotControl);
            var yAxisIsHot  = (yAxisSlider == hotControl);
            var zAxisIsHot  = (zAxisSlider == hotControl);
            var xzAxisIsHot = (xzPlaneSlider == hotControl);
            var xyAxisIsHot = (xyPlaneSlider == hotControl);
            var yzAxisIsHot = (yzPlaneSlider == hotControl);

            var isControlHot = xAxisIsHot || yAxisIsHot || zAxisIsHot || xzAxisIsHot || xyAxisIsHot || yzAxisIsHot;

            var size          = HandleUtility.GetHandleSize(position);
            var originalColor = Handles.color;

            var lockedAxisX = RealtimeCSG.CSGSettings.LockAxisX;
            var lockedAxisY = RealtimeCSG.CSGSettings.LockAxisY;
            var lockedAxisZ = RealtimeCSG.CSGSettings.LockAxisZ;

            var lockedAxisXY = lockedAxisX || lockedAxisY;
            var lockedAxisXZ = lockedAxisX || lockedAxisZ;
            var lockedAxisYZ = lockedAxisY || lockedAxisZ;


            //,.,.., look at 2018.1 how the position handle works w/ colors

            var xAxisDisabled   = isStatic || prevDisabled || lockedAxisX || (isControlHot && !xAxisIsHot && !xzAxisIsHot && !xyAxisIsHot);
            var yAxisDisabled   = isStatic || prevDisabled || lockedAxisY || (isControlHot && !yAxisIsHot && !xyAxisIsHot && !yzAxisIsHot);
            var zAxisDisabled   = isStatic || prevDisabled || lockedAxisZ || (isControlHot && !zAxisIsHot && !xzAxisIsHot && !yzAxisIsHot);
            var xzPlaneDisabled = isStatic || prevDisabled || lockedAxisXZ || (isControlHot && !xzAxisIsHot);
            var xyPlaneDisabled = isStatic || prevDisabled || lockedAxisXY || (isControlHot && !xyAxisIsHot);
            var yzPlaneDisabled = isStatic || prevDisabled || lockedAxisYZ || (isControlHot && !yzAxisIsHot);

            var currentFocusControl = FocusControl;

            var xAxisIndirectlyFocused = (currentFocusControl == xyPlaneSlider || currentFocusControl == xzPlaneSlider);
            var yAxisIndirectlyFocused = (currentFocusControl == xyPlaneSlider || currentFocusControl == yzPlaneSlider);
            var zAxisIndirectlyFocused = (currentFocusControl == xzPlaneSlider || currentFocusControl == yzPlaneSlider);

            var xAxisSelected = xAxisIndirectlyFocused || (currentFocusControl == xAxisSlider);
            var yAxisSelected = yAxisIndirectlyFocused || (currentFocusControl == yAxisSlider);
            var zAxisSelected = zAxisIndirectlyFocused || (currentFocusControl == zAxisSlider);
            var xzAxiSelected = (currentFocusControl == xAxisSlider || currentFocusControl == zAxisSlider);
            var xyAxiSelected = (currentFocusControl == xAxisSlider || currentFocusControl == yAxisSlider);
            var yzAxiSelected = (currentFocusControl == yAxisSlider || currentFocusControl == zAxisSlider);

            var xAxisColor   = CSGHandles.StateColor(Handles.xAxisColor, xAxisDisabled, xAxisSelected);
            var yAxisColor   = CSGHandles.StateColor(Handles.yAxisColor, yAxisDisabled, yAxisSelected);
            var zAxisColor   = CSGHandles.StateColor(Handles.zAxisColor, zAxisDisabled, zAxisSelected);
            var xzPlaneColor = CSGHandles.StateColor(Handles.yAxisColor, xzPlaneDisabled, xzAxiSelected);
            var xyPlaneColor = CSGHandles.StateColor(Handles.zAxisColor, xyPlaneDisabled, xyAxiSelected);
            var yzPlaneColor = CSGHandles.StateColor(Handles.xAxisColor, yzPlaneDisabled, yzAxiSelected);


            CSGHandles.disabled = xAxisDisabled;
            {
                Handles.color = xAxisColor;

                position = CSGSlider1D.Do(camera, xAxisSlider, position, rotation * Vector3.right, size, ArrowHandleCap, snapMode, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = yAxisDisabled;
            {
                Handles.color = yAxisColor;

                position = CSGSlider1D.Do(camera, yAxisSlider, position, rotation * Vector3.up, size, ArrowHandleCap, snapMode, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = zAxisDisabled;
            {
                Handles.color = zAxisColor;

                position = CSGSlider1D.Do(camera, zAxisSlider, position, rotation * Vector3.forward, size, ArrowHandleCap, snapMode, snapVertices, initFunction, shutdownFunction);
            }


            CSGHandles.disabled = xzPlaneDisabled;
            if (!CSGHandles.disabled)
            {
                Handles.color = xzPlaneColor;
                position      = DoPlanarHandle(camera, xzPlaneSlider, PrincipleAxis2.XZ, position, rotation, size * 0.25f, snapMode, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = xyPlaneDisabled;
            if (!CSGHandles.disabled)
            {
                Handles.color = xyPlaneColor;
                position      = DoPlanarHandle(camera, xyPlaneSlider, PrincipleAxis2.XY, position, rotation, size * 0.25f, snapMode, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = yzPlaneDisabled;
            if (!CSGHandles.disabled)
            {
                Handles.color = yzPlaneColor;
                position      = DoPlanarHandle(camera, yzPlaneSlider, PrincipleAxis2.YZ, position, rotation, size * 0.25f, snapMode, snapVertices, initFunction, shutdownFunction);
            }


            CSGHandles.disabled = prevDisabled;
            Handles.color       = originalColor;

            return(position);
        }
示例#15
0
 public static Vector3 Slider2D(Camera camera, int id, Vector3 handlePos, Vector3 offset, Vector3 handleDir, Vector3 slideDir1, Vector3 slideDir2, float handleSize, CapFunction capFunction, SnapMode snapMode, Vector3[] snapVertices, InitFunction initFunction, InitFunction shutdownFunction)
 {
     return(CSGSlider2D.Do(camera, id, handlePos, offset, handleDir, slideDir1, slideDir2, handleSize, capFunction, snapMode, snapVertices, initFunction, shutdownFunction));
 }
示例#16
0
        public static Vector3 PositionHandle(Vector3 position, Quaternion rotation, bool snapping, Vector3[] snapVertices = null, InitFunction initFunction = null, InitFunction shutdownFunction = null)
        {
            var size          = HandleUtility.GetHandleSize(position);
            var originalColor = Handles.color;
            var isStatic      = (!Tools.hidden && EditorApplication.isPlaying && ContainsStatic(Selection.gameObjects));

            var prevDisabled = CSGHandles.disabled;

            CSGHandles.disabled = prevDisabled || RealtimeCSG.CSGSettings.LockAxisX;
            {
                Handles.color = isStatic ? Color.Lerp(Handles.xAxisColor, staticColor, staticBlend) : Handles.xAxisColor;
                GUI.SetNextControlName("xAxis");
                position = Slider(position, rotation * Vector3.right, size, ArrowHandleCap, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || RealtimeCSG.CSGSettings.LockAxisY;
            {
                Handles.color = isStatic ? Color.Lerp(Handles.yAxisColor, staticColor, staticBlend) : Handles.yAxisColor;
                GUI.SetNextControlName("yAxis");
                position = Slider(position, rotation * Vector3.up, size, ArrowHandleCap, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || RealtimeCSG.CSGSettings.LockAxisZ;
            {
                Handles.color = isStatic ? Color.Lerp(Handles.zAxisColor, staticColor, staticBlend) : Handles.zAxisColor;
                GUI.SetNextControlName("zAxis");
                position = Slider(position, rotation * Vector3.forward, size, ArrowHandleCap, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || (RealtimeCSG.CSGSettings.LockAxisX || RealtimeCSG.CSGSettings.LockAxisZ);
            if (!CSGHandles.disabled)
            {
                position = DoPlanarHandle(PlaneHandle.xzPlane, position, rotation, size * 0.25f, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || (RealtimeCSG.CSGSettings.LockAxisX || RealtimeCSG.CSGSettings.LockAxisY);
            if (!CSGHandles.disabled)
            {
                position = DoPlanarHandle(PlaneHandle.xyPlane, position, rotation, size * 0.25f, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled || (RealtimeCSG.CSGSettings.LockAxisY || RealtimeCSG.CSGSettings.LockAxisZ);
            if (!CSGHandles.disabled)
            {
                position = DoPlanarHandle(PlaneHandle.yzPlane, position, rotation, size * 0.25f, snapping, snapVertices, initFunction, shutdownFunction);
            }

            CSGHandles.disabled = prevDisabled;
            Handles.color       = originalColor;

            return(position);
        }