mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Update net Demo
Update net Demo
This commit is contained in:
8
Assets/NetDemo.meta
Normal file
8
Assets/NetDemo.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf0ff873278c14a40adcaec2fa8fc089
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
249
Assets/NetDemo/TEngine-NetDemo.unity
Normal file
249
Assets/NetDemo/TEngine-NetDemo.unity
Normal file
@@ -0,0 +1,249 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 1
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &1143387670
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1143387671}
|
||||
- component: {fileID: 1143387672}
|
||||
m_Layer: 0
|
||||
m_Name: TEngine
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1143387671
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1143387670}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1143387672
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1143387670}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 091015446be02ff4eb886963dbe15d74, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1861967532
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1861967535}
|
||||
- component: {fileID: 1861967534}
|
||||
- component: {fileID: 1861967533}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1861967533
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861967532}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1861967534
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861967532}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 2
|
||||
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &1861967535
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1861967532}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
7
Assets/NetDemo/TEngine-NetDemo.unity.meta
Normal file
7
Assets/NetDemo/TEngine-NetDemo.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 961c85cf7d9a44549a13b94e9931e037
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
21
Assets/NetDemo/TEngineNetDemo.cs
Normal file
21
Assets/NetDemo/TEngineNetDemo.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using TEngineCore.Net;
|
||||
|
||||
namespace TEngineCore
|
||||
{
|
||||
public class TEngineNetDemo : TEngineCore.TEngine
|
||||
{
|
||||
protected override void RegisterAllSystem()
|
||||
{
|
||||
base.RegisterAllSystem();
|
||||
AddLogicSys(UISys.Instance);
|
||||
AddLogicSys(DataCenterSys.Instance);
|
||||
}
|
||||
|
||||
protected override void StartGame()
|
||||
{
|
||||
UISys.Mgr.ShowWindow<TEngineLoginUI>();
|
||||
|
||||
GameClient.Instance.Connect("127.0.0.1", 54809,true);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/NetDemo/TEngineNetDemo.cs.meta
Normal file
11
Assets/NetDemo/TEngineNetDemo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 091015446be02ff4eb886963dbe15d74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/TEngine/Runtime/3rd/Google.Protobuf.dll
Normal file
BIN
Assets/TEngine/Runtime/3rd/Google.Protobuf.dll
Normal file
Binary file not shown.
33
Assets/TEngine/Runtime/3rd/Google.Protobuf.dll.meta
Normal file
33
Assets/TEngine/Runtime/3rd/Google.Protobuf.dll.meta
Normal file
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc1df66dc43ec00438f5efe32d149c89
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -181,7 +181,7 @@ namespace TEngine
|
||||
else
|
||||
{
|
||||
_stringBuilder.AppendFormat(
|
||||
bColor ? "[TLogger][INFO][{0}] - <color=gray>{1}</color>" : "[TLogger][SUCCESSED][{0}] - {1}",
|
||||
bColor ? "[TLogger][INFO][{0}] - <color=#00FF18>{1}</color>" : "[TLogger][SUCCESSED][{0}] - {1}",
|
||||
System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), logString);
|
||||
}
|
||||
break;
|
||||
|
1417
Assets/TResources/UI/TEngineLoginUI.prefab
Normal file
1417
Assets/TResources/UI/TEngineLoginUI.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/TResources/UI/TEngineLoginUI.prefab.meta
Normal file
7
Assets/TResources/UI/TEngineLoginUI.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb0019c52a8760745b9ea0bc9e15c976
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0"
|
||||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -19,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DefineConstants>DEBUG;UNITY_EDITOR;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -27,7 +26,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;ASSETBUNDLE_ENABLE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -60,9 +59,12 @@
|
||||
<Reference Include="protobuf-net">
|
||||
<HintPath>UnityLib\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="protobuf-net">
|
||||
<Reference Include="Google.Protobuf">
|
||||
<HintPath>UnityLib\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEditor">
|
||||
<HintPath>UnityLib\UnityEditor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
@@ -75,8 +77,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="src\GameLogic\" />
|
||||
<Folder Include="src\Proto\" />
|
||||
<Folder Include="src\TEngineCore\3rd\" />
|
||||
<Folder Include="src\TEngineCore\Net\Demon\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
BIN
TEngineHotUpdate/UnityLib/UnityEditor.dll
Normal file
BIN
TEngineHotUpdate/UnityLib/UnityEditor.dll
Normal file
Binary file not shown.
@@ -181,7 +181,7 @@ namespace TEngineCore
|
||||
else
|
||||
{
|
||||
_stringBuilder.AppendFormat(
|
||||
bColor ? "[TLogger][INFO][{0}] - <color=gray>{1}</color>" : "[TLogger][SUCCESSED][{0}] - {1}",
|
||||
bColor ? "[TLogger][INFO][{0}] - <color=#00FF18>{1}</color>" : "[TLogger][SUCCESSED][{0}] - {1}",
|
||||
System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"), logString);
|
||||
}
|
||||
break;
|
||||
|
@@ -47,9 +47,10 @@ namespace TEngineCore.Net
|
||||
{
|
||||
TLogger.LogError(e.Message);
|
||||
TLogger.LogError("socket connect {0}:{1} failed", host, port);
|
||||
//ChangeStateOnEnterFail();
|
||||
return false;
|
||||
}
|
||||
|
||||
TLogger.LogInfoSuccessd("connect server[{0}:{1}] success!!!", host, port);
|
||||
m_Host = host;
|
||||
m_Port = port;
|
||||
return true;
|
||||
|
@@ -20,9 +20,26 @@ namespace TEngineCore.Net
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnUpdate()
|
||||
{
|
||||
GameClient.Instance.OnUpdate();
|
||||
var listModule = m_listModule;
|
||||
for (int i = 0; i < listModule.Count; i++)
|
||||
{
|
||||
listModule[i].OnUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
{
|
||||
GameClient.Instance.Shutdown();
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
private void RegCmdHandle()
|
||||
{
|
||||
|
||||
var client = GameClient.Instance;
|
||||
//client.RegActionHandle();
|
||||
}
|
||||
|
||||
void InitModule()
|
||||
|
57
TEngineHotUpdate/src/TEngineCore/Net/Demon/TEngineLoginUI.cs
Normal file
57
TEngineHotUpdate/src/TEngineCore/Net/Demon/TEngineLoginUI.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using TEngineCore;
|
||||
using TEngineCore.Net;
|
||||
using TEngineProto;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TEngineCore
|
||||
{
|
||||
public class TEngineLoginUI : UIWindow
|
||||
{
|
||||
#region 脚本工具生成的代码
|
||||
private Image m_imgbg;
|
||||
private Text m_textTittle;
|
||||
private Text m_textVer;
|
||||
private Image m_imgLogo;
|
||||
private GameObject m_goLoading;
|
||||
private GameObject m_goLoginRoot;
|
||||
private InputField m_inputName;
|
||||
private InputField m_inputPassword;
|
||||
private Button m_btnLogin;
|
||||
protected override void ScriptGenerator()
|
||||
{
|
||||
m_imgbg = FindChildComponent<Image>("m_imgbg");
|
||||
m_textTittle = FindChildComponent<Text>("m_textTittle");
|
||||
m_textVer = FindChildComponent<Text>("m_textVer");
|
||||
m_imgLogo = FindChildComponent<Image>("m_imgLogo");
|
||||
m_goLoading = FindChild("m_goLoading").gameObject;
|
||||
m_goLoginRoot = FindChild("m_goLoginRoot").gameObject;
|
||||
m_inputName = FindChildComponent<InputField>("m_goLoginRoot/m_inputName");
|
||||
m_inputPassword = FindChildComponent<InputField>("m_goLoginRoot/m_inputPassword");
|
||||
m_btnLogin = FindChildComponent<Button>("m_goLoginRoot/m_btnLogin");
|
||||
m_btnLogin.onClick.AddListener(OnClickLoginBtn);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 事件
|
||||
private void OnClickLoginBtn()
|
||||
{
|
||||
var loginPack = new MainPack();
|
||||
loginPack.Requestcode = RequestCode.User;
|
||||
loginPack.Actioncode = ActionCode.Login;
|
||||
loginPack.LoginPack = new LoginPack
|
||||
{
|
||||
Username = m_inputName.text,
|
||||
Password = m_inputName.text,
|
||||
};
|
||||
GameClient.Instance.SendCsMsg(loginPack, CallBack);
|
||||
}
|
||||
|
||||
private void CallBack(MainPack pack)
|
||||
{
|
||||
TLogger.LogInfoSuccessd("MainPack" + pack);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@@ -112,6 +112,15 @@ namespace TEngineCore.Net
|
||||
m_connectWatcher = new ClientConnectWatcher(this);
|
||||
}
|
||||
|
||||
~GameClient()
|
||||
{
|
||||
if (m_connect != null)
|
||||
{
|
||||
m_connect.Close();
|
||||
}
|
||||
m_connect = null;
|
||||
}
|
||||
|
||||
public bool Connect(string host, int port, bool reconnect = false)
|
||||
{
|
||||
ResetParam();
|
||||
@@ -123,7 +132,7 @@ namespace TEngineCore.Net
|
||||
m_lastHost = host;
|
||||
m_lastPort = port;
|
||||
Status = reconnect ? GameClientStatus.StatusReconnect : GameClientStatus.StatusInit;
|
||||
TLogger.LogWarning("Start connect server {0}:{1} Reconnect:{2}", host, port, reconnect);
|
||||
TLogger.LogInfo("Start connect server {0}:{1} Reconnect:{2}", host, port, reconnect);
|
||||
return m_connect.Connect(host, port);
|
||||
}
|
||||
|
||||
@@ -131,6 +140,7 @@ namespace TEngineCore.Net
|
||||
{
|
||||
m_connect.Close();
|
||||
m_status = GameClientStatus.StatusInit;
|
||||
TLogger.LogWarning("GameClient Shut Down");
|
||||
}
|
||||
|
||||
#region 发送网络消息
|
||||
@@ -255,11 +265,14 @@ namespace TEngineCore.Net
|
||||
|
||||
if (listHandle != null)
|
||||
{
|
||||
if (listHandle.Contains(msgDelegate))
|
||||
if (!listHandle.Contains(msgDelegate))
|
||||
{
|
||||
Debug.LogFormat("-------------repeat RegCmdHandle ActionCode:{0}-----------", (ActionCode)actionId);
|
||||
listHandle.Add(msgDelegate);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Debug.LogFormat("-------------repeat RegCmdHandle ActionCode:{0}-----------", (ActionCode)actionId);
|
||||
}
|
||||
listHandle.Add(msgDelegate);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -437,7 +450,7 @@ namespace TEngineCore.Net
|
||||
uint hashIndex = actionCode % MAX_MSG_HANDLE;
|
||||
if (m_aMsgHandles[hashIndex] != null)
|
||||
{
|
||||
NotifyTimeout(m_aMsgHandles[hashIndex]);
|
||||
//NotifyTimeout(m_aMsgHandles[hashIndex]);
|
||||
RmvCheckCsMsg((int)hashIndex);
|
||||
}
|
||||
m_aMsgHandles[hashIndex] = resHandler;
|
||||
@@ -465,13 +478,16 @@ namespace TEngineCore.Net
|
||||
{
|
||||
var pack = queuepPacks.Peek();
|
||||
|
||||
handle(pack);
|
||||
if (pack != null)
|
||||
{
|
||||
handle(pack);
|
||||
|
||||
UInt32 hashIndex = (uint)pack.Actioncode % MAX_MSG_HANDLE;
|
||||
UInt32 hashIndex = (uint)pack.Actioncode % MAX_MSG_HANDLE;
|
||||
|
||||
m_aMsgHandles[hashIndex](null);
|
||||
m_aMsgHandles[hashIndex](null);
|
||||
|
||||
RmvCheckCsMsg((int)hashIndex);
|
||||
RmvCheckCsMsg((int)hashIndex);
|
||||
}
|
||||
}
|
||||
queuepPacks.Dequeue();
|
||||
}
|
||||
@@ -493,6 +509,11 @@ namespace TEngineCore.Net
|
||||
|
||||
public override void Release()
|
||||
{
|
||||
if (m_connect != null)
|
||||
{
|
||||
m_connect.Close();
|
||||
}
|
||||
m_connect = null;
|
||||
base.Release();
|
||||
}
|
||||
|
||||
|
59
TEngineHotUpdate/src/TEngineCore/UI/Demo/TEngineUI.cs
Normal file
59
TEngineHotUpdate/src/TEngineCore/UI/Demo/TEngineUI.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TEngineCore
|
||||
{
|
||||
public class TEngineUI : UIWindow
|
||||
{
|
||||
#region 脚本工具生成的代码
|
||||
private Image m_imgbg;
|
||||
private Text m_textTittle;
|
||||
private Text m_textVer;
|
||||
protected override void ScriptGenerator()
|
||||
{
|
||||
m_imgbg = FindChildComponent<Image>("m_imgbg");
|
||||
m_textTittle = FindChildComponent<Text>("m_textTittle");
|
||||
m_textVer = FindChildComponent<Text>("m_textVer");
|
||||
|
||||
TLogger.LogInfo("TEngineUI ScriptGenerator");
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override void RegisterEvent()
|
||||
{
|
||||
GameEventMgr.Instance.AddEventListener<string>(2,((s) =>
|
||||
{
|
||||
TLogger.LogWarning("RegisterEvent");
|
||||
}));
|
||||
}
|
||||
|
||||
protected override void BindMemberProperty()
|
||||
{
|
||||
base.BindMemberProperty();
|
||||
|
||||
TLogger.LogInfo("TEngineUI BindMemberProperty");
|
||||
}
|
||||
|
||||
protected override void OnCreate()
|
||||
{
|
||||
base.OnCreate();
|
||||
|
||||
TLogger.LogInfo("TEngineUI OnCreate");
|
||||
}
|
||||
|
||||
protected override void OnVisible()
|
||||
{
|
||||
base.OnVisible();
|
||||
|
||||
TLogger.LogInfo("TEngineUI OnVisible");
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region 事件
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@@ -6,20 +6,19 @@ using UnityEngine.UI;
|
||||
|
||||
namespace TEngineCore
|
||||
{
|
||||
public static class TipsEvent
|
||||
{
|
||||
public static int Log = StringId.StringToHash("TipsEvent.Log");
|
||||
}
|
||||
|
||||
public class MsgUI : UIWindow
|
||||
{
|
||||
protected override void RegisterEvent()
|
||||
{
|
||||
base.RegisterEvent();
|
||||
GameEventMgr.Instance.AddEventListener<string>(TipsEvent.Log, TipsUI.Instance.Show);
|
||||
}
|
||||
}
|
||||
|
||||
public class TipsEvent
|
||||
{
|
||||
public static int Log = StringId.StringToHash("TipsEvent.Log");
|
||||
}
|
||||
|
||||
public class TipsUI : MonoBehaviour
|
||||
{
|
||||
//单例
|
||||
|
Reference in New Issue
Block a user