Browse Source

2.0重构

胡佳骏 1 year ago
parent
commit
51453537d7

+ 18 - 0
Assets/2.0/GameScene.cs

@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class GameoScene : MonoSingleton<GameoScene>
+{
+    // Start is called before the first frame update
+    void Start()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        
+    }
+}

+ 11 - 0
Assets/2.0/GameScene.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8a3fd997b64a3f24cb6c3b1b39af8fcd
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 1
Assets/2.0/Tools/DownLoadItem.cs

@@ -4,5 +4,4 @@ using UnityEngine;
 
 public class DownLoadItem : MonoBehaviour
 {
-  
 }

+ 24 - 0
Assets/2.0/Tools/LoadManager.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class LoadManager : Singleton<LoadManager>
+{
+    public Dictionary<string, DownLoadItem> downList = new Dictionary<string, DownLoadItem>();
+    public void load(string url,string version, Action<float> presson, Action<GameObject> callback)
+    {
+        string dName = getLoadName(url, version);
+        if (downList.ContainsKey(dName))
+        {
+        }else
+        {
+
+        }
+    }
+
+    public string getLoadName(string url, string version)
+    {
+        return url + "_" + version;
+    }
+}

+ 11 - 0
Assets/2.0/Tools/LoadManager.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0c596d9ccfb829c4f94334a4018d9427
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 60 - 0
Assets/2.0/User/Model/ModelItem.cs

@@ -4,4 +4,64 @@ using UnityEngine;
 
 public class ModelItem 
 {
+    //模型所在场景
+    public UserSceneItem sceneItem;
+
+    //模型id
+    public string id;
+
+    //模型name
+    public string name;
+
+    private GameObject _model;
+
+    //模型数据
+    public GameObject Model
+    {
+        get { 
+            if(_model==null)
+            {
+                _model = new GameObject(name);
+                _model.transform.parent = sceneItem.SceneModel.transform;
+                _model.transform.localPosition = getInfoPos();
+                _model.transform.localEulerAngles = getInfoEul();
+
+                LoadManager.Instance.load(url, Version, (float f)=> {
+
+                   //显示加载
+                
+                
+                },(GameObject obj)=> {
+
+
+                    obj.transform.transform.parent = _model.transform;
+
+                    obj.transform.localPosition = Vector3.zero;
+                    obj.transform.localEulerAngles = Vector3.zero;
+
+                });
+            }
+            return _model; }
+    }
+
+    //模型地址
+    public string url;
+
+    //模型类型
+    public string type;
+
+    //模型原始信息
+    public string info;
+
+    //模型版本
+    public string Version;
+
+    Vector3 getInfoPos()
+    {
+        return Vector3.zero;
+    }
+    Vector3 getInfoEul()
+    {
+        return Vector3.zero;
+    }
 }

+ 7 - 0
Assets/2.0/User/UserInfo.cs

@@ -4,5 +4,12 @@ using UnityEngine;
 
 public class UserInfo: Singleton<UserInfo>
 {
+
+    //用户令牌
     public string Token;
+    //用户名字
+    public string name;
+    //用户拥有的场景
+    public Dictionary<string, UserSceneItem> SceneList =new Dictionary<string, UserSceneItem>();
+
 }

+ 8 - 0
Assets/2.0/UserScene.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b20402d20958a6e44a076a90db7896b8
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 34 - 0
Assets/2.0/UserScene/UserSceneItem.cs

@@ -0,0 +1,34 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class UserSceneItem 
+{
+    //场景ID
+    public string id;
+
+    //场景名字
+    public string name;
+
+    //场景中的模型
+    public Dictionary<string, ModelItem> modelList = new Dictionary<string, ModelItem>();
+
+    GameObject _sceneModel;
+    public GameObject SceneModel
+    {
+        get
+        {
+            if (_sceneModel == null)
+            {
+                _sceneModel = new GameObject(name);
+                _sceneModel.transform.parent = GameoScene.Instance.transform;
+                _sceneModel.transform.localPosition = Vector3.zero;
+                _sceneModel.transform.localEulerAngles = Vector3.zero;
+            }
+            return _sceneModel;
+        }
+    }
+
+    //场景原始信息
+    public string info;
+}

+ 11 - 0
Assets/2.0/UserScene/UserSceneItem.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 31065e78f0683ea4b851e62d9365a23d
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 18 - 0
Assets/2.0/UserScene/UserSceneManager.cs

@@ -0,0 +1,18 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class UserSceneManager : MonoBehaviour
+{
+    // Start is called before the first frame update
+    void Start()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        
+    }
+}

+ 11 - 0
Assets/2.0/UserScene/UserSceneManager.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 84914abf6028e1f4aae62447b37e7f3b
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: