Пример #1
0
        private void TargetDirection(Direction direction)
        {
            if (direction != Direction.None)
            {
                var actions = mapConsole.GetActions(player, actors, direction);
                if (actions.Count == 0)
                {
                    messageConsole.SetMessage("Nothing to do");
                }
                foreach (var action in actions)
                {
                    var result = action.Perform(player);
                    if (result.Outcome == Actions.Outcome.Success)
                    {
                        logConsole.Log(result.Message);
                        messageConsole.SetMessage("");
                    }
                    else
                    {
                        messageConsole.SetMessage(result.Message);
                    }
                }
            }

            state = InputState.Idle;
        }
Пример #2
0
    public static void BuildAllAssetbundlesCustom()
    {
        // 确保路径存在
        IOUtil.MakeSurePath(EditorConstants.ASSETBUNDLE_ABSOLUTE_PATH);
        AssetBundleBuild[] buildMap = new AssetBundleBuild[1];
        //string[] joystickAssets = new string[2];
        //joystickAssets[0] = "Assets/UITexture/Joystick/摇杆_底.png";
        //joystickAssets[1] = "Assets/UITexture/Joystick/摇杆_钮.png";
        string[] joystickAssets = new string[1];
        joystickAssets[0]              = "Assets/#Project/SFX/Prefab_Finished/new_Action/0_Player/ck";
        buildMap[0].assetNames         = joystickAssets;
        buildMap[0].assetBundleName    = AssetDatabase.GetImplicitAssetBundleName("Assets/#Project/SFX/Prefab_Finished/new_Action/0_Player/ck");
        buildMap[0].assetBundleVariant = AssetDatabase.GetImplicitAssetBundleVariantName("Assets/#Project/SFX/Prefab_Finished/new_Action/0_Player/ck");
#if UNITY_STANDALONE_WIN
        AssetBundleManifest manifest = null;
#if USE_64BIT
        manifest = BuildPipeline.BuildAssetBundles(EditorConstants.ASSETBUNDLE_RELATIVE_PATH, buildMap, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneWindows64);
#else
        manifest = BuildPipeline.BuildAssetBundles(EditorConstants.ASSETBUNDLE_RELATIVE_PATH, buildMap, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneWindows);
#endif
        string[]      assetbundles = manifest.GetAllAssetBundles();
        StringBuilder sb           = new StringBuilder();
        foreach (string assetbundle in assetbundles)
        {
            sb.AppendLine(assetbundle + ":" + manifest.GetAssetBundleHash(assetbundle).ToString());
        }
        LogConsole.Log(Tag.Builder, sb.ToString());
        uint crc;
        BuildPipeline.GetCRCForAssetBundle(EditorConstants.ASSETBUNDLE_RELATIVE_PATH + "sfx_ck", out crc);
        LogConsole.Log(Tag.Builder, crc);
#elif UNITY_ANDROID
#elif UNITY_IOS
#endif
    }
Пример #3
0
 static public void Log(object message, string customType, Color col)
 {
     if (EnableLog)
     {
         Debug.Log(string.Format("message:{0} customType:{1}", message, customType));
     }
     LogConsole.Log(message, customType, col);
 }
Пример #4
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        DisplayScriptField();

        if (GUILayout.Button("ceshi"))
        {
            LogConsole.Log(allStates.arraySize);
            for (int i = 0; i < allStates.arraySize; ++i)
            {
                SerializedProperty elem = allStates.GetArrayElementAtIndex(i);
                LogConsole.Log(elem.name + " " + elem.type);
                while (elem.Next(true))
                {
                    LogConsole.Log(elem.name + " " + elem.type);
                }
            }
        }

        EditorGUILayout.LabelField("allStates");
        int count = allStates.arraySize;

        for (int i = 0; i < count; ++i)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(10f);
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("element " + i);
            SerializedProperty elem = allStates.GetArrayElementAtIndex(i);
            if (target.allStates[i] is BaseState)
            {
                BaseState state = target.allStates[i] as BaseState;
                state.s = EditorGUILayout.TextField("s = ", state.s);
            }
            if (target.allStates[i] is AdvancedState)
            {
                AdvancedState state = target.allStates[i] as AdvancedState;
                state.i = EditorGUILayout.IntField("i = ", state.i);
            }
            if (target.allStates[i] is AnotherState)
            {
                AnotherState state = target.allStates[i] as AnotherState;
                state.f = EditorGUILayout.FloatField("f = ", state.f);
            }
            if (target.allStates[i] is AnotherAdvancedState)
            {
                AnotherAdvancedState state = target.allStates[i] as AnotherAdvancedState;
                state.b = EditorGUILayout.Toggle("b = ", state.b);
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }

        serializedObject.ApplyModifiedProperties();
    }
