想批量整理些散图到特定UI包里,求插件示例代码!

试过使用App.libView:MoveResources接口,但是每调用一次接口后都会弹框提示,
想忽略这个确认提示直接确认
Dingtalk_20201017154850.jpg


还有一种方式是使用CopyHandler,因为没有详细文档,看着接口尝试调用还是没成功
求CopyHandler的示例代码
 
已邀请:

谷主

赞同来自:

MoveResources用的就是CopyHandler,只是加了提示。所以可以直接使用CopyHandler,示例代码:
 
CopyHandler copyHandler = new CopyHandler();
copyHandler.InitWithItems(items, targetPkg, dropTarget.id, DependencyQuery.SeekLevel.SELECTION);
copyHandler.Copy(targetPkg, CopyHandler.OverrideOption.RENAME, true);

示例代码是C#,所以要自己翻译成lua。

CopyHandler.OverrideOption.RENAME表示遇到同名时重命名处理,最后一个参数表示是移动还是复制。

fgui_learner

赞同来自:

[14:02:06] LuaException: c# exception:This type must add to CSharpCallLua: System.Collections.Generic.IList`1[FairyEditor.FPackageItem],stack:  at XLua.ObjectCasters+<>c__DisplayClass23_0.<genCaster>b__3 (System.IntPtr L, System.Int32 idx, System.Object target) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.ObjectCast.Invoke (System.IntPtr L, System.Int32 idx, System.Object target) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.OverloadMethodWrap.Call (System.IntPtr L) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.MethodWrap.Call (System.IntPtr L) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Diagnostics.Tracing.EnumHelper`1+Transformer`1[UnderlyingType,ValueType].Invoke (ValueType value) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.StaticLuaCallbacks.FixCSFunction (System.IntPtr L) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.LuaDLL.Lua.lua_pcall (System.IntPtr L, System.Int32 nArgs, System.Int32 nResults, System.Int32 errfunc) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.DelegateBridge.__Gen_Delegate_Imp35 (System.String p0) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.Events.UnityAction.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.InternalDispatchEvent (System.String strType, FairyGUI.EventBridge bridge, System.Object data, System.Object initiator) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.DispatchEvent (System.String strType, System.Object data) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.PopupMenu.__clickItem (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.InternalDispatchEvent (System.String strType, FairyGUI.EventBridge bridge, System.Object data, System.Object initiator) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.DispatchEvent (System.String strType, System.Object data) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.BubbleEvent (System.String strType, System.Object data, System.Collections.Generic.List`1[T] addChain) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.BubbleEvent (System.String strType, System.Object data) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.Stage.HandleMouseEvents () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.Stage.HandleEvents () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.Stage.InternalUpdate () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.StageEngine.LateUpdate () [0x00000] in <00000000000000000000000000000000>:0 
stack traceback:
[C]: in method 'InitWithItems'
[string "Plugin-test_case"]:28: in upvalue 'test_move_res'
[string "Plugin-test_case"]:55: in upvalue 'run'
[string "Plugin-test_case"]:62: in function <[string "Plugin-test_case"]:61>
XLua.LuaEnv.ThrowExceptionFromError (System.Int32 oldTop) (at <00000000000000000000000000000000>:0)
XLua.DelegateBridge.__Gen_Delegate_Imp35 (System.String p0) (at <00000000000000000000000000000000>:0)
UnityEngine.Events.UnityAction.Invoke () (at <00000000000000000000000000000000>:0)
FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) (at <00000000000000000000000000000000>:0)
FairyGUI.EventDispatcher.InternalDispatchEvent (System.String strType, FairyGUI.EventBridge bridge, System.Object data, System.Object initiator) (at <00000000000000000000000000000000>:0)
...
 
代码:

2021315-141251.png

 

要回复问题请先登录注册