Пример #1
0
        private void SendMessage(FoldingStates state, FoldingPositionInfo folding)
        {
            var areaBeforeFolding = new TextRange();
            var areaAfterFolding  = new TextRange();

            if (state == FoldingStates.FOLDED)
            {
                areaBeforeFolding.StartPosition = folding.Position;
                areaBeforeFolding.EndPosition   = foldingPositions.First(pair => Equals(pair.Key, folding)).Value.Position;
                areaAfterFolding.StartPosition  = folding.Position;
                areaAfterFolding.EndPosition    = new TextPosition(column: folding.Position.Column + FoldingAlgorithm.GetCollapsibleRepresentation().Length, line: folding.Position.Line);
            }
            else
            {
                areaAfterFolding.StartPosition  = folding.Position;
                areaAfterFolding.EndPosition    = foldingPositions.First(pair => Equals(pair.Key, folding)).Value.Position;
                areaBeforeFolding.StartPosition = folding.Position;
                areaBeforeFolding.EndPosition   = new TextPosition(column: folding.Position.Column + FoldingAlgorithm.GetCollapsibleRepresentation().Length, line: folding.Position.Line);
            }

            Postbox.Put(new FoldClickedMessage {
                AreaBeforeFolding = areaBeforeFolding,
                AreaAfterFolding  = areaAfterFolding,
                ClosingTag        = FoldingAlgorithm.GetClosingTag(),
                OpeningTag        = FoldingAlgorithm.GetOpeningTag(),
                State             = state
            });
        }
Пример #2
0
        public EditorContext()
        {
            Postbox = Postbox.InstanceFor(EditorCode);
            Configuration.ConfigManager.AddEditorConfig(EditorCode, new Configuration.Config {
                Language       = SupportedLanguages.JS,
                FormattingType = FormattingType.BRACKETS
            });

            TextsToEnter      = new List <string>();
            CaretView         = new CaretView();
            TextView          = new TextView(CaretView);
            SelectionView     = new SelectionView(TextView);
            LinesView         = new LinesView();
            FoldingView       = new FoldingView();
            EnterTextCommand  = new EnterTextCommand(TextView, CaretView, SelectionView);
            RemoveTextCommand = new RemoveTextCommand(TextView, CaretView, SelectionView);
            CaretMoveCommand  = new CaretMoveCommand(CaretView, TextView);
            SelectionCommand  = new TextSelectionCommand(TextView, SelectionView, CaretView);

            CaretView.EditorCode     = EditorCode;
            CaretView.Postbox        = Postbox;
            TextView.EditorCode      = EditorCode;
            TextView.Postbox         = Postbox;
            SelectionView.EditorCode = EditorCode;
            SelectionView.Postbox    = Postbox;
            LinesView.EditorCode     = EditorCode;
            LinesView.Postbox        = Postbox;
            FoldingView.EditorCode   = EditorCode;
            FoldingView.Postbox      = Postbox;

            InitEvents();
            ForceDraw();
        }
Пример #3
0
 public XElement Serialize(string name)
 {
     return(new XElement(UblNames.Cac + name,
                         ID.Serialize(nameof(ID)),
                         AddressTypeCode.Serialize(nameof(AddressTypeCode)),
                         AddressFormatCode.Serialize(nameof(AddressFormatCode)),
                         Postbox.Serialize(nameof(Postbox)),
                         Floor.Serialize(nameof(Floor)),
                         Room.Serialize(nameof(Room)),
                         StreetName.Serialize(nameof(StreetName)),
                         AdditionalStreetName.Serialize(nameof(AdditionalStreetName)),
                         BlockName.Serialize(nameof(BlockName)),
                         BuildingName.Serialize(nameof(BuildingName)),
                         BuildingNumber.Serialize(nameof(BuildingNumber)),
                         InhouseMail.Serialize(nameof(InhouseMail)),
                         Department.Serialize(nameof(Department)),
                         MarkAttention.Serialize(nameof(MarkAttention)),
                         MarkCare.Serialize(nameof(MarkCare)),
                         PlotIdentification.Serialize(nameof(PlotIdentification)),
                         CitySubdivisionName.Serialize(nameof(CitySubdivisionName)),
                         CityName.Serialize(nameof(CityName)),
                         PostalZone.Serialize(nameof(PostalZone)),
                         CountrySubentity.Serialize(nameof(CountrySubentity)),
                         CountrySubentityCode.Serialize(nameof(CountrySubentityCode)),
                         Region.Serialize(nameof(Region)),
                         District.Serialize(nameof(District)),
                         TimezoneOffset.Serialize(nameof(TimezoneOffset)),
                         AddressLines?.Select(line => new XElement(UblNames.Cac + "AddressLine", line.Serialize("Line"))),
                         Country?.Serialize(),
                         LocationCoordinates?.Select(lc => lc.Serialize())
                         ));
 }