Пример #5
0
    void OnPostprocessAssetbundleNameChanged(string path, string previous, string next)
    {
        LogConsole.Log(Tag.Builder, string.Format("AB name change [{0}] ({1})>>({2})", path, previous, next));
        bool autoBuild = EditorPrefs.GetBool("AutoBuildOnAssetBundleNameChanged");

        if (autoBuild)
        {
            AssetbundlesBuilder.BuildAllAssetbundles();
        }
    }
Пример #6
0
    public static void GetAllAssetbundlesNames()
    {
        string[]      abNames = AssetDatabase.GetAllAssetBundleNames();
        StringBuilder sb      = new StringBuilder();

        foreach (string abName in abNames)
        {
            sb.AppendLine(abName);
        }
        LogConsole.Log(Tag.Builder, sb.ToString());
        UnityEditorInternal.InternalEditorUtility.OpenEditorConsole();
    }
Пример #7
0
 public static void MakeSurePath(string path)
 {
     if (!Directory.Exists(path))
     {
         LogConsole.Log("正在创建目录…… " + path);
         try
         {
             Directory.CreateDirectory(path);
         }
         catch (Exception ex)
         {
             LogConsole.LogException(ex);
             LogConsole.Log("创建目录失败! " + path);
         }
     }
 }
Пример #8
0
    public static void BuildAllAssetbundles()
    {
        AssetBundleManifest manifest = null;
        string outputPath            = EditorConstants.ASSETBUNDLE_RELATIVE_PATH;

#if UNITY_STANDALONE_WIN
#if USE_64BIT
        outputPath += BuildTarget.StandaloneWindows64 + "/";
        // 确保路径存在
        IOUtil.MakeSurePath(outputPath);
        manifest = BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
#else
        outputPath += BuildTarget.StandaloneWindows + "/";
        // 确保路径存在
        IOUtil.MakeSurePath(outputPath);
        manifest = BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
#endif
#elif UNITY_ANDROID
        outputPath += BuildTarget.Android + "/";
        // 确保路径存在
        IOUtil.MakeSurePath(outputPath);
        manifest = BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.Android);
#elif UNITY_IOS
        outputPath += BuildTarget.iPhone + "/";
        // 确保路径存在
        IOUtil.MakeSurePath(outputPath);
        manifest = BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.iPhone);
#endif
        string[]      assetbundles = manifest.GetAllAssetBundles();
        StringBuilder sb           = new StringBuilder();
        foreach (string assetbundle in assetbundles)
        {
            sb.AppendLine(manifest.GetAssetBundleHash(assetbundle).ToString());
        }
        LogConsole.Log(Tag.Builder, sb.ToString());
        uint crc;
        BuildPipeline.GetCRCForAssetBundle(outputPath + "joystick", out crc);
        LogConsole.Log(Tag.Builder, crc);
        Hash128 hash;
        BuildPipeline.GetHashForAssetBundle(outputPath + "joystick", out hash);
        LogConsole.Log(Tag.Builder, hash.ToString());
    }
