Play from Bootstrap scene. Move heavy logic to other Thread
This commit is contained in:
@@ -3827,6 +3827,142 @@ MonoBehaviour:
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &5727863043411723117
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1306231628402548473}
|
||||
- component: {fileID: 7611469891124614779}
|
||||
- component: {fileID: 8138679065215916556}
|
||||
m_Layer: 0
|
||||
m_Name: FPSText
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1306231628402548473
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5727863043411723117}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6210342792191300609}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 100, y: 25}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7611469891124614779
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5727863043411723117}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &8138679065215916556
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5727863043411723117}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 000
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2}
|
||||
m_sharedMaterial: {fileID: 9092487103257209053, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4291756287
|
||||
m_fontColor: {r: 1, g: 0, b: 0.8118372, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 40
|
||||
m_fontSizeBase: 40
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &5885931642767984348
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4404,6 +4540,7 @@ Transform:
|
||||
- {fileID: 3233441867675090637}
|
||||
- {fileID: 330835371656537333}
|
||||
- {fileID: 7148351193174662273}
|
||||
- {fileID: 6210342792191300609}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1890210201668811196
|
||||
@@ -4418,7 +4555,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: d21c02a79936b334da12ef5379524df2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
uiRoot: {fileID: 0}
|
||||
_fpsText: {fileID: 8138679065215916556}
|
||||
uiPrefabs: []
|
||||
npsUI: {fileID: 8090791712930107248}
|
||||
currentTargetNPCID: 0
|
||||
@@ -5214,6 +5351,108 @@ MonoBehaviour:
|
||||
- {fileID: 445184971459596056}
|
||||
- {fileID: 3804662600613272361}
|
||||
- {fileID: 1774515210692260948}
|
||||
--- !u!1 &8644839137304674498
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6210342792191300609}
|
||||
- component: {fileID: 3434319454937597182}
|
||||
- component: {fileID: 2220022565094034758}
|
||||
- component: {fileID: 2827532456117971684}
|
||||
m_Layer: 0
|
||||
m_Name: Canvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6210342792191300609
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8644839137304674498}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1306231628402548473}
|
||||
m_Father: {fileID: 2780428059708698453}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!223 &3434319454937597182
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8644839137304674498}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 10
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &2220022565094034758
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8644839137304674498}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 1920, y: 1080}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 1
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &2827532456117971684
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8644839137304674498}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!1 &8902228212386757619
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -10882,7 +11121,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8435310359341866937, guid: b5a4a3ed5bf0e5a49ba0f89d26e1f36e, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -25.33552
|
||||
value: -25.335571
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8579427623307909814, guid: b5a4a3ed5bf0e5a49ba0f89d26e1f36e, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d367fa56162cf045cb9f046aa3953821a7011bb15c33b5a2beaaba5283f5e2d9
|
||||
size 21448
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e0c57d8d96f20a7602e9c9af036ccd27adccf9d08ecbcd6f60bec0ba4e78e5e2
|
||||
size 281532
|
||||
+1
-1
@@ -4,7 +4,7 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class BoostrapSceneController : MonoBehaviour
|
||||
public class BootstrapSceneController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private string _nextSceneName;
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace BrewMonster
|
||||
else
|
||||
{
|
||||
_cinemachineCamera.Follow = CECGameRun.Instance.GetHostPlayer().transform;
|
||||
_cinemachineCamera.ForceCameraPosition(CECGameRun.Instance.GetHostPlayer().transform.position, Quaternion.identity);
|
||||
_cinemachineCamera.ForceCameraPosition(CECGameRun.Instance.GetHostPlayer().ObjectPosition, Quaternion.identity);
|
||||
orbital.HorizontalAxis.Value = 208;
|
||||
orbital.VerticalAxis.Value = -268;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BrewMonster.Scripts
|
||||
{
|
||||
public class ConsistentObjectContainer : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e565f914738e4e68a1c2688272d0ee5
|
||||
@@ -20,6 +20,11 @@ public class CECObject : MonoBehaviour
|
||||
protected Quaternion targetRotation;
|
||||
protected Quaternion startRotation; // Store starting rotation for Slerp
|
||||
protected Vector3 g_vAxisY = Vector3.up;
|
||||
|
||||
|
||||
protected Transform _objectTransform;
|
||||
protected Vector3 objectPosition;
|
||||
public Vector3 ObjectPosition { get => objectPosition; }
|
||||
// Class ID
|
||||
public static class Class_ID
|
||||
{
|
||||
@@ -137,13 +142,20 @@ public class CECObject : MonoBehaviour
|
||||
return v / mag;
|
||||
}
|
||||
|
||||
public A3DVECTOR3 GetPos()
|
||||
/// <summary>
|
||||
/// Get the position of the object. <br/>
|
||||
/// Consider NOT use the transform position if you get the data from outside of the MainThread.
|
||||
/// </summary>
|
||||
/// <param name="useTransform">If true, use the transform position, otherwise use the object position for slighly better performance.</param>
|
||||
/// <returns></returns>
|
||||
public A3DVECTOR3 GetPos(bool useTransform = true)
|
||||
{
|
||||
return EC_Utility.ToA3DVECTOR3(transform.position);
|
||||
return EC_Utility.ToA3DVECTOR3(useTransform ? _objectTransform.position : objectPosition);
|
||||
}
|
||||
public Vector3 GetPosVector3()
|
||||
|
||||
public Vector3 GetPosVector3(bool useTransform = true)
|
||||
{
|
||||
return transform.position;
|
||||
return useTransform ? _objectTransform.position : objectPosition;
|
||||
}
|
||||
|
||||
// Turn around object and face to specified object
|
||||
@@ -189,6 +201,11 @@ public class CECObject : MonoBehaviour
|
||||
}
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (_objectTransform == null)
|
||||
{
|
||||
_objectTransform = transform;
|
||||
}
|
||||
objectPosition = _objectTransform.position;
|
||||
if (m_bAdjustOrient)
|
||||
AdjustOrientation(Time.deltaTime);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ using BrewMonster.Network;
|
||||
using BrewMonster.Scripts;
|
||||
using BrewMonster.Scripts.Task;
|
||||
using CSNetwork.GPDataType;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using static CECNPC;
|
||||
|
||||
@@ -18,6 +20,8 @@ public class CECNPCServer : CECNPC
|
||||
private IconTaskType m_TaskIcon = IconTaskType.QI_NONE;
|
||||
private CECCounter m_TaskCounter = new CECCounter();
|
||||
|
||||
private bool _needUpdateTaskIcon = false;
|
||||
|
||||
public override void SetUpCECNPC(CECNPCMan pNPCMan)
|
||||
{
|
||||
base.SetUpCECNPC(pNPCMan);
|
||||
@@ -68,13 +72,29 @@ public class CECNPCServer : CECNPC
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
var destroyToken = this.GetCancellationTokenOnDestroy();
|
||||
UniTask.RunOnThreadPool(UpdateCurTaskIconProcess, false, cancellationToken: destroyToken).Forget();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (m_TaskCounter.IncCounter(Time.deltaTime * 1000))
|
||||
if (_needUpdateTaskIcon)
|
||||
{
|
||||
m_TaskCounter.Reset();
|
||||
UpdateTaskIconUI();
|
||||
_needUpdateTaskIcon = false;
|
||||
}
|
||||
}
|
||||
|
||||
private async UniTask UpdateCurTaskIconProcess()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
UpdateCurTaskIcon();
|
||||
}
|
||||
}
|
||||
@@ -165,7 +185,7 @@ public class CECNPCServer : CECNPC
|
||||
{
|
||||
m_TaskIcon = IconTaskType.QI_IN_K;
|
||||
BMLogger.Log($"[UpdateCurTaskIcon] Set icon QI_IN_K for task {idTask}");
|
||||
UpdateTaskIconUI();
|
||||
_needUpdateTaskIcon = true;
|
||||
return;
|
||||
}
|
||||
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTEvent || pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTDaily)
|
||||
@@ -211,7 +231,7 @@ public class CECNPCServer : CECNPC
|
||||
m_TaskIcon = IconTaskType.QI_IN_TYPE1;
|
||||
|
||||
BMLogger.Log($"[UpdateCurTaskIcon] Set complete icon {m_TaskIcon}");
|
||||
UpdateTaskIconUI();
|
||||
_needUpdateTaskIcon = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -255,7 +275,7 @@ public class CECNPCServer : CECNPC
|
||||
if (pTaskTemp.IsKeyTask())
|
||||
{
|
||||
m_TaskIcon = IconTaskType.QI_OUT_K;
|
||||
UpdateTaskIconUI();
|
||||
_needUpdateTaskIcon = true;
|
||||
return;
|
||||
}
|
||||
else if (pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTEvent || pTaskTemp.GetType() == (uint)ENUM_TASK_TYPE.enumTTDaily)
|
||||
@@ -304,7 +324,7 @@ public class CECNPCServer : CECNPC
|
||||
m_TaskIcon = IconTaskType.QI_OUT_N;
|
||||
|
||||
//BMLogger.Log($"[UpdateCurTaskIcon] Final icon {m_TaskIcon}, taskFlag={taskFlag}");
|
||||
UpdateTaskIconUI();
|
||||
_needUpdateTaskIcon = true;
|
||||
}
|
||||
|
||||
private void UpdateTaskIconUI()
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace CSNetwork
|
||||
public Queue<ECMSG> m_MsgList = new Queue<ECMSG>();
|
||||
private IMsgHandler m_tempHandler; // so we don't have to allocate a new one every time
|
||||
|
||||
private static ECMSG _currentMsg;
|
||||
|
||||
private EC_ManMessage() { }
|
||||
|
||||
/// <summary>Post a message to the message queue</summary>
|
||||
@@ -63,16 +65,16 @@ namespace CSNetwork
|
||||
int i, count = Instance.m_MsgList.Count;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
ECMSG msg = Instance.m_MsgList.Dequeue();
|
||||
if (!Instance.m_MsgHandlerList.ContainsKey(msg.iManager))
|
||||
_currentMsg = Instance.m_MsgList.Dequeue();
|
||||
if (!Instance.m_MsgHandlerList.ContainsKey(_currentMsg.iManager))
|
||||
{
|
||||
BMLogger.LogError("Did not find handler ID: " + msg.iManager);
|
||||
BMLogger.LogError("Did not find handler ID: " + _currentMsg.iManager);
|
||||
continue;
|
||||
}
|
||||
Instance.m_tempHandler = Instance.m_MsgHandlerList[msg.iManager];
|
||||
Instance.m_tempHandler = Instance.m_MsgHandlerList[_currentMsg.iManager];
|
||||
if (Instance.m_tempHandler != null)
|
||||
{
|
||||
Instance.m_tempHandler.ProcessMessage(msg);
|
||||
Instance.m_tempHandler.ProcessMessage(_currentMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,6 +347,17 @@ namespace BrewMonster.Network
|
||||
{
|
||||
return _gameSession.GetRoleInfo();
|
||||
}
|
||||
|
||||
public string GetWorldInstanceName()
|
||||
{
|
||||
switch (_gameSession.GetRoleInfo().worldtag)
|
||||
{
|
||||
case 161:
|
||||
return "a61";
|
||||
default:
|
||||
return "a61";
|
||||
}
|
||||
}
|
||||
/// <summary>Make sure username and password is set before calling this method</summary>
|
||||
private async Task ConnectAsync(string ip, int port)
|
||||
{
|
||||
@@ -629,13 +640,13 @@ namespace BrewMonster.Network
|
||||
Instance._gameSession.GetRoleCustomizeData(iNumRole, aRoleIDs);
|
||||
}
|
||||
|
||||
public void LoadScene(string sceneName, LoadSceneMode mode, Action<bool> actDone)
|
||||
public void LoadScene(string sceneName, LoadSceneMode mode, Action<float> actProgress, Action<bool> actDone)
|
||||
{
|
||||
// SceneLoadService.Load(sceneName, mode, actDone);
|
||||
StartCoroutine(LoadSceneCoroutine(sceneName, mode, actDone));
|
||||
StartCoroutine(LoadSceneCoroutine(sceneName, mode, actProgress, actDone));
|
||||
}
|
||||
|
||||
private IEnumerator LoadSceneCoroutine(string sceneName, LoadSceneMode mode, Action<bool> actDone)
|
||||
private IEnumerator LoadSceneCoroutine(string sceneName, LoadSceneMode mode, Action<float> actProgress, Action<bool> actDone)
|
||||
{
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, mode);
|
||||
asyncLoad.allowSceneActivation = false;
|
||||
|
||||
@@ -235,6 +235,8 @@ namespace PerfectWorld.Scripts
|
||||
|
||||
private new void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// Recovery: after Unity domain reload, manager dictionaries reset but scene objects persist.
|
||||
// Keep trying until we successfully register.
|
||||
if (!m_registeredToManMatter)
|
||||
|
||||
@@ -30,24 +30,6 @@ namespace BrewMonster
|
||||
public void ShowLoadingScene(bool active)
|
||||
{
|
||||
goContent.SetActive(active);
|
||||
|
||||
// if (active)
|
||||
// {
|
||||
// Debug.LogError("Loading scene controller started");
|
||||
//
|
||||
// finished = false;
|
||||
// loadingText.text = "Loading...";
|
||||
// UpdateUI(0);
|
||||
//
|
||||
// cts?.Cancel();
|
||||
// cts = new CancellationTokenSource();
|
||||
//
|
||||
// ObserveLoadingAsync(cts.Token).Forget();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// cts?.Cancel();
|
||||
// }
|
||||
}
|
||||
|
||||
async UniTaskVoid ObserveLoadingAsync(CancellationToken token)
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace BrewMonster
|
||||
{
|
||||
public GameObject InstantiateObject(GameObject prefab, Transform parent =null, bool setThisAsParent = true)
|
||||
{
|
||||
if (prefab == null)
|
||||
{
|
||||
BMLogger.LogError("ObjectSpawner::InstantiateObject, prefab is null");
|
||||
return GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
}
|
||||
if (setThisAsParent)
|
||||
{
|
||||
return Instantiate(prefab, transform);
|
||||
|
||||
@@ -434,7 +434,7 @@ namespace BrewMonster.Scripts.Task
|
||||
pTaskMan.Release();
|
||||
LoadingSceneController.Instance.ShowLoadingScene(true);
|
||||
LoadingSceneController.Instance.UpdateUI(0f);
|
||||
LoadingSceneController.Instance.SetLoadingText("Loading Tasks From Pack");
|
||||
LoadingSceneController.Instance.SetLoadingText("Du Nhập Thế Giới Hoàn Mỹ");
|
||||
|
||||
//string task_data_path = Path.Combine(Application.streamingAssetsPath, "data/tasks.data");
|
||||
string task_data_path = "Assets/PerfectWorld/Data/tasks.txt";
|
||||
@@ -444,15 +444,17 @@ namespace BrewMonster.Scripts.Task
|
||||
LoadingSceneController.Instance.SetProgress(x);
|
||||
}, _cts.Token);
|
||||
|
||||
|
||||
LoadingSceneController.Instance.UpdateUI(0.3f);
|
||||
//var task_npc_path = Path.Combine(Application.streamingAssetsPath, "data/task_npc.data");
|
||||
var task_npc_path = "Assets/PerfectWorld/Data/task_npc.txt";
|
||||
await pTaskMan.LoadNPCInfoFromPack(task_npc_path);
|
||||
|
||||
LoadingSceneController.Instance.UpdateUI(0.8f);
|
||||
|
||||
//var dyn_tasks_path = Path.Combine(Application.streamingAssetsPath, "data/dyn_tasks.data");
|
||||
var dyn_tasks_path = "Assets/PerfectWorld/Data/dyn_tasks.txt";
|
||||
await pTaskMan.VerifyDynTasksPack(dyn_tasks_path);
|
||||
|
||||
LoadingSceneController.Instance.UpdateUI(1f);
|
||||
InitActiveTaskList();
|
||||
SceneLoader.SceneLoadProcess = SceneLoadProcess.EndLoading;
|
||||
LoadingSceneController.Instance.ShowLoadingScene(false);
|
||||
@@ -868,7 +870,7 @@ namespace BrewMonster.Scripts.Task
|
||||
|
||||
public int GetPos(float[] pos)
|
||||
{
|
||||
A3DVECTOR3 vPos = m_pHost.GetPos();
|
||||
A3DVECTOR3 vPos = m_pHost.GetPos(false);
|
||||
if (pos != null && pos.Length >= 3)
|
||||
{
|
||||
pos[0] = vPos.x;
|
||||
|
||||
@@ -69,11 +69,11 @@ namespace BrewMonster.UI
|
||||
context = SynchronizationContext.Current;
|
||||
|
||||
// Requirement: Login UI should also have a61 loaded.
|
||||
var world = SceneManager.GetSceneByName("a61");
|
||||
if (!world.IsValid() || !world.isLoaded)
|
||||
{
|
||||
SceneManager.LoadSceneAsync("a61", LoadSceneMode.Additive);
|
||||
}
|
||||
// var world = SceneManager.GetSceneByName("a61");
|
||||
// if (!world.IsValid() || !world.isLoaded)
|
||||
// {
|
||||
// SceneManager.LoadSceneAsync("a61", LoadSceneMode.Additive);
|
||||
// }
|
||||
|
||||
_usernameInputField.text = PlayerPrefs.GetString("username", "");
|
||||
_passwordInputField.text = PlayerPrefs.GetString("password", "");
|
||||
@@ -267,6 +267,7 @@ namespace BrewMonster.UI
|
||||
|
||||
private void OnClickSelectCharacter(RoleInfo roleInfo)
|
||||
{
|
||||
LoadingSceneController.Instance.ShowLoadingScene(true);
|
||||
UnityGameSession.SelectRoleAsync(roleInfo, OnSelectRoleComplete);
|
||||
}
|
||||
|
||||
@@ -335,7 +336,6 @@ namespace BrewMonster.UI
|
||||
};
|
||||
SceneLoader.SceneLoadProcess = SceneLoadProcess.Loading;
|
||||
SceneLoader.LoadingProgress = 0;
|
||||
LoadingSceneController.Instance.ShowLoadingScene(true);
|
||||
#if TESTFAST
|
||||
string nameScene = "LoginScene";
|
||||
SceneManager.UnloadSceneAsync(nameScene);
|
||||
@@ -344,16 +344,17 @@ namespace BrewMonster.UI
|
||||
actLoadChar?.Invoke();
|
||||
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
|
||||
#else
|
||||
string nameScene = "NPCRender";
|
||||
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single, (value) =>
|
||||
string nameScene = UnityGameSession.Instance.GetWorldInstanceName();
|
||||
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Single,
|
||||
(progress) =>
|
||||
{
|
||||
isDoneNPCRender = value;
|
||||
actLoadChar?.Invoke();
|
||||
});
|
||||
nameScene = "a61";
|
||||
UnityGameSession.Instance.LoadScene(nameScene, LoadSceneMode.Additive, (value) =>
|
||||
LoadingSceneController.Instance.SetProgress(progress);
|
||||
},
|
||||
(value) =>
|
||||
{
|
||||
isDoneWorldRender = value;
|
||||
isDoneNPCRender = true;
|
||||
isDoneWorldRender = true;
|
||||
actLoadChar?.Invoke();
|
||||
UnityGameSession.EnterWorldAsync(roleInfo, OnEnterWorldComplete);
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
|
||||
{
|
||||
if ((_currentHostPos - _lastHostPos).sqrMagnitude < minMoveSqr)
|
||||
{
|
||||
await UniTask.Delay(intervalMs, cancellationToken: destroyToken);
|
||||
await Task.Delay(intervalMs, destroyToken);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public class LitModelHolder : MonoSingleton<LitModelHolder>
|
||||
|
||||
await TickStreaming(_currentHostPos, immediateSqr, paddingSqr, destroyToken);
|
||||
|
||||
await UniTask.Delay(intervalMs, cancellationToken: destroyToken);
|
||||
await Task.Delay(intervalMs, destroyToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &695809075354249832
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2466055582606182659}
|
||||
- component: {fileID: 6694799068998335831}
|
||||
m_Layer: 0
|
||||
m_Name: Boostrap (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2466055582606182659
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 695809075354249832}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8647913387955223815}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &6694799068998335831
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 695809075354249832}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2781611f0f83bf54290a9ec600543440, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nextSceneName: LoginScene
|
||||
--- !u!1 &4031863963514808284
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -76,7 +31,6 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 5828095428458008759}
|
||||
- {fileID: 3304007787827206689}
|
||||
- {fileID: 2466055582606182659}
|
||||
- {fileID: 1374891186888298875}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -92,7 +46,7 @@ GameObject:
|
||||
- component: {fileID: 7143671611729110091}
|
||||
- component: {fileID: 1552922004895094615}
|
||||
m_Layer: 0
|
||||
m_Name: GameSession (1)
|
||||
m_Name: GameSession
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -149,7 +103,7 @@ GameObject:
|
||||
- component: {fileID: 5828095428458008759}
|
||||
- component: {fileID: 7028019933536463136}
|
||||
m_Layer: 0
|
||||
m_Name: AutoIniializer (1)
|
||||
m_Name: AutoIniializer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -192,11 +146,11 @@ PrefabInstance:
|
||||
m_Modifications:
|
||||
- target: {fileID: 132536, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: IngameDebugConsole (1)
|
||||
value: IngameDebugConsole
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11414302, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Size
|
||||
value: 1
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 11414302, guid: 67117722a812a2e46ab8cb8eafbf5f5e, type: 3}
|
||||
propertyPath: m_Value
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4c46985f22f12472b048885ee58952b7c4bc7c5b6c4febfb45f6aec2a2390fd3
|
||||
size 196549630
|
||||
oid sha256:1f175b8382ec0686d5bce9ce1d33a04868482bfd6bf28ef42b01356eaba0630f
|
||||
size 196281143
|
||||
|
||||
@@ -75,7 +75,9 @@ public partial class CECGameRun
|
||||
}
|
||||
public void Init()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
Application.targetFrameRate = 60;
|
||||
#endif
|
||||
instance = this;
|
||||
// _gameRunConfig = Resources.Load<GameRunConfig>("GameRunConfig");
|
||||
// _playerPrefab = _gameRunConfig.PlayerPrefab;
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Runtime.InteropServices;
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
@@ -128,17 +129,13 @@ namespace BrewMonster
|
||||
TaskClient.OnServerNotify(pInterface, data, (uint)size);
|
||||
}
|
||||
|
||||
private void TickTask()
|
||||
private async UniTask TickTask()
|
||||
{
|
||||
// Update task
|
||||
// C ++ code uses dwDeltaTime from Tick function parameter
|
||||
if (m_pTaskInterface != null &&
|
||||
m_TaskCounter.IncCounter(Time.deltaTime * 1000f))
|
||||
while (true)
|
||||
{
|
||||
m_TaskCounter.Reset();
|
||||
TaskClient.OnTaskCheckStatus(m_pTaskInterface);
|
||||
// TODO: Update task UI if needed
|
||||
// m_pTaskInterface.UpdateEmotionDlg();
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ using CSNetwork;
|
||||
using CSNetwork.GPDataType;
|
||||
using CSNetwork.Protocols.RPCData;
|
||||
using CSNetwork.S2CCommand;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using ModelRenderer.Scripts.GameData;
|
||||
using PerfectWorld.Scripts;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
@@ -180,6 +181,7 @@ namespace BrewMonster
|
||||
|
||||
int[] targetsCastSkill;
|
||||
|
||||
|
||||
public bool IsChangingFace()
|
||||
{
|
||||
return m_bChangingFace;
|
||||
@@ -335,6 +337,9 @@ namespace BrewMonster
|
||||
m_GatherCnt.Reset(true);
|
||||
m_PetOptCnt.SetPeriod(1000);
|
||||
m_PetOptCnt.Reset(true);
|
||||
|
||||
// run a process on background to keep track of task status.
|
||||
UniTask.RunOnThreadPool(TickTask, false, this.GetCancellationTokenOnDestroy()).Forget();
|
||||
}
|
||||
|
||||
public bool LoadResources()
|
||||
@@ -436,8 +441,6 @@ namespace BrewMonster
|
||||
EstimateMoveEnv(GetPos());
|
||||
OnKeyDown();
|
||||
|
||||
// track status of Task
|
||||
TickTask();
|
||||
// Update timers
|
||||
UpdateTimers(Time.deltaTime);
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@ using BrewMonster.Scripts.Managers;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
using TMPro;
|
||||
|
||||
public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
{
|
||||
[SerializeField] private Transform uiRoot; // nơi chứa UI được spawn (Canvas hoặc Transform)
|
||||
[SerializeField] private TMP_Text _fpsText;
|
||||
[SerializeField] private List<GameObject> uiPrefabs; // drag các prefab UI vào đây
|
||||
|
||||
private readonly Dictionary<System.Type, GameObject> _spawnedUIs = new();
|
||||
@@ -54,6 +55,7 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
_fpsText.text = $"{Mathf.RoundToInt(1f / Time.deltaTime)}";
|
||||
if (m_pDlgQuickBar1 != null)
|
||||
{ m_pDlgQuickBar1.UpdateShortcuts(); }
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 0
|
||||
path: Assets/PerfectWorld/Scene/Boostrap.unity
|
||||
- enabled: 1
|
||||
path: Assets/PerfectWorld/Scene/Bootstrap.unity
|
||||
guid: 40f9b53766c74f541b85df4d35cfc767
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/a61.unity
|
||||
|
||||
@@ -791,7 +791,7 @@ PlayerSettings:
|
||||
webGLCloseOnQuit: 0
|
||||
webWasm2023: 0
|
||||
scriptingDefineSymbols:
|
||||
Android: DOTWEEN;TESTFAST;_TASK_CLIENT;LOAD_TASK_TEMPL;LICENSE_VERSION
|
||||
Android: DOTWEEN;_TASK_CLIENT;LOAD_TASK_TEMPL;LICENSE_VERSION
|
||||
EmbeddedLinux: DOTWEEN
|
||||
GameCoreScarlett: DOTWEEN
|
||||
GameCoreXboxOne: DOTWEEN
|
||||
|
||||
Reference in New Issue
Block a user