Пример #4
0
        public void SetUpMessaging()
        {
            postbox = Postbox.InstanceFor(this.GetEditor().GetHashCode());

            postbox.For <FoldClickedMessage>().Invoke(OnFoldClicked)
            .For <ScrollChangedMessage>().Invoke(OnScrollChanged);
        }
Пример #5
0
        public EditorContext() {
            Postbox = Postbox.InstanceFor(EditorCode);
            Configuration.ConfigManager.AddEditorConfig(EditorCode, new Configuration.Config {
                Language = SupportedLanguages.JS,
                FormattingType = FormattingType.BRACKETS
            });

            TextsToEnter = new List<string>();
            CaretView = new CaretView();
            TextView = new TextView(CaretView);
            SelectionView = new SelectionView(TextView);
            LinesView = new LinesView();
            FoldingView = new FoldingView();
            EnterTextCommand = new EnterTextCommand(TextView, CaretView, SelectionView);
            RemoveTextCommand = new RemoveTextCommand(TextView, CaretView, SelectionView);
            CaretMoveCommand = new CaretMoveCommand(CaretView, TextView);
            SelectionCommand = new TextSelectionCommand(TextView, SelectionView, CaretView);
            
            CaretView.EditorCode = EditorCode;
            CaretView.Postbox = Postbox;
            TextView.EditorCode = EditorCode;
            TextView.Postbox = Postbox;
            SelectionView.EditorCode = EditorCode;
            SelectionView.Postbox = Postbox;
            LinesView.EditorCode = EditorCode;
            LinesView.Postbox = Postbox;
            FoldingView.EditorCode = EditorCode;
            FoldingView.Postbox = Postbox;

            InitEvents();
            ForceDraw();
        }
Пример #6
0
 void Awake()
 {
     postbox     = Postbox_obj.GetInstance;
     instanceBox = Postbox_obj.GetInstance;
     exitBox     = Postbox.GetInstance;
     StartCoroutine(CheckQueue());
 }
        public void SetUpMessaging() {
            postbox = Postbox.InstanceFor(this.GetEditor().GetHashCode());

            postbox.For(typeof(TextAddedMessage)).Invoke(OnTextAdded)
                   .For(typeof(TextRemovedMessage)).Invoke(OnTextRemoved)
                   .For(typeof(LinesRemovedMessage)).Invoke(OnLineRemoved)
                   .For(typeof(FoldClickedMessage)).Invoke(OnFoldClicked);
        }
Пример #8
0
        public void SetUpMessaging()
        {
            postbox = Postbox.InstanceFor(this.GetEditor().GetHashCode());

            postbox.For(typeof(TextAddedMessage)).Invoke(OnTextAdded)
            .For(typeof(TextRemovedMessage)).Invoke(OnTextRemoved)
            .For(typeof(LinesRemovedMessage)).Invoke(OnLineRemoved)
            .For(typeof(FoldClickedMessage)).Invoke(OnFoldClicked);
        }
Пример #9
0
    private Postbox postbox;    //메세지 큐를 관리하는 우편함

    void Awake()
    {
        socket  = new SocketLib();
        postbox = Postbox.GetInstance;

        //큐 탐색 시작
        StartCoroutine(CheckQueue());
        //데이타 요청 시작
        RequestData();
    }
Пример #10
0
    private void SocketStart()
    {
        socket  = new SocketLib();
        postbox = Postbox.GetInstance;
        //큐 탐색 시작
        Debug.Log("큐 탐색 시작");
        StartCoroutine(CheckQueue());

        //데이타 요청 시작
        Debug.Log("요청 시작");
        RequestData();
    }
