/// <summary> /// 设置光标; /// </summary> /// <exception cref="KeyNotFoundException"></exception> public static IDisposable SetCursor(string name) { name = name.ToLower(); ICustomCursor cursor = cursors[name]; return(WindowCursor.SetCursor(cursor)); }
private static LinkedListNode <ICustomCursor> Add(ICustomCursor cursor) { currentCursor?.Dispose(); currentCursor = cursor.Play(Default); var node = customCursorStack.AddLast(cursor); return(node); }
/// <summary> /// 设置光标; /// </summary> public static IDisposable SetCursor(ICustomCursor cursor) { if (cursor == null) { throw new ArgumentNullException(nameof(cursor)); } return(WindowCursor.SetCursor(cursor)); }
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>(); } }
/// <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)); }
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); } }
/// <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); } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ 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()); }
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); } } }