优化了部分小问题

master
lz 6 years ago
parent 542cfe624d
commit caa9c6cc45

@ -9271,6 +9271,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
state: 0
mainState: 0
isReadConfig: 1
--- !u!4 &808114896
Transform:
m_ObjectHideFlags: 0
@ -11207,7 +11208,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &969077517
Transform:
m_ObjectHideFlags: 0
@ -12606,7 +12607,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
fan_Tran: {fileID: 1045222159}
shelf_Tran: {fileID: 799570428}
shelfStart_pos: {x: 0, y: 0, z: 0}
shelfStart_pos: {x: -0.02467248, y: -0.003061638, z: 0.001089811}
shelfEnd_pos: {x: 0.637, y: 0, z: 0}
fanStart_pos: {x: 0, y: 0, z: 0}
fanEnd_pos: {x: 0.325, y: 0, z: 0}
@ -13594,6 +13595,12 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 314134230}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1089792041 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100000, guid: b4dd039a8e054504daceeeed463e88fe,
type: 3}
m_PrefabInstance: {fileID: 544308577}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1091094234
PrefabInstance:
m_ObjectHideFlags: 0
@ -17685,6 +17692,10 @@ PrefabInstance:
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 100010, guid: fee9178f93a83f54aba58ba94f91f564, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: fee9178f93a83f54aba58ba94f91f564, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -17799,7 +17810,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
fan_Tran: {fileID: 574652238}
shelf_Tran: {fileID: 1522503588}
shelfStart_pos: {x: 0, y: 0, z: 0}
shelfStart_pos: {x: -0.01533864, y: -0.003061638, z: 0.001089811}
shelfEnd_pos: {x: 0.637, y: 0, z: 0}
fanStart_pos: {x: 0, y: 0, z: 0}
fanEnd_pos: {x: 0.325, y: 0, z: 0}
@ -22147,7 +22158,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
fan_Tran: {fileID: 1751176518}
shelf_Tran: {fileID: 1751176524}
shelfStart_pos: {x: 0, y: 0, z: 0}
shelfStart_pos: {x: -0.06264488, y: -0.003061503, z: 0.00108999}
shelfEnd_pos: {x: 0.637, y: 0, z: 0}
fanStart_pos: {x: 0, y: 0, z: 0}
fanEnd_pos: {x: 0.325, y: 0, z: 0}
@ -24727,6 +24738,12 @@ MonoBehaviour:
preset: 0
onEnableBehaviour: 1
onDisableBehaviour: 2
--- !u!1 &1917029758 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100000, guid: b4dd039a8e054504daceeeed463e88fe,
type: 3}
m_PrefabInstance: {fileID: 126342056}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1924246399
GameObject:
m_ObjectHideFlags: 0
@ -26320,6 +26337,8 @@ MonoBehaviour:
- {fileID: 1432997558}
- {fileID: 107094290}
- {fileID: 1039707558}
- {fileID: 1917029758}
- {fileID: 1089792041}
outLineColor: {r: 0.972549, g: 0.49803922, b: 0.050980393, a: 1}
loadOutLineColor: {r: 0.039215688, g: 1, b: 0, a: 1}
spareAnimation: {fileID: 2048101534}

@ -5,6 +5,7 @@ using LzFramework.UI;
using LzFramework.FSM;
using LzFramework;
using EduCoderTool;
using Newtonsoft.Json;
namespace DisComputer
{
@ -21,10 +22,51 @@ namespace DisComputer
public MainState mainState = MainState.Idle;
private StateMachine<MainState> fsm;
private GameStateConfig stateConfig;
/// <summary>
/// 是否读取文件配置
/// </summary>
public bool isReadConfig;
// Start is called before the first frame update
void Start()
{
fsm = StateMachine<MainState>.Initialize(this, MainState.Idle);
if(isReadConfig)
ReadGameConfig();
else
{
fsm = StateMachine<MainState>.Initialize(this, MainState.Idle);
}
}
bool isReadData;
/// <summary>
/// 读取配置文件
/// </summary>
void ReadGameConfig()
{
isReadData = true;
WebGLConfiguratiobReader webGLConfiguratiobReader = new WebGLConfiguratiobReader("Config/gameState.json");
CoroutineManager.Singleton.CreateCoroutine(webGLConfiguratiobReader.ReadCoroutine(),
() =>
{
Debug.LogFormat("On Start");
}, (finish) => {
Debug.LogFormat("On Finish");
stateConfig = JsonConvert.DeserializeObject<GameStateConfig>(webGLConfiguratiobReader.ReadResult);
if(stateConfig.GameState == GameState.Load.ToString())
{
state = GameState.Load;
}else
{
state = GameState.Unload;
}
isReadData = false;
fsm = StateMachine<MainState>.Initialize(this, MainState.Idle);
});
}
@ -178,6 +220,10 @@ namespace DisComputer
/// <param name="step"></param>
public void StartGame(int step)
{
if (isReadData)
return;
GameConfig.state = state;
MouseControl.Instance.ClearSelectTarget();
@ -250,3 +296,11 @@ namespace DisComputer
}
}
/// <summary>
/// 游戏状态配置设置
/// </summary>
public class GameStateConfig
{
public string GameState { get; set; }
}

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Newtonsoft.Json;
using System.IO;
public class WebGLConfiguratiobReader
{
public string PartPath;
public string ReadResult { get; private set; }
private GameStateConfig stateConfig;
public WebGLConfiguratiobReader(string partPath)
{
PartPath = partPath;
}
public IEnumerator ReadCoroutine()
{
string configPath = Path.Combine(Application.streamingAssetsPath, PartPath);
Debug.LogFormat("configPath {0}", configPath);
UnityWebRequest www = UnityWebRequest.Get(configPath);
yield return www.SendWebRequest();
if(www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}else
{
//Debug.Log(www.downloadHandler.text);
ReadResult = www.downloadHandler.text;
}
}
/// <summary>
/// 游戏状态配置设置
/// </summary>
public class GameStateConfig
{
public string GameState { get; set; }
}
}

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

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