Пример #11
0
        private void OnScrollChanged(object sender, ScrollChangedEventArgs evt)
        {
            if (evt.VerticalChange != 0)
            {
                var firstIdx = (int)Math.Round(evt.VerticalOffset / TextConfiguration.GetCharSize().Height);
                var lastIdx  = (int)Math.Round((evt.VerticalOffset + evt.ViewportHeight) / TextConfiguration.GetCharSize().Height);

                Postbox.InstanceFor(GetHashCode()).Put(new ScrollChangedMessage {
                    FirstVisibleLineIndex = firstIdx,
                    LastVisibleLineIndex  = lastIdx,
                    LinesScrolled         = Math.Abs((int)Math.Ceiling(evt.VerticalChange / TextConfiguration.GetCharSize().Height))
                });
            }
        }
Пример #12
0
 void Awake()
 {
     postbox = Postbox.GetInstance;
     StartCoroutine(CheckQueue());
 }
Пример #13
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }

        if (transform.position.y <= -50.0f)
        {
            Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.PLAYER_WAS_AN_ID);
        }

        string overlayText = "";

        if (isAtHelm)
        {
            Ship.theShip.UpdateMovementControls();

            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;
            transform.localScale    = Vector3.one;
            head.localRotation      = Quaternion.identity;

            overlayText = Ship.theShip.GetOverlayText();            // Press W to accelerate, A/D to turn and Space/Shift to ascend/descend. Press F to leave.";
        }
        else
        {
            Ship.theShip.NotControlling();
            // Drag old motion
            if (cc.isGrounded)
            {
                motion.y = 0.0f;
            }
            motion *= 0.5f;

            // Get inputs
            yaw   += Input.GetAxis("Mouse X") * mouseSensitivity;
            pitch += Input.GetAxis("Mouse Y") * mouseSensitivity;

            Vector3 moveInput = new Vector3(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"));
            if (moveInput.sqrMagnitude > 1.0f)
            {
                moveInput.Normalize();
            }
            moveInput *= moveSpeed;

            // Cap rotations
            pitch = Mathf.Clamp(pitch, -90.0f, 90.0f);
            // Apply rotations
            transform.localEulerAngles = new Vector3(0.0f, yaw, 0.0f);
            head.localEulerAngles      = new Vector3(-pitch, 0.0f, 0.0f);


            // Apply motion
            motion   += transform.rotation * moveInput;
            motion.y -= 3.0f;
            cc.Move(motion * Time.deltaTime);
        }

        // Click to interact
        if (isAtHelm)
        {
            if (Input.GetKeyDown(KeyCode.F) || Input.GetKeyUp(KeyCode.E))
            {
                isAtHelm = false;
                transform.SetParent(Ship.theShip.transform);
            }
        }
        else
        {
            bool clicked = Input.GetKeyDown(KeyCode.F) || Input.GetKeyDown(KeyCode.E);

            RaycastHit hit;
            if (Physics.Raycast(new Ray(head.position, head.forward), out hit, 3.0f) &&
                hit.collider.gameObject != holding)
            {
                if (hit.collider.GetComponent <Helm>() != null)
                {
                    if (Ship.theShip.CanFly())
                    {
                        overlayText = "Press F to pilot the ship";
                        if (clicked)
                        {
                            isAtHelm = true;
                            transform.SetParent(Ship.theShip.standingPos);
                        }
                    }
                    else
                    {
                        overlayText = "Ship controls are locked";
                    }
                }
                else if (hit.collider.GetComponent <Button>() != null)
                {
                    switch (hit.collider.GetComponent <Button>().action)
                    {
                    case Button.Action.OPEN_DOOR:

                        overlayText = "Press F to open the door";
                        if (clicked)
                        {
                            RearDoor.theDoor.Open();
                            if (ObjectiveMarker.the.target == Ship.theShip.objectiveDoor)
                            {
                                ObjectiveMarker.the.target = null;
                            }
                        }
                        break;

                    case Button.Action.CLOSE_DOOR:
                        overlayText = "Press F to close the door";
                        if (clicked)
                        {
                            RearDoor.theDoor.Close();
                        }
                        break;
                    }
                }
                else if (hit.collider.GetComponentInParent <RearDoor>() != null)
                {
                    overlayText = "Locked. Please use door control panel to the right";
                }
                else if (hit.collider.GetComponent <EnginePanel>() != null)
                {
                    EnginePanel panel = hit.collider.GetComponent <EnginePanel>();
                    if (panel.hasComponent)
                    {
                        overlayText = "All patched up";
                    }
                    else
                    {
                        if (holding != null)
                        {
                            if (holding.GetComponent <EnginePart>() != null)
                            {
                                overlayText = $"Press F to place {holding.name}";
                                Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.READY_TO_PLACE);
                                if (clicked)
                                {
                                    holding.transform.SetParent(panel.socket);
                                    holding.transform.localPosition = Vector3.zero;
                                    holding.transform.localRotation = Quaternion.identity;
                                    holding.GetComponent <EnginePart>().slideTimer = 1.0f;
                                    panel.hasComponent = true;
                                    Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.READY_TO_FLY);
                                    holding = null;
                                }
                            }
                            else
                            {
                                overlayText = "That isn't the right part";
                            }
                        }
                        else
                        {
                            overlayText = "Something's missing from this engine";
                            Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.FETCH_COMPONENT);
                        }
                    }
                }
                else if (hit.collider.GetComponent <EnginePart>() != null)
                {
                    if (holding == null)
                    {
                        overlayText = $"Press F to pickup {hit.collider.name}";
                        if (clicked)
                        {
                            holding = hit.collider.gameObject;
                            holding.transform.SetParent(holdPos);
                            holding.transform.localPosition = Vector3.zero;
                            holding.transform.localRotation = Quaternion.identity;
                            Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.HAVE_COMPONENT);
                        }
                    }
                }
                else if (hit.collider.GetComponent <FuelCan>() != null)
                {
                    if (holding == null)
                    {
                        overlayText = $"Press F to pickup {hit.collider.name}";
                        if (clicked)
                        {
                            holding = hit.collider.gameObject;
                            holding.transform.SetParent(holdPos);
                            holding.transform.localPosition = Vector3.zero;
                            holding.transform.localRotation = Quaternion.identity;
                            Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.PLACE_FUEL_CAN);
                        }
                    }
                }
                else if (hit.collider.GetComponent <FuelReceptacle>() != null)
                {
                    FuelReceptacle receptacle = hit.collider.GetComponent <FuelReceptacle>();
                    if (holding == null)
                    {
                        overlayText = receptacle.hasFuel ? "Nicely topped up" : "Fuel level looks rather low";
                    }
                    else if (holding.GetComponent <FuelCan>() != null)
                    {
                        overlayText = "Press F to refuel the ship";
                        if (clicked)
                        {
                            Destroy(holding);
                            holding            = null;
                            receptacle.hasFuel = true;
                            Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.FLY_TO_MISSION2);
                        }
                    }
                }
                else if (hit.collider.GetComponent <Crate>() != null)
                {
                    if (holding == null && Ship.theShip.CanPickChest())
                    {
                        overlayText = $"Press F to pickup {hit.collider.name}";
                        Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.LOOK_AT_CHEST);
                        if (clicked)
                        {
                            holding = hit.collider.gameObject;
                            holding.transform.SetParent(holdPos);
                            holding.transform.localPosition = Vector3.zero;
                            holding.transform.localRotation = Quaternion.identity;
                            Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.DROPOFF_CHEST);
                        }
                    }
                }
                else if (hit.collider.GetComponent <Postbox>() != null)
                {
                    Postbox postbox = hit.collider.GetComponent <Postbox>();
                    if (holding == null)
                    {
                        overlayText = "Next collection: 17:00 Space-Tuesday";
                    }
                    else if (holding.GetComponent <Crate>() != null)
                    {
                        overlayText = $"Press F to post {hit.collider.name}";
                        if (clicked)
                        {
                            Destroy(holding);
                            holding = null;
                            Ship.theShip.TriggerStoryPhase(Ship.StoryPhase.FLY_TO_DOOM);
                        }
                    }
                }
            }
        }

        TheText.the.text.text = overlayText;
    }
Пример #14
0
 public void AddPostbox(Postbox box)
 {
     postboxes.Add(box);
 }
Пример #15
0
        public void SetUpMessaging() {
            postbox = Postbox.InstanceFor(this.GetEditor().GetHashCode());

            postbox.For<FoldClickedMessage>().Invoke(OnFoldClicked)
                   .For<ScrollChangedMessage>().Invoke(OnScrollChanged);
        }