コード例 #1
0
        /// <summary>
        /// 设置光标;
        /// </summary>
        /// <exception cref="KeyNotFoundException"></exception>
        public static IDisposable SetCursor(string name)
        {
            name = name.ToLower();
            ICustomCursor cursor = cursors[name];

            return(WindowCursor.SetCursor(cursor));
        }
コード例 #2
0
        private static LinkedListNode <ICustomCursor> Add(ICustomCursor cursor)
        {
            currentCursor?.Dispose();
            currentCursor = cursor.Play(Default);
            var node = customCursorStack.AddLast(cursor);

            return(node);
        }
コード例 #3
0
        /// <summary>
        /// 设置光标;
        /// </summary>
        public static IDisposable SetCursor(ICustomCursor cursor)
        {
            if (cursor == null)
            {
                throw new ArgumentNullException(nameof(cursor));
            }

            return(WindowCursor.SetCursor(cursor));
        }
コード例 #4
0
 protected override void Attach(IControl control)
 {
     _isprite = control as ISpriteContent;
     _imouse  = control as IMouseInput;
     _ihitbox = control as ICustomHitBox;
     _icursor = control as ICustomCursor;
     if (_imouse != null || _ihitbox != null)
     {
         gameObject.AddComponent <BoxCollider>();
     }
 }
コード例 #5
0
        /// <summary>
        /// 设置当前鼠标样式,并返回取消方法;
        /// </summary>
        /// <exception cref="ArgumentNullException"></exception>
        public static IDisposable SetCursor(ICustomCursor cursor)
        {
            if (cursor == null)
            {
                throw new ArgumentNullException(nameof(cursor));
            }

            var node = Add(cursor);

            return(new Canceler(node));
        }
コード例 #6
0
 private static bool TryReadFromDirectory(string directory, out ICustomCursor cursor)
 {
     try
     {
         using (var content = new DirectoryContent(directory))
         {
             return(TryRead(content, out cursor));
         }
     }
     catch (Exception ex)
     {
         UnityEngine.Debug.Log(ex);
         cursor = null;
         return(false);
     }
 }
コード例 #7
0
 /// <summary>
 /// 尝试读取到光标文件;
 /// </summary>
 private static bool TryReadFromZip(string zipFilePath, out ICustomCursor cursor)
 {
     try
     {
         using (var content = new SharpZipLibContent(zipFilePath))
         {
             return(TryRead(content, out cursor));
         }
     }
     catch (Exception ex)
     {
         UnityEngine.Debug.Log(ex);
         cursor = null;
         return(false);
     }
 }
コード例 #8
0
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		internal void Build(ArcState pArcState, CursorState pCursorState, ICustomCursor pCustom, 
																		Transform pCameraTransform) {
			vArcState = pArcState;
			vCursorState = pCursorState;
			vCameraTx = pCameraTransform;

			////
			
			Type rendType = pCustom.GetCursorRenderer();

			vRendererHold = new GameObject("RendererHold");
			vRendererHold.transform.SetParent(gameObject.transform, false);

			vRendererObj = new GameObject("Renderer");
			vRendererObj.transform.SetParent(vRendererHold.transform, false);

			vRenderer = (IUiCursorRenderer)vRendererObj.AddComponent(rendType);
			vRenderer.Build(vArcState, vCursorState, pCustom.GetCursorSettings());
		}
コード例 #9
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        internal void Build(ArcState pArcState, CursorState pCursorState, ICustomCursor pCustom,
                            Transform pCameraTransform)
        {
            vArcState    = pArcState;
            vCursorState = pCursorState;
            vCameraTx    = pCameraTransform;

            ////

            Type rendType = pCustom.GetCursorRenderer();

            vRendererHold = new GameObject("RendererHold");
            vRendererHold.transform.SetParent(gameObject.transform, false);

            vRendererObj = new GameObject("Renderer");
            vRendererObj.transform.SetParent(vRendererHold.transform, false);

            vRenderer = (IUiCursorRenderer)vRendererObj.AddComponent(rendType);
            vRenderer.Build(vArcState, vCursorState, pCustom.GetCursorSettings());
        }
コード例 #10
0
 private static bool TryRead(IReadOnlyContent content, out ICustomCursor cursor)
 {
     try
     {
         cursor = staticCursorFactroy.Read(content);
         return(true);
     }
     catch
     {
         try
         {
             cursor = animatedCursorFactroy.Read(content);
             return(true);
         }
         catch
         {
             cursor = null;
             return(false);
         }
     }
 }