@ -0,0 +1,6 @@
{
//Load
//Unload
"GameState":"Load"
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 31f9561b76636b8489b3d3fa79f0c3eb
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -1 +1 @@
Build from DESKTOP-Q4UN19A at 2020/11/12 14:34:01
Build from DESKTOP-Q4UN19A at 2020/11/12 17:11:10

@ -1 +0,0 @@
Build from DESKTOP-Q4UN19A at 2020/7/16 17:18:31

@ -1 +0,0 @@
Build from DESKTOP-Q4UN19A at 2020/6/23 16:17:36

@ -1,9 +1,9 @@
{
"companyName": "Educode",
"productName": "Formwork",
"dataUrl": "DisaComputer.data.unityweb",
"wasmCodeUrl": "DisaComputer.wasm.code.unityweb",
"wasmFrameworkUrl": "DisaComputer.wasm.framework.unityweb",
"dataUrl": "DisaComputer_Load.data.unityweb",
"wasmCodeUrl": "DisaComputer_Load.wasm.code.unityweb",
"wasmFrameworkUrl": "DisaComputer_Load.wasm.framework.unityweb",
"TOTAL_MEMORY": 268435456,
"graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],
"webglContextAttributes": {"preserveDrawingBuffer": false},

@ -0,0 +1,6 @@
{
//Load
//Unload
"GameState":"Load"
}

@ -0,0 +1 @@
Build from DESKTOP-Q4UN19A at 2020/11/12 17:11:10

@ -69,7 +69,7 @@
}
}
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/DisaComputer.json", {
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/DisaComputer_Load.json", {
onProgress: UnityProgress,
compatibilityCheck:CheckCompatibility,
Module: {

@ -1,9 +1,9 @@
{
"companyName": "Educode",
"productName": "Formwork",
"dataUrl": "DisaComputer.data.unityweb",
"wasmCodeUrl": "DisaComputer.wasm.code.unityweb",
"wasmFrameworkUrl": "DisaComputer.wasm.framework.unityweb",
"dataUrl": "DisaComputer_Load.data.unityweb",
"wasmCodeUrl": "DisaComputer_Load.wasm.code.unityweb",
"wasmFrameworkUrl": "DisaComputer_Load.wasm.framework.unityweb",
"TOTAL_MEMORY": 268435456,
"graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],
"webglContextAttributes": {"preserveDrawingBuffer": false},

@ -0,0 +1,13 @@
{
"companyName": "Educode",
"productName": "Formwork",
"dataUrl": "DisaComputer_Unload.data.unityweb",
"wasmCodeUrl": "DisaComputer_Unload.wasm.code.unityweb",
"wasmFrameworkUrl": "DisaComputer_Unload.wasm.framework.unityweb",
"TOTAL_MEMORY": 268435456,
"graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],
"webglContextAttributes": {"preserveDrawingBuffer": false},
"splashScreenStyle": "Dark",
"backgroundColor": "#231F20",
"cacheControl": {"default": "must-revalidate"}
}

@ -0,0 +1,6 @@
{
//Load
//Unload
"GameState":"Unload"
}

@ -0,0 +1 @@
Build from DESKTOP-Q4UN19A at 2020/11/12 15:53:47

@ -69,7 +69,7 @@
}
}
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/DisaComputer.json", {
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/DisaComputer_Load.json", {
onProgress: UnityProgress,
compatibilityCheck:CheckCompatibility,
Module: {

@ -0,0 +1,6 @@
{
//Load
//Unload
"GameState":"Load"
}

@ -1 +1 @@
Build from DESKTOP-Q4UN19A at 2020/10/17 10:29:19
Build from DESKTOP-Q4UN19A at 2020/11/12 15:53:47

@ -0,0 +1,13 @@
{
"companyName": "Educode",
"productName": "Formwork",
"dataUrl": "DisaComputer_Load.data.unityweb",
"wasmCodeUrl": "DisaComputer_Load.wasm.code.unityweb",
"wasmFrameworkUrl": "DisaComputer_Load.wasm.framework.unityweb",
"TOTAL_MEMORY": 268435456,
"graphicsAPI": ["WebGL 2.0", "WebGL 1.0"],
"webglContextAttributes": {"preserveDrawingBuffer": false},
"splashScreenStyle": "Dark",
"backgroundColor": "#231F20",
"cacheControl": {"default": "must-revalidate"}
}

@ -0,0 +1,6 @@
{
//Load
//Unload
"GameState":"Unload"
}

@ -1 +1 @@
Build from DESKTOP-Q4UN19A at 2020/10/19 9:08:18
Build from DESKTOP-Q4UN19A at 2020/11/12 15:53:47

@ -69,7 +69,7 @@
}
}
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/DisaComputer_Unload.json", {
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/DisaComputer_Load.json", {
onProgress: UnityProgress,
compatibilityCheck:CheckCompatibility,
Module: {

Loading…
Cancel
Save