DAPP游戏链游开发丨DAPP游戏链游系统开发(方案及逻辑)丨DAPP游戏链游系统案例源码设计

简介: 元宇宙是整合多种新技术而产生的新型虚实相融的互联网应用和社会形态,它基于扩展现实技术提供沉浸式体验,以及数字孪生技术生成现实世界的镜像,通过区块链技术搭建经济体系

  

元宇宙是整合多种新技术而产生的新型虚实相融的互联网应用和社会形态,它基于扩展现实技术提供沉浸式体验,以及数字孪生技术生成现实世界的镜像,通过区块链技术搭建经济体系

  GameFi项目包含五大关键要素:

  1.区块链网络:GameFi的基础设施一般为公链。目前链游采用的主流链包括BSC(币安智能链)、Ronin(AxieInfinity自研链)、WAX(专注链游与NFT)和Polygon(以太坊原生Layer2)。

  2.游戏玩法与模式:目前GameFi的设计普遍较简单,以土地模拟经营、卡牌对战、moba为主。

  3.游戏通证:通证体系一般分为单通证与多通证模式:(1)单通证:游戏中所有的支出收益均采用同一种货币;(2)多通证:游戏经济活动采用多种代币运行

  4.经济模型:经济模型是GameFi的核心

  一、Unity关卡

  Unity使用过程中关卡加载和卸载是大多数三维引擎都要提供的基本功能。

  因为关卡切换在游戏中非常常用。

  在之前的版本中Unity的关卡切换使用的是:

  Application.loadedLevel();

  看看Application类,此时这个类的功能比较繁杂,比较多。只看与关卡相关的:

  [Obsolete("Use SceneManager.LoadScene")]

  public static void LoadLevel(string name);

  [Obsolete("Use SceneManager.LoadScene")]

  public static void LoadLevel(int index);

  [Obsolete("Use SceneManager.LoadScene")]

  public static void LoadLevelAdditive(string name);

  [Obsolete("Use SceneManager.LoadScene")]

  public static void LoadLevelAdditive(int index);

  //

  //摘要:

  /////

  //Unloads all GameObject associated with the given scene.Note that assets are

  //currently not unloaded,in order to free up asset memory call Resources.UnloadAllUnusedAssets.

  /////

  //

  //参数:

  //index:

  //Index of the scene in the PlayerSettings to unload.

  //

  //scenePath:

  //Name of the scene to Unload.

  //

  //返回结果:

  /////

  //Return true if the scene is unloaded.

  /////

  [Obsolete("Use SceneManager.UnloadScene")]

  public static bool UnloadLevel(string scenePath);

  //

  //摘要:

  /////

  //Unloads all GameObject associated with the given scene.Note that assets are

  //currently not unloaded,in order to free up asset memory call Resources.UnloadAllUnusedAssets.

  /////

  //

  //参数:

  //index:

  //Index of the scene in the PlayerSettings to unload.

  //

  //scenePath:

  //Name of the scene to Unload.

  //

  //返回结果:

  /////

  //Return true if the scene is unloaded.

  /////

  [Obsolete("Use SceneManager.UnloadScene")]

  public static bool UnloadLevel(int index);

  二、Untiy的SceneManager类

  #region程序集UnityEngine,Version=0.0.0.0,Culture=neutral,PublicKeyToken=null

  //H:UnityUnityProjectShiftLevelsLibraryUnityAssembliesUnityEngine.dll

  #endregion

  using UnityEngine.Internal;

  namespace UnityEngine.SceneManagement

  {

  //

  //摘要:

  /////

  //Scene management at run-time.

  /////

  public class SceneManager

  {

  public SceneManager();

  public static int sceneCount{get;}

  //

  public static int sceneCountInBuildSettings{get;}

  public static Scene GetActiveScene();

  public static Scene[]GetAllScenes();

  //参数:

  //index:

  //Index of the scene to get.Index must be greater than or equal to 0 and less

  //than SceneManager.sceneCount.

  public static Scene GetSceneAt(int index);

  //返回结果:

  /////

  //The scene if found or an invalid scene if not.

  /////

  public static Scene GetSceneByName(string name);

  //Searches all scenes added to the SceneManager for a scene that has the given

  //asset path.

  /////

  //

  //参数:

  //scenePath:

  //Path of the scene.Should be relative to the project folder.Like:"AssetsMyScenesMyScene.unity".

  public static Scene GetSceneByPath(string scenePath);

  [ExcludeFromDocs]

  public static void LoadScene(int sceneBuildIndex);

  [ExcludeFromDocs]

  public static void LoadScene(string sceneName);

  //参数:

  //sceneName:

  //Name of the scene to load.

  //

  //sceneBuildIndex:

  //Index of the scene in the Build Settings to load.

  //

  //mode:

  //Allows you to specify whether or not to load the scene additively.See SceneManagement.LoadSceneMode

  //for more information about the options.

  public static void LoadScene(int sceneBuildIndex,[DefaultValue("LoadSceneMode.Single")]LoadSceneMode mode);

  //参数:

  //sceneName:

  //Name of the scene to load.

  //

  //sceneBuildIndex:

  //Index of the scene in the Build Settings to load.

  //

  //mode:

  //Allows you to specify whether or not to load the scene additively.See SceneManagement.LoadSceneMode

  //for more information about the options.

  public static void LoadScene(string sceneName,[DefaultValue("LoadSceneMode.Single")]LoadSceneMode mode);

  [ExcludeFromDocs]

  public static AsyncOperation LoadSceneAsync(int sceneBuildIndex);

  [ExcludeFromDocs]

  public static AsyncOperation LoadSceneAsync(string sceneName);

  //参数:

  //sceneName:

  //Name of the scene to load.

  //

  //sceneBuildIndex:

  //Index of the scene in the Build Settings to load.

  //

  //mode:

  //If LoadSceneMode.Single then all current scenes will be unloaded before loading.

  public static AsyncOperation LoadSceneAsync(int sceneBuildIndex,[DefaultValue("LoadSceneMode.Single")]LoadSceneMode mode);

  //参数:

  //sceneName:

  //Name of the scene to load.

  //

  //sceneBuildIndex:

  //Index of the scene in the Build Settings to load.

  //

  //mode:

  //If LoadSceneMode.Single then all current scenes will be unloaded before loading.

  public static AsyncOperation LoadSceneAsync(string sceneName,[DefaultValue("LoadSceneMode.Single")]LoadSceneMode mode);

  //

  //参数:

  //sourceScene:

  //The scene that will be merged into the destination scene.

  //

  //destinationScene:

  //Existing scene to merge the source scene into.

  public static void MergeScenes(Scene sourceScene,Scene destinationScene);

  //

  //摘要:

  /////

  //Move a GameObject from its current scene to a new scene.///It is required that

  //the GameObject is at the root of its current scene.

  /////

  //

  //参数:

  //go:

  //GameObject to move.

  //

  //scene:

  //Scene to move into.

  public static void MoveGameObjectToScene(GameObject go,Scene scene);

  //

  //返回结果:

  /////

  //Returns false if the scene is not loaded yet.

  /////

  public static bool SetActiveScene(Scene scene);

  /////

  public static bool UnloadScene(string sceneName);

  //

  //摘要:

  /////

  //Unloads all GameObjects associated with the given scene.Note that assets are

  //currently not unloaded,in order to free up asset memory call Resources.UnloadAllUnusedAssets.

  /////

  //

  //参数:

  //sceneBuildIndex:

  //Index of the scene in the Build Settings to unload.

  //

  //sceneName:

  //Name of the scene to unload.

  //

  //返回结果:

  /////

  //Returns true if the scene is unloaded.

  /////

  public static bool UnloadScene(int sceneBuildIndex);

  }

  }

  三、SceneManager对于获取场景的一些操作

  (一)

  SceneManager

  class in UnityEngine.SceneManagement

  描述:运行时的场景管理。

  静态变量sceneCount:当前加载的场景的总数。

  前加载的场景的数量将被返回。

  sceneCountInBuildSettings:在BuildSettings的号码。

  (二)

  CreateScene:在运行时创建一个空的新场景,使用给定的名称。

  在运行时创建一个空的新场景,使用给定的名称。

  新的场景将开放相加到层次与现有已经打开的场景。新场景的路径将是空的。此函数用于在运行时创建场景。创建一个场景编辑时间(例如,使编辑脚本或工具需要创建场景时),使用editorscenemanager.newscene。

  (三)

  public static SceneManagement.Scene GetActiveScene()

  现场的活动场景。

  描述:获取当前活动场景。

  当前活动的场景将被用来作为目标由脚本实例化新的游戏对象现场。

  using UnityEngine;

  using UnityEngine.SceneManagement;

  public class GetActiveSceneExample:MonoBehaviour

  {

  void Start()

  {

  Scene scene=SceneManager.GetActiveScene();

  Debug.Log("Active scene is'"+scene.name+"'.");

  }

  }

  (四)

  public static SceneManagement.Scene GetSceneAt(int index);

  index:场景索引。指数必须大于或等于0和小于scenemanager.scenecount。

  返回:

  根据给定的参数返回一个场景引用。

  获取现场在添加场景的场景管理器的列表索引:

  using UnityEditor;

  using UnityEditor.SceneManagement;

  using UnityEngine.SceneManagement;

  using UnityEngine;

  public class Example

  {

  //adds a menu item which gives a brief summary of currently open scenes

  [MenuItem("SceneExample/Scene Summary")]

  public static void ListSceneNames()

  {

  string output="";

  if(SceneManager.sceneCount>0)

  {

  for(int n=0;n<SceneManager.sceneCount;++n)

  {

  Scene scene=SceneManager.GetSceneAt(n);

  output+=scene.name;

  output+=scene.isLoaded?"(Loaded,":"(Not Loaded,";

  output+=scene.isDirty?"Dirty,":"Clean,";

  output+=scene.buildIndex>=0?"in build)n":"NOT in build)n";

  }

  }

  else

  {

  output="No open scenes.";

  }

  EditorUtility.DisplayDialog("Scene Summary",output,"Ok");

  }

  }