Пример #9
0
        private void OnGUI()
        {
            string tb = "ToolbarButton";

            //s = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("SearchTextField");
            //s1 = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("CN EntryInfo");
            if (GUI.Button(new Rect(10, 10, 400, 200), "Print Log"))
            {
                Debug.Log("Test Unity Log");
                Assert.IsTrue(false);
                LogConsole.Log("Test Log");
                LogConsole.Log("MyTag", "Test Log With Tag");
                LogConsole.Log("Test Log With Context", this);
                LogConsole.Log("MyTag", "Test Log With Tag And Context", this);
                LogConsole.LogFormat("Test Log {0} {1}({2},{3})", "With", "Format", 1, 2.9f);
                LogConsole.LogFormat(this, "Test Log {0} {1}({2},{3})", "With", "Format And Context", 1, 2.9f);
                LogConsole.LogWarning("Test Warning");
                LogConsole.LogError("Test Error");
                try
                {
                    throw new System.Exception("Test Exception");
                }
                catch (System.Exception ex)
                {
                    LogConsole.LogException(ex);
                }
                try
                {
                    throw new System.Exception("Test Exception With Context");
                }
                catch (System.Exception ex)
                {
                    LogConsole.LogException(ex, this);
                }

                Debug.LogAssertion("Unity assertion");

                LogConsole.Assert(false, "Test if this assert can be printed in console");
            }
        }
Пример #10
0
    // Use this for initialization
    IEnumerator Start()
    {
        string path = Application.dataPath + "/../AssetBundles/";

        if (useEditorOnly)
        {
            path = Application.dataPath + "/../AssetBundles_Editor/";
        }
        if (path.Contains("://"))
        {
            // if path is a URL, use WWW to load it
            foreach (string abPath in assetbundlePath)
            {
                using (UnityWebRequest request = UnityWebRequest.GetAssetBundle(path + abPath))
                {
                    yield return(request.Send());

                    AssetBundle assetbundle = DownloadHandlerAssetBundle.GetContent(request);
                    if (assetbundle == null)
                    {
                        LogConsole.Log("TestAssetBundle", "Fail to load " + path + abPath);
                    }
                    Object[] objs = assetbundle.LoadAllAssets();
                    foreach (Object obj in objs)
                    {
                        Debug.Log(obj);
                        if (instantiateObject)
                        {
                            Process(obj);
                        }
                    }
                    //assetbundle.Unload(false);
                    //assetbundle = null;
                    if (ab != null)
                    {
                        ab.Unload(false);
                    }
                    ab = assetbundle;
                }
                Resources.UnloadUnusedAssets();
                Debug.Log("--------------------------------------------------");
            }
        }
        else
        {
            foreach (string abPath in assetbundlePath)
            {
                AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(path + abPath);
                yield return(request);

                AssetBundle assetbundle = request.assetBundle;
                if (assetbundle == null)
                {
                    LogConsole.Log("TestAssetBundle", "Fail to load " + path + abPath);
                }
                Object[] objs = assetbundle.LoadAllAssets();
                foreach (Object obj in objs)
                {
                    Debug.Log(obj);
                    if (instantiateObject)
                    {
                        Process(obj);
                    }
                }
                //assetbundle.Unload(false);
                //assetbundle = null;
                if (ab != null)
                {
                    ab.Unload(false);
                }
                ab = assetbundle;
                Resources.UnloadUnusedAssets();
                Debug.Log("--------------------------------------------------");
            }
        }

        //InvokeRepeating("OutputKey", 0f, 1f);
    }
Пример #11
0
 public void OnEndDrag(BaseEventData data)
 {
     LogConsole.Log("TestUIInteractive", Time.frameCount + "OnEndDrag " + data.GetType(), data.selectedObject);
 }
Пример #12
0
 protected override void Log(string message, Category category)
 {
   LogConsole.Log(message, category);
   LogFile.Log(message, category);
 }
Пример #13
0
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     LogConsole.Log("OnStateExit");
 }
Пример #14
0
 public override void OnStateMachineExit(Animator animator, int stateMachinePathHash)
 {
     LogConsole.Log("OnStateMachineExit");
 }