我一直试图弄清楚如何跟踪用户使用命令的次数。我希望能够增加并显示每次键入命令时使用命令的次数。 这是我的一个命令的一些代码: 忽略选择语句
C:\Users\x\AppData\Local\Android\Sdk\tools\bin\avdmanager.bat list target -c
stderr[
Exception in thread "main" java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String;
at com.android.sdklib.tool.AvdManagerCli.init(AvdManagerCli.java:278)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:210)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
]
stdout[
]
exit code: 1
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild
(System.String title, System.String
message, System.Exception ex) (at
<388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks
(UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PrepareForBuild
(UnityEditor.BuildOptions options,
UnityEditor.BuildTarget target) (at <388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PrepareForBuild
(UnityEditor.BuildOptions options,
UnityEditor.BuildTarget target) (at <388bfc6933e8438da93bcd874bbbeee6>:0)
UnityEditor.PostprocessBuildPlayer.PrepareForBuild
(UnityEditor.BuildOptions options,
UnityEditor.BuildTargetGroup
targetGroup, UnityEditor.BuildTarget
target) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:87)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
答案 0 :(得分:2)
你可以有一个全球字典来跟踪它。密钥是用户ID,值将是他们完成该特定命令的次数。您需要多个词典,每个命令一个,或者您可以将dict值设为一个列表,每个索引都有一个不同命令的计数。
commandCounts = {}
commandCounts[user.id] = [command1, command2, command3]