public static Action <Entity> EntityAction(int actionID)
    {
        switch (actionID)
        {
        case 0:
            return(new Action <Entity>((target) =>
            {
                if (Vector3.Distance(EntityHandler.GetEntity <NPC>(0).transform.position, target.transform.position) <= 3f)
                {
                    ActionPacket packet = (ActionPacket)actionHandler.GetComponent(typeof(OpenChat));

                    if ((target as Player).questStateLib[0] <= 0)
                    {
                        GetPacket(typeof(OpenChat)).Invoke(target.id, 0);
                    }
                    else if ((target as Player).questStateLib[0] == 1)
                    {
                        GetPacket(typeof(OpenChat)).Invoke(target.id, 1);
                    }
                }
                else
                {
                    EntityHandler.DestroyEntity <Player>(target);
                }
            }));

        default:
            return(null);
        }
    }
示例#2
0
 private void Start()
 {
     pCam = this.GetComponentInChildren <Camera>();
     pCam.transform.rotation = new Quaternion(0, 0, 0, 0);
     verticalRotation        = transform.localEulerAngles.x;
     horizontalRotation      = EntityHandler.GetEntity <Character>(EntityGroup.PLAYER, Client.instance.myId).transform.eulerAngles.y;
 }
    private IEnumerator UpdateMinimap()
    {
        Character player = EntityHandler.GetEntity <Character>(EntityGroup.PLAYER, Client.instance.myId);

        if (player != null)
        {
            Vector3 ppos = player.transform.position;

            if (minimapCamera != null)
            {
                if (imageOut != null)
                {
                    minimapCamera.transform.position = new Vector3(ppos.x, minimapCamera.transform.position.y, ppos.z);
                }
                else
                {
                    Debug.Log("[Interface::Overlay]: Unable to find rendering image for minimap");
                }
            }
            else
            {
                Debug.Log("[Interface::Overlay]: Unable to find minimap camera out");
            }
        }


        yield return(new WaitForFixedUpdate());
    }
示例#4
0
    private void Look()
    {
        float _mouseVertical   = -Input.GetAxis("Mouse Y");
        float _mouseHorizontal = Input.GetAxis("Mouse X");

        verticalRotation   += _mouseVertical * sensitivity * Time.deltaTime;
        horizontalRotation += _mouseHorizontal * sensitivity * Time.deltaTime;

        verticalRotation = Mathf.Clamp(verticalRotation, -clampAngle, clampAngle);

        transform.localRotation = Quaternion.Euler(verticalRotation, 0f, 0f);

        EntityHandler.GetEntity(EntityGroup.PLAYER).transform.rotation = Quaternion.Euler(0f, horizontalRotation, 0f);
    }
示例#5
0
    public override void Invoke(params object[] parameters)
    {
        Debug.Log("Opening chat");
        int playerId = (int)parameters[0];
        int dialogID = (int)parameters[1];

        string formated_dialog = string.Format(DataHandler.GetNPCDialog(dialogID), EntityHandler.GetEntity <Player>(playerId).name);

        Debug.Log("Sending chat request");
        PacketHandler.SendPacket(playerId, ServerPacket.OPEN_CHAT, new Dictionary <string, object>()
        {
            { "dialog", formated_dialog }
        });
    }
示例#6
0
        protected override void OnStart(StartApplicationRequest request)
        {
            lock (_syncLock)
            {
                Platform.Log(LogLevel.Info, "Viewer Application is starting...");
                if (Application.Instance == null)
                {
                    Platform.StartApp("ClearCanvas.Desktop.Application", new string[] { "-r" });
                }
            }



            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
            {
                Platform.Log(LogLevel.Debug, "Finding studies...");
            }
            var startRequest = (StartViewerApplicationRequest)request;
            IList <StudyRootStudyIdentifier> studies = FindStudies(startRequest);

            List <LoadStudyArgs> loadArgs = CollectionUtils.Map(studies, (StudyRootStudyIdentifier identifier) => CreateLoadStudyArgs(identifier));

            DesktopWindowCreationArgs args   = new DesktopWindowCreationArgs("", Identifier.ToString());
            WebDesktopWindow          window = new WebDesktopWindow(args, Application.Instance);

            window.Open();

            _viewer = CreateViewerComponent(startRequest);

            try
            {
                if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                {
                    Platform.Log(LogLevel.Debug, "Loading study...");
                }
                _viewer.LoadStudies(loadArgs);
            }
            catch (Exception e)
            {
                if (!AnySopsLoaded(_viewer))                 //end the app.
                {
                    throw;
                }

                //Show an error and continue.
                ExceptionHandler.Report(e, window);
            }

            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
            {
                Platform.Log(LogLevel.Info, "Launching viewer...");
            }

            ImageViewerComponent.Launch(_viewer, window, "");

            _viewerHandler = EntityHandler.Create <ViewerEntityHandler>();
            _viewerHandler.SetModelObject(_viewer);
            _app = new Common.ViewerApplication
            {
                Identifier = Identifier,
                Viewer     = (Viewer)_viewerHandler.GetEntity(),

                VersionString = GetProductVersionString()
            };


            // Push the ViewerApplication object to the client
            Event @event = new PropertyChangedEvent
            {
                PropertyName = "Application",
                Value        = _app,
                Identifier   = Guid.NewGuid(),
                SenderId     = request.Identifier
            };

            ApplicationContext.Current.FireEvent(@event);
        }
示例#7
0
	    protected override void OnStart(StartApplicationRequest request)
		{
			lock (_syncLock)
			{
                Platform.Log(LogLevel.Info, "Viewer Application is starting...");
                if (Application.Instance == null)
					Platform.StartApp("ClearCanvas.Desktop.Application",new string[] {"-r"});
			}

            


            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                Platform.Log(LogLevel.Debug, "Finding studies...");
			var startRequest = (StartViewerApplicationRequest)request;
			IList<StudyRootStudyIdentifier> studies = FindStudies(startRequest);

			List<LoadStudyArgs> loadArgs = CollectionUtils.Map(studies, (StudyRootStudyIdentifier identifier) => CreateLoadStudyArgs(identifier));

		    DesktopWindowCreationArgs args = new DesktopWindowCreationArgs("", Identifier.ToString());
            WebDesktopWindow window = new WebDesktopWindow(args, Application.Instance);
            window.Open();

            _viewer = CreateViewerComponent(startRequest);

			try
			{
                if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                    Platform.Log(LogLevel.Debug, "Loading study...");
                _viewer.LoadStudies(loadArgs);
			}
			catch (Exception e)
			{
				if (!AnySopsLoaded(_viewer)) //end the app.
                    throw;

				//Show an error and continue.
				ExceptionHandler.Report(e, window);
			}

            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                Platform.Log(LogLevel.Info, "Launching viewer...");
			
			ImageViewerComponent.Launch(_viewer, window, "");

			_viewerHandler = EntityHandler.Create<ViewerEntityHandler>();
			_viewerHandler.SetModelObject(_viewer);
		    _app = new Common.ViewerApplication
		               {
		                   Identifier = Identifier,
		                   Viewer = (Viewer) _viewerHandler.GetEntity(),

                           VersionString = GetProductVersionString()
                                
			           };
            

            // Push the ViewerApplication object to the client
            Event @event = new PropertyChangedEvent
            {
                PropertyName = "Application",
                Value = _app,
                Identifier = Guid.NewGuid(),
                SenderId = request.Identifier
            };

            ApplicationContext.Current.FireEvent(@event);
		}