区块链技术博客
www.b2bchain.cn

Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理求职学习资料

本文介绍了Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理求职学习资料,有助于帮助完成毕业设计以及求职,是一篇很好的资料。

对技术面试,学习经验等有一些体会,在此分享。

第十一个示例

代码如下

using System; using System.Collections; using UnityEngine;  namespace QFramework {     public partial class MonoBehaviourSimplify     {         public void Delay(float seconds, Action onFinished)         {             StartCoroutine(DelayCoroutine(seconds, onFinished));         }          private static IEnumerator DelayCoroutine(float seconds, Action onFinished)         {             yield return new WaitForSeconds(seconds);              onFinished();         }     }      public class DelayWithCoroutine : MonoBehaviourSimplify     {         private void Start()         {             Delay(5.0f, () =>             {                 UnityEditor.EditorApplication.isPlaying = false;             });         }  #if UNITY_EDITOR         [UnityEditor.MenuItem("QFramework/11.定时功能", false, 11)]         private static void MenuClickd()         {             UnityEditor.EditorApplication.isPlaying = true;              new GameObject("DelayWithCoroutine")                 .AddComponent<DelayWithCoroutine>();         } #endif         protected override void OnBeforeDestroy()         {          }     } }

又一个 MonoBehaviourSimplify,我们可以考虑和之前的示例进行合并。而我们的 DelayWithCoroutine 这个示例要放在 Example 里。

整理后的代码如下:
Assets/QFramework/Framework/MonoBehaviourSimplify.cs

using System; using System.Collections; using UnityEngine;  namespace QFramework {         public partial class MonoBehaviourSimplify : MonoBehaviour     {         public void Show()         {             GameObjectSimplify.Show(gameObject);         }          public void Hide()         {             GameObjectSimplify.Hide(gameObject);         }          public void Identity()         {             TransformSimplify.Identity(transform);         }           public void Delay(float seconds, Action onFinished)         {             StartCoroutine(DelayCoroutine(seconds, onFinished));         }          private static IEnumerator DelayCoroutine(float seconds, Action onFinished)         {             yield return new WaitForSeconds(seconds);              onFinished();         }     } }

Assets/QFramework/Example/8.定时功能/DelayWithCoroutine.cs

using UnityEngine;  namespace QFramework {     public class DelayWithCoroutine : MonoBehaviourSimplify     {         private void Start()         {             Delay(5.0f, () =>             {                 UnityEditor.EditorApplication.isPlaying = false;             });         }  #if UNITY_EDITOR         [UnityEditor.MenuItem("QFramework/Example/8.定时功能", false, 9)]         private static void MenuClickd()         {             UnityEditor.EditorApplication.isPlaying = true;              new GameObject("DelayWithCoroutine")                 .AddComponent<DelayWithCoroutine>();         } #endif         protected override void OnBeforeDestroy()         {          }     } }

菜单如下:
Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理

目录如下:
Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理

第十二个示例

代码如下:
“`cs
using System;
using System.Collections.Generic;
using UnityEngine;

namespace QFramework
{
public class MsgDispatcher
{
private static Dictionary> RegisteredMsgs = new Dictionary>();

    public static void Register(string msgName, Action<object> onMsgReceived)

第十一个示例

代码如下

using System; using System.Collections; using UnityEngine;  namespace QFramework {     public partial class MonoBehaviourSimplify     {         public void Delay(float seconds, Action onFinished)         {             StartCoroutine(DelayCoroutine(seconds, onFinished));         }          private static IEnumerator DelayCoroutine(float seconds, Action onFinished)         {             yield return new WaitForSeconds(seconds);              onFinished();         }     }      public class DelayWithCoroutine : MonoBehaviourSimplify     {         private void Start()         {             Delay(5.0f, () =>             {                 UnityEditor.EditorApplication.isPlaying = false;             });         }  #if UNITY_EDITOR         [UnityEditor.MenuItem("QFramework/11.定时功能", false, 11)]         private static void MenuClickd()         {             UnityEditor.EditorApplication.isPlaying = true;              new GameObject("DelayWithCoroutine")                 .AddComponent<DelayWithCoroutine>();         } #endif         protected override void OnBeforeDestroy()         {          }     } }

又一个 MonoBehaviourSimplify,我们可以考虑和之前的示例进行合并。而我们的 DelayWithCoroutine 这个示例要放在 Example 里。

整理后的代码如下:
Assets/QFramework/Framework/MonoBehaviourSimplify.cs

using System; using System.Collections; using UnityEngine;  namespace QFramework {         public partial class MonoBehaviourSimplify : MonoBehaviour     {         public void Show()         {             GameObjectSimplify.Show(gameObject);         }          public void Hide()         {             GameObjectSimplify.Hide(gameObject);         }          public void Identity()         {             TransformSimplify.Identity(transform);         }           public void Delay(float seconds, Action onFinished)         {             StartCoroutine(DelayCoroutine(seconds, onFinished));         }          private static IEnumerator DelayCoroutine(float seconds, Action onFinished)         {             yield return new WaitForSeconds(seconds);              onFinished();         }     } }

Assets/QFramework/Example/8.定时功能/DelayWithCoroutine.cs

using UnityEngine;  namespace QFramework {     public class DelayWithCoroutine : MonoBehaviourSimplify     {         private void Start()         {             Delay(5.0f, () =>             {                 UnityEditor.EditorApplication.isPlaying = false;             });         }  #if UNITY_EDITOR         [UnityEditor.MenuItem("QFramework/Example/8.定时功能", false, 9)]         private static void MenuClickd()         {             UnityEditor.EditorApplication.isPlaying = true;              new GameObject("DelayWithCoroutine")                 .AddComponent<DelayWithCoroutine>();         } #endif         protected override void OnBeforeDestroy()         {          }     } }

菜单如下:
Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理

目录如下:
Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理

第十二个示例

代码如下:
“`cs
using System;
using System.Collections.Generic;
using UnityEngine;

namespace QFramework
{
public class MsgDispatcher
{
private static Dictionary> RegisteredMsgs = new Dictionary>();

    public static void Register(string msgName, Action<object> onMsgReceived)

第十一个示例

代码如下

using System; using System.Collections; using UnityEngine;  namespace QFramework {     public partial class MonoBehaviourSimplify     {         public void Delay(float seconds, Action onFinished)         {             StartCoroutine(DelayCoroutine(seconds, onFinished));         }          private static IEnumerator DelayCoroutine(float seconds, Action onFinished)         {             yield return new WaitForSeconds(seconds);              onFinished();         }     }      public class DelayWithCoroutine : MonoBehaviourSimplify     {         private void Start()         {             Delay(5.0f, () =>             {                 UnityEditor.EditorApplication.isPlaying = false;             });         }  #if UNITY_EDITOR         [UnityEditor.MenuItem("QFramework/11.定时功能", false, 11)]         private static void MenuClickd()         {             UnityEditor.EditorApplication.isPlaying = true;              new GameObject("DelayWithCoroutine")                 .AddComponent<DelayWithCoroutine>();         } #endif         protected override void OnBeforeDestroy()         {          }     } }

又一个 MonoBehaviourSimplify,我们可以考虑和之前的示例进行合并。而我们的 DelayWithCoroutine 这个示例要放在 Example 里。

整理后的代码如下:
Assets/QFramework/Framework/MonoBehaviourSimplify.cs

using System; using System.Collections; using UnityEngine;  namespace QFramework {         public partial class MonoBehaviourSimplify : MonoBehaviour     {         public void Show()         {             GameObjectSimplify.Show(gameObject);         }          public void Hide()         {             GameObjectSimplify.Hide(gameObject);         }          public void Identity()         {             TransformSimplify.Identity(transform);         }           public void Delay(float seconds, Action onFinished)         {             StartCoroutine(DelayCoroutine(seconds, onFinished));         }          private static IEnumerator DelayCoroutine(float seconds, Action onFinished)         {             yield return new WaitForSeconds(seconds);              onFinished();         }     } }

Assets/QFramework/Example/8.定时功能/DelayWithCoroutine.cs

using UnityEngine;  namespace QFramework {     public class DelayWithCoroutine : MonoBehaviourSimplify     {         private void Start()         {             Delay(5.0f, () =>             {                 UnityEditor.EditorApplication.isPlaying = false;             });         }  #if UNITY_EDITOR         [UnityEditor.MenuItem("QFramework/Example/8.定时功能", false, 9)]         private static void MenuClickd()         {             UnityEditor.EditorApplication.isPlaying = true;              new GameObject("DelayWithCoroutine")                 .AddComponent<DelayWithCoroutine>();         } #endif         protected override void OnBeforeDestroy()         {          }     } }

菜单如下:
Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理

目录如下:
Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理

第十二个示例

代码如下:
“`cs
using System;
using System.Collections.Generic;
using UnityEngine;

namespace QFramework
{
public class MsgDispatcher
{
private static Dictionary> RegisteredMsgs = new Dictionary>();

    public static void Register(string msgName, Action<object> onMsgReceived)

部分转自互联网,侵权删除联系

赞(0) 打赏
部分文章转自网络,侵权联系删除b2bchain区块链学习技术社区 » Unity 游戏框架搭建 2019 (六十九) 第十一、十二个示例整理求职学习资料
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

b2b链

联系我们联系我们