相关文章
|
存储 Cloud Native API
C++ QT监测可执行文件exe是否运行
C++ QT监测可执行文件exe是否运行
|
Linux Shell 网络安全
Linux命令之less
Linux命令 less
688 1
|
API 定位技术 C语言
C语言项目实战——贪吃蛇
贪吃蛇是久负盛名的游戏,它也和俄罗斯方块,扫雷等游戏位列经典游戏的行列。 在编程语言的学习中,我将以贪吃蛇为例,从设计到代码来展示一个C语言项目实战,进而再一步提升读者对C语言的理解和认知。
549 0
|
7月前
|
存储 安全 固态存储
四款WIN PE工具,都可以实现U盘安装教程
Windows PE是基于NT内核的轻量系统,用于系统安装、分区管理及故障修复。本文推荐多款PE制作工具,支持U盘启动,兼容UEFI/Legacy模式,具备备份还原、驱动识别等功能,操作简便,适合新旧电脑维护使用。
3756 109
成功解决org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed
成功解决org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed
成功解决org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed
|
10月前
|
传感器 机器学习/深度学习 算法
多旋翼无人机组合导航系统-多源信息融合算法(Matlab代码实现)
多旋翼无人机组合导航系统-多源信息融合算法(Matlab代码实现)
363 3
|
11月前
|
机器学习/深度学习 数据采集 人工智能
企业如何利用开源能源管理系统实现节能减排
MyEMS 是一套多能源管理平台,支持电、水、气、热及新能源数据采集与高频监控,结合可视化能源流图与智能分析,助力企业识别节能机会。系统内置AI算法,实现设备智能调度、生产流程优化及分时电价策略,降低能耗与成本。同时支持碳足迹追踪与ISO标准合规,推动企业绿色转型。
275 0
企业如何利用开源能源管理系统实现节能减排
|
存储 Java 数据库连接
Mybatisplus中的主要使用注解
3.有些注解需要配合其他配置使用。例如,@Version需要配合乐观锁插件使用,@EnumValue需要配合对应的TypeHandler使用。
567 11
|
存储 算法
深入解析PID控制算法:从理论到实践的完整指南
前言 大家好,今天我们介绍一下经典控制理论中的PID控制算法,并着重讲解该算法的编码实现,为实现后续的倒立摆样例内容做准备。 众所周知,掌握了 PID ,就相当于进入了控制工程的大门,也能为更高阶的控制理论学习打下基础。 在很多的自动化控制领域。都会遇到PID控制算法,这种算法具有很好的控制模式,可以让系统具有很好的鲁棒性。 基本介绍 PID 深入理解 (1)闭环控制系统:讲解 PID 之前,我们先解释什么是闭环控制系统。简单说就是一个有输入有输出的系统,输入能影响输出。一般情况下,人们也称输出为反馈,因此也叫闭环反馈控制系统。比如恒温水池,输入就是加热功率,输出就是水温度;比如冷库,
2167 15
|
机器学习/深度学习 存储 自然语言处理
如何提升大模型的“深度思维能力”
本文探讨了如何通过模拟人类的思维过程来提升大模型的推理和规划能力。文章从人类的思维模式入手,分析了人类在面对复杂问题时的“增-减”信息循环,提出了通过增加相关信息和减少噪声来降低信息熵的方法。文章还讨论了如何生成逻辑自洽的推理路径,并通过实例说明了多结论问题的处理方法。最后,文章指出,通过现有的大模型进行针对性微调,可以逐步强化数据,提升模型的推理和规划能力。
1291 11