初始化天之禁

This commit is contained in:
ZombieKitty 2025-01-25 04:38:09 +08:00
parent ce0f19d447
commit 952a20ecb0
93765 changed files with 5495626 additions and 1 deletions

39
.gitattributes vendored
View File

@ -832,4 +832,41 @@ mono filter=lfs diff=lfs merge=binary -text
usymtool32 filter=lfs diff=lfs merge=binary -text
pedump filter=lfs diff=lfs merge=binary -text
C_AniObj_Sled filter=lfs diff=lfs merge=binary -text
AudioPluginOculusSpatializer filter=lfs diff=lfs merge=binary -text
AudioPluginOculusSpatializer filter=lfs diff=lfs merge=binary -text
# auto generated by UGit
*.anim filter=lfs diff=lfs merge=binary -text
*.prefab filter=lfs diff=lfs merge=binary -text
*.png filter=lfs diff=lfs merge=binary -text
*.tga filter=lfs diff=lfs merge=binary -text
*.FBX filter=lfs diff=lfs merge=binary -text
*.unity filter=lfs diff=lfs merge=binary -text
*.dll filter=lfs diff=lfs merge=binary -text
*.exr filter=lfs diff=lfs merge=binary -text
ArtifactDB filter=lfs diff=lfs merge=binary -text
*.jpg filter=lfs diff=lfs merge=binary -text
*.fbx filter=lfs diff=lfs merge=binary -text
*.dylib filter=lfs diff=lfs merge=binary -text
dsymutil filter=lfs diff=lfs merge=binary -text
*.bhc filter=lfs diff=lfs merge=binary -text
*.wav filter=lfs diff=lfs merge=binary -text
*.exe filter=lfs diff=lfs merge=binary -text
*.so filter=lfs diff=lfs merge=binary -text
*.mp4 filter=lfs diff=lfs merge=binary -text
*.asset filter=lfs diff=lfs merge=binary -text
*.pdb filter=lfs diff=lfs merge=binary -text
*.mp3 filter=lfs diff=lfs merge=binary -text
*.bytes filter=lfs diff=lfs merge=binary -text
*.TGA filter=lfs diff=lfs merge=binary -text
*.psd filter=lfs diff=lfs merge=binary -text
*.TTF filter=lfs diff=lfs merge=binary -text
*.bin filter=lfs diff=lfs merge=binary -text
*.dds filter=lfs diff=lfs merge=binary -text
*.bmp filter=lfs diff=lfs merge=binary -text
*.ttf filter=lfs diff=lfs merge=binary -text
*.tif filter=lfs diff=lfs merge=binary -text
UnityFbxSdkNative filter=lfs diff=lfs merge=binary -text
*.gif filter=lfs diff=lfs merge=binary -text
*.db filter=lfs diff=lfs merge=binary -text
*.obj filter=lfs diff=lfs merge=binary -text
*.spm filter=lfs diff=lfs merge=binary -text

72
.gitignore vendored Normal file
View File

@ -0,0 +1,72 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Pp]ackages/com.arongranberg.astar/ExampleScenes~
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
/[Bb]undles/
/Assets/StreamingAssets/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
.idea/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

6
.vsconfig Normal file
View File

@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}

9
Assets/Code.meta generated Normal file
View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1038296be03c2e546862cc46cecd0adc
folderAsset: yes
timeCreated: 1472047688
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

5
Assets/Code/Center.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: de332cbdc43b6de4194d40c39f8a015f
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,746 @@
using System;
using UnityEngine;
using System.Collections;
using Thousandto.Core.Base;
using Thousandto.Plugins.Common;
using Thousandto.Core.Framework;
using Thousandto.Code.Logic;
using Thousandto.Core.Asset;
using Thousandto.Code.Logic.Network;
using Thousandto.Code.Global;
using Thousandto.Core.Support;
using Thousandto.Core.PostEffect;
using XLua;
using System.Collections.Generic;
using EventManager = UnityEngine.Gonbest.MagicCube.EventManager;
using EventSystemHandler = UnityEngine.Gonbest.MagicCube.EventSystemHandler;
using PreLoadEventDefine = UnityEngine.Gonbest.MagicCube.PreLoadEventDefine;
using PathUtils = UnityEngine.Gonbest.MagicCube.PathUtils;
using CoroutinePool = UnityEngine.Gonbest.MagicCube.CoroutinePool;
using StringUtils = UnityEngine.Gonbest.MagicCube.StringUtils;
using FLogger = UnityEngine.Gonbest.MagicCube.FLogger;
using FLogManager = UnityEngine.Gonbest.MagicCube.FLogManager;
using FThreadPool = UnityEngine.Gonbest.MagicCube.FThreadPool;
namespace Thousandto.Code.Center
{
/// <summary>
/// 把游戏中所用到的系统实例,在此做一个静态定义
/// </summary>
[Hotfix]
public static class GameCenter
{
#region//私有变量
//是否已经初始化完毕
private static bool _isInitialized = false;
public static bool IsInitialized { get { return _isInitialized; } }
//是否挂起
public static bool IsFocused { get; set; }
#endregion
#region//游戏中内核逻辑管理器
//事件管理器
public static EventManager EventManager = null;
//网络管理器
public static Networker Networker = null;
//Prefab实例工厂容器
public static SpawnPoolManager SpawnPoolManager = null;
//Shader管理器
public static ShaderManager ShaderManager = null;
//材质的管理器
public static MaterialManager MaterialManager = null;
//动画管理者
public static AnimationClipManager AnimManager = null;
//音乐管理者
public static AudioClipManager AudioManager = null;
//自动清理者管理器
public static AutoCleanerManager CleanerManager = null;
//纹理管理者
public static TextureManager TextureManager = null;
//视频管理者
public static VideoManager VideoManager = null;
//Prefab管理器
public static PrefabAssetManager PrefabManager = null;
//新游戏状态管理类
public static GameStateSystem GameStateSystem = null;
//游戏场景系统
public static GameSceneSystem GameSceneSystem = null;
//常规SDK 管理系统
public static SDKSystem SDKSystem = null;
// 跨地图寻路数据管理器
public static PathFinderSystem PathFinderSystem = null;
//技能可视数据配置管理器
public static SkillVisualManager SkillVisualManager = null;
//摄像机管理器
public static CameraControlUtil CameraControlUtil = null;
//警示圈管理器
public static WarningFiledManager WarningFiledManager = null;
//寻路系统
public static PathSearchSystem PathSearchSystem = null;
//技能选择地面表现系统
public static SkillSelectFiledManager SkillSelectFiledManager = null;
//地图逻辑开关
public static MapLogicSwitch MapLogicSwitch = null;
//Lua管理系统
private static LuaSystem _luaSystem = null;
public static LuaSystem LuaSystem
{
get
{
#if UNITY_EDITOR
if (_luaSystem == null&&!Application.isPlaying)
{
_luaSystem = new LuaSystem();
_luaSystem.LuaEnv.AddLoader(_luaSystem.LuaLoader);
_luaSystem.LuaEnv.DoString("DataConfig = require('Config.DataConfig')");
}
#endif
return _luaSystem;
}
set
{
_luaSystem = value;
}
}
// Timeline系统
public static TimelineSystem TimelineSystem = null;
#endregion
#region //游戏逻辑管理器
//窗体状态系统
public static FormStateSystem FormStateSystem = null;
//登录系统
//public static LoginSystem LoginSystem = null;
//服务器列表选择系统
//public static ServerListSystem ServerListSystem = null;
//创建角色系统
//public static PlayerRoleListSystem PlayerRoleListSystem = null;
//玩家主聊天框
public static ChatSystem ChatSystem = null;
//聊天插入面板
public static ChatInsertSystem ChatInsertSystem = null;
//玩家私聊聊天框
public static ChatPrivateSystem ChatPrivateSystem = null;
//心跳消息
public static HeartSystem HeartSystem = null;
//输入系统
public static InputSystem InputSystem = null;
//世界地图数据管理器
public static WorldMapInfoManager WorldMapInfoManager = null;
//主功能入口
public static MainFunctionSystem MainFunctionSystem = null;
//客户端GM系统
public static ClientGMSystem ClientGMSystem = null;
//动态阻挡管理器
public static DynamicBlockerManager DynamicBlockerManager = new DynamicBlockerManager();
//触发器管理器
public static TriggerManager TriggerManager = new TriggerManager();
//资源预加载
public static PreloadAssetsSystem PreloadAssetsSystem = null;
//固定资源的系统
public static ImmortalResSystem ImmortalResSystem;
//游戏设置系统
public static GameSetting GameSetting = null;
//消息提示系统
public static MsgPromptSystem MsgPromptSystem = null;
//物品管理系统
public static ItemContianerSystem ItemContianerSystem = null;
//装备管理系统
public static EquipmentSystem EquipmentSystem = null;
//buff管理系统
public static BuffSystem BuffSystem = null;
//阻断性提示系统
public static IBlockingUpPromptSystem BlockingUpPromptSystem = null;
//任务系统
public static ITaskManager TaskManager = null;
public static ITaskController TaskController = null;
//更新系统
public static UpdateSystem UpdateSystem = null;
//引导系统
public static IGuideSystem GuideSystem = null;
//红点系统
public static RedPointSystem RedPointSystem = null;
//断线重连系统
public static ReconnectSystem ReconnectSystem = null;
//掉落归属系统
public static DropAscriptionSystem DropAscriptionSystem = null;
//采集UI提示
public static GatherTishiSystem GatherTishiSystem = null;
//语言转换的类
public static LanguageConvertSystem LanguageConvertSystem = null;
//实时语音系统
public static RealTimeVoiceSystem RealTimeVoiceSystem = null;
//场景数据资源还原系统类
public static SceneRestoreSystem SceneRestoreSystem = null;
//计时器
public static TimerEventSystem TimerEventSystem = null;
//窗体预加载处理
public static PreLoadFormRoot PreLoadFormRoot = null;
//场景遮挡剔除系统类
public static SceneOcSystem SceneOcSystem = null;
//聊天屏蔽字监控系统
public static ChatMonitorSystem ChatMonitorSystem = null;
//场景缓存系统
public static CacheSceneSystem CacheSceneSystem = null;
//打点系统
public static BISystem BISystem = null;
//场景后台下载
public static SceneBackLoadSystem SceneBackLoadSystem = null;
//google翻译
public static GoogleTranslateSystem GoogleTranslateSystem = null;
#endregion
#region //初始化以及卸载处理
//静态构造函数
public static void CreateSystem()
{
//开启异步消息的处理
EventManager.SharedInstance.EnableAsynMsg = true;
EventManager.SharedInstance.PushFixEvent(PreLoadEventDefine.EID_STEP_START, 2);
FLogger.LogTime("GameCenter Start Create!");
//调试这个事件
//EventManager.DebugEventID = (int)UIEventDefine.UIMESSAGEBOX_CLOSE;
AppData.AppIsRunning = true;
//ResourcesEx.DebugUIModel = true;
//Debug.unityLogger.logEnabled = false;
Application.backgroundLoadingPriority = ThreadPriority.Low;
//资源配置初始化
AssetsCacheManager.Initialize();
//设置应用的目标频率
Application.targetFrameRate = GameDefine.DefaultTargetFrameRate;
//禁止休眠黑屏
Screen.sleepTimeout = SleepTimeout.NeverSleep;
//日志初始化
FLogManager.Instance.Initialize();
//增加两个线程,用于异步处理
FThreadPool.AddThread();
FThreadPool.AddThread();
//协程缓存池初始化
CoroutinePool.Initialize();
//内核和逻辑系统的创建
NewCoreSystem();
NewLogicSystem(true);
FLogger.LogTime("GameCenter Create Finished!!");
}
//游戏中心进行初始化处理
public static void Initialize()
{
_isInitialized = false;
FLogger.LogTime("GameCenter Start Initialize!");
//启动网络消息预序列化线程
//HandleMsg.StartPreSerializeThread();
CoroutinePool.AddTask(CoreInitialize(() =>
{
LogicInitialize(true);
FLogger.LogTime("GameCenter Initialize Finished!");
_isInitialized = true;
}));
}
//卸载
public static void Uninitialize()
{
LogicUninitialize(true);
CoreUninitialize();
}
//清理处理
public static void ResetLogicSystem(bool clearLoginData)
{
LogicUninitialize(clearLoginData);
NewLogicSystem(clearLoginData);
LogicInitialize(clearLoginData);
}
#endregion
#region//心跳处理
public static void Update(float deltaTime)
{
if (!_isInitialized) return;
UnityEngine.Profiling.Profiler.BeginSample("HeartSystem.Update");
HeartSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
UnityEngine.Profiling.Profiler.BeginSample("ResourcesEx.Update");
ResourcesEx.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
UnityEngine.Profiling.Profiler.BeginSample("FGameObjectVFXRoot.Update");
FGameObjectVFXRoot.Update();
UnityEngine.Profiling.Profiler.EndSample();
//游戏状态更新
//GameCaseSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.BeginSample("GameStateSystem.Update");
GameStateSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//输入系统更新
UnityEngine.Profiling.Profiler.BeginSample("InputSystem.Update");
InputSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//UI预加载系统更新
UnityEngine.Profiling.Profiler.BeginSample("PreLoadFormRoot.Update");
PreLoadFormRoot.Update();
UnityEngine.Profiling.Profiler.EndSample();
//省电模式
//PowerSaveModelSysytem.Update(deltaTime);
//UnityEngine.Profiling.Profiler.BeginSample("LoginSystem.Update");
//LoginSystem.Update(deltaTime);
//UnityEngine.Profiling.Profiler.EndSample();
//声音系统更新
UnityEngine.Profiling.Profiler.BeginSample("AudioPlayer.Update");
AudioPlayer.Update();
UnityEngine.Profiling.Profiler.EndSample();
//物品系统更新
UnityEngine.Profiling.Profiler.BeginSample("ItemContianerSystem.Update");
ItemContianerSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//装备系统更新
UnityEngine.Profiling.Profiler.BeginSample("EquipmentSystem.Update");
EquipmentSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//警示圈更新
UnityEngine.Profiling.Profiler.BeginSample("WarningFiledManager.Update");
WarningFiledManager.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//buff系统更新
UnityEngine.Profiling.Profiler.BeginSample("BuffSystem.Update");
BuffSystem.Update();
UnityEngine.Profiling.Profiler.EndSample();
if (UpdateSystem != null)
{
UnityEngine.Profiling.Profiler.BeginSample("UpdateSystem.Update");
UpdateSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
}
UnityEngine.Profiling.Profiler.BeginSample("ReconnectSystem.Update");
ReconnectSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
UnityEngine.Profiling.Profiler.BeginSample("Networker.Update");
Networker.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
UnityEngine.Profiling.Profiler.BeginSample("TimelineSystem.Update");
TimelineSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//红点系统更新
UnityEngine.Profiling.Profiler.BeginSample("RedPointSystem.Update");
RedPointSystem.Update();
UnityEngine.Profiling.Profiler.EndSample();
UnityEngine.Profiling.Profiler.BeginSample("DynamicBoneSystem.Update");
DynamicBoneSystem.SharedInstance.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//聊天系统
UnityEngine.Profiling.Profiler.BeginSample("ChatSystem.Update");
ChatSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
//Bi系统
UnityEngine.Profiling.Profiler.BeginSample("BISystem.Update");
BISystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
if (GameSetting.GetSetting(GameSettingKeyCode.TPLuaUpdate) != 1)
{
UnityEngine.Profiling.Profiler.BeginSample("LuaSystem.Update");
LuaSystem.Update(deltaTime);
UnityEngine.Profiling.Profiler.EndSample();
}
}
public static void LateUpdate(float deltaTime)
{
if (!_isInitialized) return;
//自动清理者更新
CleanerManager.Update(deltaTime);
//监控器更新
FrameMonitor.Update(deltaTime);
//
PostEffectManager.Instance.Update(deltaTime);
//红点系统更新
RedPointSystem.LateUpdate();
DynamicBoneSystem.SharedInstance.LateUpdate(deltaTime);
}
public static void FixedUpdate(float deltaTime)
{
if (!_isInitialized) return;
Networker.FixedUpdate(deltaTime);
}
#endregion
#region//应用程序退出操作
public static void ApplicationQuit()
{
AppData.AppIsRunning = false;
Shader.globalMaximumLOD = 310;
FThreadPool.ShutDown();
_isInitialized = false;
Debug.LogError("Application Quit!");
}
#endregion
#region//私有函数处理
#region//Core系统的方法
//工具逻辑系统
private static void NewCoreSystem()
{
CleanerManager = AutoCleanerManager.SharedInstance;
EventManager = EventManager.SharedInstance;
Networker = Networker.Instance;
ShaderManager = ShaderManager.SharedInstance;
SpawnPoolManager = SpawnPoolManager.ShareInstance;
AnimManager = AnimationClipManager.SharedInstance;
TextureManager = TextureManager.SharedInstance;
VideoManager = VideoManager.SharedInstance;
AudioManager = AudioClipManager.SharedInstance;
PrefabManager = PrefabAssetManager.SharedInstance;
MaterialManager = MaterialManager.SharedInstance;
GameStateSystem = new GameStateSystem();
GameSceneSystem = new GameSceneSystem();
SkillVisualManager = new SkillVisualManager();
CameraControlUtil = new CameraControlUtil();
PathFinderSystem = new PathFinderSystem();
ItemContianerSystem = new ItemContianerSystem();
EquipmentSystem = new EquipmentSystem();
WarningFiledManager = new WarningFiledManager();
SkillSelectFiledManager = new SkillSelectFiledManager();
GameSetting = new GameSetting();
MapLogicSwitch = new MapLogicSwitch();
TimelineSystem = new TimelineSystem();
SDKSystem = new SDKSystem();
FormStateSystem = new FormStateSystem();
LuaSystem = new LuaSystem();
#if UNITY_EDITOR
EventManager.CheckEventDefineIsValid(typeof(LogicEventDefine));
#endif
Debug.Log("NewCoreSystem Finished!!");
}
//游戏中心进行初始化处理
private static IEnumerator CoreInitialize(MyAction onCoreInitFinished)
{
yield return LuaSystem.CoreInitialize();
//启动GameCfgData的加载线程
GameCfgDataSystem.Initialize();
//FLogger.LogTime(" LuaSystem.Adaptor.CoreInitialize() ok!");
SpawnPoolManager.Initialize();
//FLogger.LogTime("SpawnPoolManager.Initialize() ok!");
yield return null;
ShaderManager.Initialize();
//FLogger.LogTime("ShaderManager.Initialize() ok!");
yield return null;
MaterialManager.Initialize();
//FLogger.LogTime("MaterialManager.Initialize() ok!");
yield return null;
TextureManager.Initialize();
//FLogger.LogTime("TextureManager.Initialize() ok!");
yield return null;
VideoManager.Initialize();
//FLogger.LogTime("VideoManager.Initialize() ok!");
yield return null;
FGameObjectVFXRoot.Initialize();
//FLogger.LogTime("FGameObjectVFXRoot.Initialize() ok!");
yield return null;
RegisterMsgCallback.Register();
//FLogger.LogTime("RegisterMsgCallback.Register() ok!");
yield return null;
Networker.Initialize();
//FLogger.LogTime("Networker.Initialize() ok!");
yield return null;
//HandleMsg.Initailize();
//FLogger.LogTime("HandleMsg.Initialize() ok!");
//yield return null;
//GameCaseSystem.Initialize();
//FLogger.LogTime("GameCaseSystem.Initialize() ok!");
GameStateSystem.Initialize();
//FLogger.LogTime("GameStateManager.Initialize() ok!");
yield return null;
GameSceneSystem.Initialize();
//FLogger.LogTime("GameSceneSystem.Initialize() ok!");
yield return null;
FrameMonitor.Initialize();
//FLogger.LogTime("MonitorManager.Install(MonitorType.Frame) ok!");
yield return null;
SDKSystem.Initalize();
//FLogger.LogTime("SDKSystem.Initalize() ok!");
yield return null;
ItemContianerSystem.Initialize();
//FLogger.LogTime("ItemContianerSystem.Initalize() ok!");
yield return null;
SkillVisualManager.Load();
//FLogger.LogTime("SkillVisualManager.Initalize() ok!");
yield return null;
WarningFiledManager.Initialize();
//FLogger.LogTime("WarningFiledManager.Initialize() ok!");
yield return null;
SkillSelectFiledManager.Initialize();
//FLogger.LogTime("SkillSelectFiledManager.Initialize() ok!");
yield return null;
PathFinderSystem.Initialize();
//FLogger.LogTime("PathFinderSystem.Initialize() ok!");
yield return null;
GameSetting.Initialize();
//FLogger.LogTime("GameSetting.Initialize() ok!");
yield return null;
DynamicBoneSystem.SharedInstance.Initialize();
TimelineSystem.Initialize();
yield return null;
//FLogger.LogTime( "TimelineSystem.Initialize() ok!" );
onCoreInitFinished();
yield return null;
}
//卸载
private static void CoreUninitialize()
{
LuaSystem.CoreUnInitialize();
FGameObjectVFXRoot.UnInitialize();
//工具逻辑系统
AnimManager.Sweep();
MaterialManager.UnInitialize();
TextureManager.Sweep();
VideoManager.Sweep();
//清除者
CleanerManager.Clear();
GameSceneSystem.Uninitialize();
FrameMonitor.Uninitialize();
SDKSystem.Unitialize();
PathFinderSystem.Uninitialize();
WarningFiledManager.Uninitialize();
SkillSelectFiledManager.Uninitialize();
SpawnPoolManager.Uninitialize();
GameSetting.Uninitialize();
TimelineSystem.Uninitialize();
ItemContianerSystem.Uninitialize();
DynamicBoneSystem.SharedInstance.Uninitialize();
FPlayerAnimRelation.ClearAnims();
}
#endregion
#region //游戏逻辑的处理
//游戏逻辑系统
private static void NewLogicSystem(bool clearLoginData)
{
//判断是否清理登陆数据
if (clearLoginData)
{
//LoginSystem = new LoginSystem();
//ServerListSystem = new ServerListSystem();
//PlayerRoleListSystem = new PlayerRoleListSystem();
HeartSystem = new HeartSystem();
}
//将sdk从CoreSystem移到LogicSystem中避免一些数据在返回登录后没有清理掉
TimerEventSystem = new TimerEventSystem();
ChatSystem = new ChatSystem();
ChatInsertSystem = new ChatInsertSystem();
ChatPrivateSystem = new ChatPrivateSystem();
InputSystem = new InputSystem();
WorldMapInfoManager = new WorldMapInfoManager();
MsgPromptSystem = new MsgPromptSystem();
MainFunctionSystem = new MainFunctionSystem();
ClientGMSystem = new ClientGMSystem();
PreloadAssetsSystem = new PreloadAssetsSystem();
ImmortalResSystem = new ImmortalResSystem();
BuffSystem = new BuffSystem();
UpdateSystem = new UpdateSystem();
RedPointSystem = new RedPointSystem();
ReconnectSystem = new ReconnectSystem();
PathSearchSystem = new PathSearchSystem();
DropAscriptionSystem = new DropAscriptionSystem();
GatherTishiSystem = new GatherTishiSystem();
LanguageConvertSystem = new LanguageConvertSystem();
RealTimeVoiceSystem = new RealTimeVoiceSystem();
SceneRestoreSystem = new SceneRestoreSystem();
PreLoadFormRoot = new PreLoadFormRoot();
SceneOcSystem = new SceneOcSystem();
ChatMonitorSystem = new ChatMonitorSystem();
CacheSceneSystem = new CacheSceneSystem();
BISystem = new BISystem();
SceneBackLoadSystem = new SceneBackLoadSystem();
GoogleTranslateSystem = new GoogleTranslateSystem();
PushFixEvent(LogicEventDefine.EID_GAMECENTER_LOGIC_NEW);
Debug.Log("NeLogicSystem Finished!!");
}
//游戏中心进行初始化处理
private static void LogicInitialize(bool clearLoginData)
{
PushFixEvent(LogicEventDefine.EID_GAMECENTER_LOGIC_START_INITIALIZE, InputSystem);
if (clearLoginData)
{
Networker.AddThreadHandleFunc(HeartSystem.OnNetworkThreadTick);
}
TimerEventSystem.Initialize();
RedPointSystem.Initialize();
MainFunctionSystem.Initialize();
InputSystem.Initialize();
WorldMapInfoManager.Initialize();
PreloadAssetsSystem.Initialize();
BISystem.Initialize();
//游戏逻辑
LuaSystem.LogicInitialize(clearLoginData);
GameObjectLimit.Initialize();
//LoginSystem.Initialize();
//ServerListSystem.Initialize();
BuffSystem.Initialize();
MsgPromptSystem.Initialize();
ReconnectSystem.Initialize();
EquipmentSystem.Initialize();
RealTimeVoiceSystem.Initialize();
SceneRestoreSystem.Initialize();
GameSetting.ApplySetting();
UpdateSystem.Initialize();
FormStateSystem.Initialize();
ChatMonitorSystem.Initialize();
CacheSceneSystem.Initialize();
SceneBackLoadSystem.Initialize();
ChatSystem.Initialize();
ChatPrivateSystem.Initialize();
}
//卸载
private static void LogicUninitialize(bool clearLoginData)
{
//游戏逻辑系统卸载
LuaSystem.LogicUnInitialize(clearLoginData);
if (clearLoginData)
{
HeartSystem.Uninitialize();
Networker.Uninitialize();
}
//LoginSystem.Uninitialize();
InputSystem.Uninitialize();
MainFunctionSystem.Uninitialize();
ChatSystem.Destroy();
ChatInsertSystem.Destroy();
GameObjectLimit.UnInitialize();
PreloadAssetsSystem.Unitialize();
BuffSystem.Uninitialize();
UpdateSystem.Uninitialize();
RedPointSystem.UnInitialize();
GameSetting.SaveSetting();
EquipmentSystem.UnInitialize();
RealTimeVoiceSystem.Uninitialize();
TimerEventSystem.Uninitialize();
FormStateSystem.UnInitialize();
ChatMonitorSystem.UnInitialize();
CacheSceneSystem.UnInitialize();
SceneBackLoadSystem.Uninitialize();
BISystem.Uninitialize();
MsgPromptSystem.Uninitialize();
PushFixEvent(LogicEventDefine.EID_GAMECENTER_LOGIC_UNINITIALIZED);
}
#endregion
#endregion
#region //静态函数--事件处理
public static void PushFixEvent(LogicEventDefine eventID, object obj = null, object sender = null)
{
EventManager.PushFixEvent((int)eventID, obj, sender);
}
public static void PushFixEvent(UIEventDefine eventID, object obj = null, object sender = null)
{
EventManager.PushFixEvent((int)eventID, obj, sender);
}
public static void PushFixEvent(int eventID, object obj = null, object sender = null)
{
EventManager.PushFixEvent(eventID, obj, sender);
}
public static EventSystemHandler RegFixEventHandle(LogicEventDefine eventType, EventSystemHandler eventHandler)
{
return EventManager.RegFixEventHandle((int)eventType, eventHandler);
}
public static EventSystemHandler RegFixEventHandle(UIEventDefine eventType, EventSystemHandler eventHandler)
{
return EventManager.RegFixEventHandle((int)eventType, eventHandler);
}
public static EventSystemHandler RegFixEventHandle(int eventType, EventSystemHandler eventHandler)
{
return EventManager.RegFixEventHandle(eventType, eventHandler);
}
public static void UnRegFixEventHandle(LogicEventDefine eventType, EventSystemHandler eventHandler)
{
EventManager.UnRegFixEventHandle((int)eventType, eventHandler);
}
public static void UnRegFixEventHandle(UIEventDefine eventType, EventSystemHandler eventHandler)
{
EventManager.UnRegFixEventHandle((int)eventType, eventHandler);
}
public static void UnRegFixEventHandle(int eventType, EventSystemHandler eventHandler)
{
EventManager.UnRegFixEventHandle(eventType, eventHandler);
}
#endregion
}
}

8
Assets/Code/Center/GameCenter.cs.meta generated Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f46cfa35b3ee2d049833aa1416719435
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,219 @@
using System;
using Thousandto.Code.Logic;
using Thousandto.Core.Asset;
using Thousandto.Core.Base;
using UnityEngine;
using UnityEngine.Gonbest.MagicCube;
namespace Thousandto.Code.Center
{
/// <summary>
/// 游戏中心脚本
/// </summary>
public class GameCenterScript : MonoBehaviour
{
private static bool _isCreated = false;
private static float _pauseTime = 0;
#if UNITY_EDITOR
public bool ReloadAllLua = false;
#endif
private void Awake()
{
Debug.Log("GameCenterScript Awake");
Application.quitting -= DoApplicationQuit;
Application.quitting += DoApplicationQuit;
}
private void Start()
{
Debug.Log("GameCenterScript Start");
ScreenSystem.SetDesignContentScale();
}
//laucher端调用,设置游戏的启动参数
public void GameStart(string lang, bool isStream, int buildType)
{
Debug.Log("GameStart lang:" + (lang == null ? "null" : lang));
if (!string.IsNullOrEmpty(lang))
{
LanguageSystem.SetPackageLang(lang);
}
if (PathUtils.IsStreaming())
{
AnimationClipManager.UseAsynLoadAnimClip = true;
AnimationClipManager.SyncLoadAnimHandler = null;
}
#if UNITY_EDITOR && !FUNCELL_LAUNCHER
else
{
AnimationClipManager.SyncLoadAnimHandler = x => {
var ani = UnityEditor.AssetDatabase.LoadAssetAtPath<AnimationClip>(x);
//Debug.LogError("AnimationClipManager.SyncLoadAnimHandler::" + x + "::" + (ani == null ? "NULL" : ani.ToString()));
return ani;
};
}
#endif
if (!_isCreated)
{
name = "[MainEntry]";
DontDestroyOnLoad(gameObject);
_isCreated = true;
GameCenter.CreateSystem();
GameCenter.Initialize();
}
else
{
Destroy(gameObject);
}
/*
if (gameObject.GetComponent<GameExtentScript>() == null)
{
gameObject.AddComponent<GameExtentScript>();
} */
}
//Launcher端调用直接进入登录状态
public void ChangeToLogin()
{
if (_isCreated)
{
if (GameCenter.GameStateSystem != null)
GameCenter.GameStateSystem.ChangeState((int)GameStateId.Login);
}
}
private int test = 0;
void Update()
{
//Thousandto.Plugins.Common.Networker.TestMessage = TestMessage;
if (_isCreated)
{
try
{
GameCenter.Update(Time.deltaTime);
//if (Input.GetKeyDown(KeyCode.Alpha0))
//{
// GameCenter.PushFixEvent(Global.LogicEventDefine.EID_EVENT_HIDE_CURRENT_FORM);
//}
}
catch (Exception ex)
{
Debug.LogException(ex);
}
}
}
void FixedUpdate()
{
if (_isCreated && !GameCenter.ClientGMSystem.PauseGameCenterUpdate)
{
GameCenter.FixedUpdate(Time.deltaTime);
}
}
void LateUpdate()
{
if (_isCreated && !GameCenter.ClientGMSystem.PauseGameCenterLateUpdate)
{
GameCenter.LateUpdate(Time.deltaTime);
}
}
void OnApplicationPause(bool paused)
{
if (_isCreated)
{
if (!paused)
{
ScreenSystem.SetDesignContentScale();
if (GameCenter.GameStateSystem != null)
{
var curState = GameCenter.GameStateSystem.GetCurState();
if (curState != null)
{
if (curState is LoginState)
{
//Debug.Log("恢复播放背景音1");
//后台没播放音乐,才播放游戏背景音乐
//if (FuncellSDK.Instance.IsMusicPlaying() == false)
AudioPlayer.PlayMusic(LoginState.GetLoginMusicName());
}
else
{
//Debug.Log("恢复播放背景音2");
//后台没播放音乐,才播放游戏背景音乐
//if (FuncellSDK.Instance.IsMusicPlaying() == false)
GameCenter.GameSceneSystem.PlayBGMusic();
var deltaTimeWhilePauseResume = Time.realtimeSinceStartup - _pauseTime;
if (deltaTimeWhilePauseResume >= 2 * 60)
{
GameCenter.Networker.Disconnect();
GameCenter.ReconnectSystem.Reconnect();
}
}
}
}
}
else
{
//Debug.Log("暂停停止背景音!");
GameCenter.GameSceneSystem.StopBGMusic(true);
_pauseTime = Time.realtimeSinceStartup;
}
}
}
private void OnApplicationFocus(bool focus)
{
if (_isCreated)
{
GameCenter.IsFocused = focus;
GameCenter.PushFixEvent(Global.LogicEventDefine.EID_EVENT_APPFOCUS);
}
}
void DoApplicationQuit()
{
if (_isCreated)
{
GameCenter.Uninitialize();
GameCenter.ApplicationQuit();
}
}
void OnDestroy()
{
}
#if UNITY_EDITOR
//在编辑器状态下,当被选择后的一些图形
void OnDrawGizmos()
{
if (Application.isPlaying)
{
Core.Asset.DynamicBoneSystem.SharedInstance.OnGizmos();
}
}
#endif
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 78bcd34c3d964ab44ac4dd4554b92570
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,140 @@
using UnityEngine;
using System.Collections;
using Thousandto.Code.Center;
using Thousandto.Code.Logic;
/// <summary>
/// 这里用于GameCenter的扩展,
/// 大部分是用来测试
/// </summary>
public class GameExtentScript : MonoBehaviour
{
private bool _showTestButtons = false;
private Vector2 _scrollPos = Vector2.zero;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnGUI()
{
if (GUI.Button(new Rect(0, 0, 100, 100), _showTestButtons? "隐藏" : "显示"))
{
_showTestButtons = !_showTestButtons;
}
if (_showTestButtons)
{
GUILayout.BeginArea(new Rect(0,120,300,500));
_scrollPos = GUILayout.BeginScrollView(_scrollPos);
GUILayout.BeginVertical();
if (GUILayout.Button("替换为简单Shader", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSimpleShader,1);
if (GUILayout.Button("替换半透shader", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPBlendShader, 1);
if (GUILayout.Button("替换简单纹理", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSimpleTexture, 1);
if (GUILayout.Button("替换简单网格", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSimpleMesh, 1);
if (GUILayout.Button("隐藏hud", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPHUD, 1);
if (GUILayout.Button("隐藏主界面", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPMain, 1);
if (GUILayout.Button("隐藏所有UI", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPAllUI, 1);
if (GUILayout.Button("屏蔽场景特效", GUILayout.MinHeight(40)))
{
GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPVFXScene, 1);
GameCenter.GameSceneSystem.ActivedScene.SetSceneEffectLevel();
}
if (GUILayout.Button("屏蔽后处理", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.EnablePostEffect, 0);
if( GUILayout.Button( "屏蔽角色", GUILayout.MinHeight( 40 ) ) ) SetPlayerModelActive();
if( GUILayout.Button( "屏蔽NPC", GUILayout.MinHeight( 40 ) ) ) SetNpcModelActive();
if( GUILayout.Button( "屏蔽怪物", GUILayout.MinHeight( 40 ) ) ) SetMonsterModelActive();
if (GUILayout.Button("屏蔽场景", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPScene, 1);
if (GUILayout.Button("屏蔽动作", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPAnimator, 1);
if (GUILayout.Button("屏蔽所有战斗效果", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSkillAll, 1);
if (GUILayout.Button("屏蔽技能特效", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPVFXSkill, 1);
if (GUILayout.Button("屏蔽技能音效", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSFXSkill, 1);
if (GUILayout.Button("屏蔽技能动作", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSkillAnim, 1);
if (GUILayout.Button("屏蔽技能模糊", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSkillBloom, 1);
if (GUILayout.Button("屏蔽技能震动", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSkillShake, 1);
if (GUILayout.Button("屏蔽受击闪烁", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSkillBlink, 1);
if (GUILayout.Button("屏蔽伤害数字", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPSkillDamageNumber, 1);
if (GUILayout.Button("屏蔽掉落效果", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPDropEffect, 1);
if (GUILayout.Button("屏蔽Lua更新", GUILayout.MinHeight(40))) GameCenter.GameSetting.SetSetting(GameSettingKeyCode.TPLuaUpdate, 1);
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.EndArea();
}
}
#region
public static bool _showPlayerModel = true;
public static bool _showNpcModel = true;
public static bool _showMonsterModel = true;
private static void SetPlayerModelActive()
{
_showPlayerModel = !_showPlayerModel;
var _lP = GameCenter.GameSceneSystem.GetLocalPlayer();
if( _lP != null )
{
SetModelActive( _lP.Skin.RootTransform, _showPlayerModel );
}
var _pets = GameCenter.GameSceneSystem.FindEntityAll<Pet>();
if( _pets != null && _pets.Count > 0 )
{
for( int i = 0; i < _pets.Count; i++ )
{
SetModelActive( _pets[ i ].ModelTransform, _showPlayerModel );
}
}
var _otherPlayers = GameCenter.GameSceneSystem.FindRemotePlayers();
if( _otherPlayers != null && _otherPlayers.Count > 0 )
{
for( int i = 0; i < _otherPlayers.Count; i++ )
{
SetModelActive( _otherPlayers[ i ].Skin.RootTransform, _showPlayerModel );
}
}
}
private static void SetNpcModelActive()
{
_showNpcModel = !_showNpcModel;
var _npcs = GameCenter.GameSceneSystem.FindNpcs();
if( _npcs != null && _npcs.Count > 0 )
{
for( int i = 0; i < _npcs.Count; i++ )
{
SetModelActive( _npcs[ i ].Skin.RootTransform, _showNpcModel );
}
}
}
private static void SetMonsterModelActive()
{
_showMonsterModel = !_showMonsterModel;
var _monsters = GameCenter.GameSceneSystem.FindMonsters();
if( _monsters != null && _monsters.Count > 0 )
{
for( int i = 0; i < _monsters.Count; i++ )
{
SetModelActive( _monsters[ i ].Skin.RootTransform, _showMonsterModel );
}
}
}
public static void SetModelActive( Transform trans, bool active )
{
if( trans == null ) return;
for( int i = 0; i < trans.childCount; i++ )
{
trans.GetChild( i ).gameObject.SetActive( active );
}
}
#endregion
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 17ed77ae38fe6354bab2a20d6dd21b90
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

5
Assets/Code/Global.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 5a8a787ece797224d97c5e9e4efd1cab
folderAsset: yes
DefaultImporter:
userData:

5
Assets/Code/Global/Define.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 99efc652c0c359b46a7eae34c65f14b5
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Code.Global
{
public class AppVersionForLocalVersion
{
public const string APP_VERSION = "1.0.0";
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7a6e197d124493e409886b1a8a6d3f11
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
enum CollectionType
{
None = 0, //都可以采集
Task = 1, //只有拥有任务才可以采集
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9dc365ebf0b262e4d8c5e5263202deb4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,37 @@
using Thousandto.Cfg.Data;
using Thousandto.Code.Center;
using Thousandto.Code.Logic;
using Thousandto.Plugins.Common;
using System;
using System.Collections.Generic;
using System.Text;
using Thousandto.Core.Base;
using MSG_copyMap;
namespace Thousandto.Code.Global
{
//传送地图类型
public enum CrossMapType
{
//野图传送
Normal = 0,
//普通副本传送
Copy = 1,
//活动副本传送
DailyCopy = 2,
//退出副本
ExitCopy = 3,
//退出活动副本
ExitDailyCopy = 4,
//退出跨服副本
ExitCrossCopy = 5,
}
//传送的原因
public enum CrossMapReason
{
Chat = 0, //点击聊天中的链接传送
Teach = 1, //传道
}
}

View File

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

View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Code.Global
{
public static class EquipmentType
{
public const int Defalt = -1; // 1-99
public const int Helmet = 0; //头盔
public const int Weapon = 1; //武器
public const int Clothes = 2; //胸甲
public const int Necklace = 3; //项链
public const int Belt = 4; //腰带
public const int LegGuard = 5; //裤子
public const int Shoe = 6; //鞋子
public const int FingerRing = 7; //左手戒指
public const int Bracelet = 8; //手镯
public const int EarRings = 9; //耳环
public const int Badge = 10; //徽章
public const int Count = 11;
}
public static class XianJiaType
{
public const int XianJiaWeapon = 30; //仙甲武器,
public const int XianJiaClothes = 31; //仙甲战甲,
public const int XianJiaRing = 32; //仙甲光环,
public const int XianJiaZhenD = 33; //仙甲阵道,
public const int XianJiaLeftP = 34; //仙甲左佩,
public const int XianJiaRightP = 35; //仙甲右佩,
public const int XianJiaHelmet = 36; //仙甲头冠;
public const int XianJiaShoulder = 37; //仙甲肩饰;
public const int XianJiaHuWan = 38; //仙甲护腕;
public const int XianJiaShouT = 39; //仙甲手套;
public const int XianJiaNeiCen = 40; //仙甲内衬;
public const int XianJiaBelt = 41; //仙甲腰带;
public const int XianJiaLeg = 42; //仙甲裤子;
public const int XianJiaShoe = 43; //仙甲鞋履
public const int HunJiaWeapon = 44; //魂甲武器;
public const int HunJiaClothes = 45; //魂甲战甲;
public const int HunJiaRing = 46; //魂甲光环;
public const int HunJiaZhenD = 47; //魂甲阵道,
public const int HunJiaLeftP = 48; //魂甲左佩,
public const int HunJiaRightP = 49; //魂甲右佩,
public const int HunJiaHelmet = 50; //魂甲头冠,
public const int HunJiaShoulder = 51; //魂甲肩饰,
public const int HunJiaHuWan = 52; //魂甲护腕,
public const int HunJiaShouT = 53; //魂甲手套,
public const int HunJiaNeiCen = 54; //魂甲内衬,
public const int HunJiaBelt = 55; //魂甲腰带,
public const int HunJiaLeg = 56; //魂甲裤子,
public const int HunJiaShoe = 57; //魂甲鞋履
public const int BaguaStart = 401; //八卦起始部位
public const int YangBaGua = 401; //阳八卦
public const int YinBaGua = 402; //阴八卦
public const int BaGua1 = 403; //八卦部位1
public const int BaGua2 = 404; //八卦部位2
public const int BaGua3 = 405; //八卦部位3
public const int BaGua4 = 406; //八卦部位4
public const int BaGua5 = 407; //八卦部位5
public const int BaGua6 = 408; //八卦部位6
public const int BaGua7 = 409; //八卦部位7
public const int BaGua8 = 410; //八卦部位8
public const int BaguaEnd = 440; //八卦部位结束
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1379346852fcaed479e0283794b775c7
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,13 @@
namespace Thousandto.Code.Global
{
public enum FriendType
{
Undefine = 0,
Friend = 1, // 好友
Enemy = 2, // 仇人
Shield = 3, // 屏蔽
Recommend = 4, // 推荐
Recent = 5, // 最近
Search = 6, // 查找
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f01076eb4906d8e4e8719a23d85f9722
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,232 @@
using UnityEngine;
using System.Collections;
namespace Thousandto.Code.Global
{
/// <summary>
/// 在此类中进行 常量定义,静态定义
/// </summary>
public static class GameDefine
{
//怪物闪烁的曲线
public static AnimationCurve MonsterBlinkCurve = new AnimationCurve(
new Keyframe(0.0f, 1.02f),
new Keyframe(0.18f, 2.48f),
new Keyframe(0.54f, 1.74f),
new Keyframe(1.0f, 1.02f)
);
//怪物闪烁的时间
public static float MonsterBlinkTime = 0.4f;
//怪物闪烁的强度
public static float MonsterBlinkPower = 1;
//怪物震动的曲线
public static AnimationCurve MonserShakeCurve = new AnimationCurve(
new Keyframe(0.0f, 0.0f),
new Keyframe(0.06f, 0.28f),
new Keyframe(0.12f, -0.14f),
new Keyframe(0.21f, 0.17f),
new Keyframe(0.26f, -0.09f),
new Keyframe(0.34f, 0.11f),
new Keyframe(0.38f, -0.07f),
new Keyframe(0.45f, 0.07f),
new Keyframe(0.52f, -0.03f),
new Keyframe(0.65f, 0.0f),
new Keyframe(1.0f, 0.01f)
);
//怪物震动的时间
public static float MonsterShakeTime = 0.3f;
//怪物震动的力度
public static float MonsterShakePower = 0.15f;
//怪物渐显的时间
public static float MonsterFadeInTime = 2.0f;
//死亡效果曲线
public static AnimationCurve DyingEffectCurve = new AnimationCurve(
new Keyframe(0.0f, 0.0f),
new Keyframe(0.5f, 1.0f),
new Keyframe(1.0f, 0.0f)
);
//死亡效果时间
public static float DyingEffectTime = 1f;
//死亡效果的力度
public static float DyingEffectPower = 1f;
//摄像机震动的曲线0
public static AnimationCurve CameraShakeCurve0 = new AnimationCurve(
new Keyframe(0, 0),
new Keyframe(0.03f, 0.29f),
new Keyframe(0.06f, -0.3f),
new Keyframe(0.09f, 0.24f),
new Keyframe(0.12f, -0.20f),
new Keyframe(0.18f, 0.19f),
new Keyframe(0.21f, -0.15f),
new Keyframe(0.26f, 0.16f),
new Keyframe(0.30f, -0.12f),
new Keyframe(0.35f, 0.15f),
new Keyframe(0.38f, -0.12f),
new Keyframe(0.43f, 0.13f),
new Keyframe(0.47f, -0.11f),
new Keyframe(0.51f, 0.10f),
new Keyframe(0.53f, -0.07f),
new Keyframe(0.55f, 0.05f),
new Keyframe(0.58f, -0.03f),
new Keyframe(0.60f, 0.03f),
new Keyframe(0.68f, 0.0f),
new Keyframe(1f, 0.0f)
);
//摄像机震动曲线1
public static AnimationCurve CameraShakeCurve1 = new AnimationCurve(
new Keyframe(.00286145834f, .000791691011f),
new Keyframe(.207709253f, .00215172209f),
new Keyframe(.240525663f, -.049020499f),
new Keyframe(.277893901f, .1972882f),
new Keyframe(.282138824f, -.191196516f),
new Keyframe(.30895263f, .23411788f),
new Keyframe(.360184669f, -.252662688f),
new Keyframe(.369529247f, .270057827f),
new Keyframe(.40912056f, -.277744025f),
new Keyframe(.425533772f, .289491951f),
new Keyframe(.447261035f, -.314859122f),
new Keyframe(.483038783f, .260558218f),
new Keyframe(.493636131f, -.284817636f),
new Keyframe(.524803042f, .246979177f),
new Keyframe(.554259598f, -.235227361f),
new Keyframe(.580078959f, .219205275f),
new Keyframe(.597099066f, -.21104385f),
new Keyframe(.621209741f, .182257965f),
new Keyframe(.646193027f, -.193617091f),
new Keyframe(.667373538f, .146689609f),
new Keyframe(.691121101f, -.176821306f),
new Keyframe(.721702099f, .125082478f),
new Keyframe(.75148654f, -.178960815f),
new Keyframe(.763221145f, .118967667f),
new Keyframe(.796180248f, -.182405457f),
new Keyframe(.810846686f, .115622357f),
new Keyframe(.840867639f, -.182774261f),
new Keyframe(.85116899f, .130688652f),
new Keyframe(.880626678f, -.176360562f),
new Keyframe(.892588377f, .12531811f),
new Keyframe(.92248404f, -.177173302f),
new Keyframe(.932090163f, .125738457f),
new Keyframe(.955161095f, -.17414172f),
new Keyframe(.97323966f, .122781448f),
new Keyframe(.995889902f, -.169117436f),
new Keyframe(1.00520289f, .112593882f),
new Keyframe(1.03272414f, -.176946893f),
new Keyframe(1.04092634f, .109299488f),
new Keyframe(1.07381773f, -.163487181f),
new Keyframe(1.08258832f, .106958114f),
new Keyframe(1.1092087f, -.160076573f),
new Keyframe(1.12798703f, .103956334f),
new Keyframe(1.15277171f, -.15518786f),
new Keyframe(1.16347849f, .0943798497f),
new Keyframe(1.19182861f, -.151911438f),
new Keyframe(1.19830346f, .0943199769f),
new Keyframe(1.23005509f, -.149068549f),
new Keyframe(1.24720144f, .0927762166f),
new Keyframe(1.27119064f, -.148429215f),
new Keyframe(1.28255832f, .0814283714f),
new Keyframe(1.31337428f, -.142516002f),
new Keyframe(1.31792784f, .0721656233f),
new Keyframe(1.35290813f, -.114523083f),
new Keyframe(1.35355508f, .0664048418f),
new Keyframe(1.39669776f, .00103982445f),
new Keyframe(1.59634101f, -.00280949287f)
);
//摄像机震动曲线2
public static AnimationCurve CameraShakeCurve2 = new AnimationCurve(
new Keyframe(.00574633479f, 7.4505806e-09f),
new Keyframe(.00768568879f, .00524855405f),
new Keyframe(.0292396545f, .249097288f),
new Keyframe(.0459455103f, -.198177606f),
new Keyframe(.0790079236f, .2258614f),
new Keyframe(.096507594f, -.178818613f),
new Keyframe(.120939389f, .200653821f),
new Keyframe(.154260322f, -.163428158f),
new Keyframe(.157331109f, .186687112f),
new Keyframe(.197724655f, -.160745442f),
new Keyframe(.21560812f, .174449623f),
new Keyframe(.262779623f, -.134522051f),
new Keyframe(.276715934f, .16738674f),
new Keyframe(.311875254f, -.129890561f),
new Keyframe(.3392618f, .159872413f),
new Keyframe(.369763583f, -.116927631f),
new Keyframe(.397201717f, .138109297f),
new Keyframe(.437791556f, -.097942844f),
new Keyframe(.450408489f, .113371111f),
new Keyframe(.486772746f, -.0825080052f),
new Keyframe(.503839672f, .0996411145f),
new Keyframe(.540451646f, -.0816661939f),
new Keyframe(.560877144f, .086804308f),
new Keyframe(.587202787f, -.0787797049f),
new Keyframe(.607789636f, .0816660151f),
new Keyframe(.639985263f, -.0732368082f),
new Keyframe(.664039373f, .0690324157f),
new Keyframe(.693112254f, -.0621521994f),
new Keyframe(.720165372f, .0622194484f),
new Keyframe(.746323705f, -.0539627075f),
new Keyframe(.765027881f, .0528957061f),
new Keyframe(.792262375f, -.037770763f),
new Keyframe(.817142904f, .0259127207f),
new Keyframe(.857361376f, -.0194732305f),
new Keyframe(.878897667f, .0182904936f),
new Keyframe(.929263949f, .00107148197f),
new Keyframe(1.0004729f, -.00403778534f)
);
//摄像机震动曲线3
public static AnimationCurve CameraShakeCurve3 = new AnimationCurve(
new Keyframe(0f, 0f),
new Keyframe(0.1f, 0.5f),
new Keyframe(0.2f, 3f),
new Keyframe(0.3333f, 8f),
new Keyframe(0.5f, 8f),
new Keyframe(0.6666f, 0f),
new Keyframe(0.68f, -2.5f),
new Keyframe(0.695f, 2f),
new Keyframe(0.71f, -1.5f),
new Keyframe(0.725f, 1f),
new Keyframe(0.74f, -0.5f),
new Keyframe(0.755f, 0.0f),
new Keyframe(1f, 0f)
);
//摄像机震动的力度
public static float CameraShakePower = 1.0f;
//摄像机震动的时间
public static float CameraShakeTime = 0.2f;
//获取一个摄像机震动曲线
public static AnimationCurve GetCurve(int id)
{
switch (id)
{
case 0:
return CameraShakeCurve0;
case 1:
return CameraShakeCurve1;
case 2:
return CameraShakeCurve2;
case 3:
return CameraShakeCurve3;
default:
return CameraShakeCurve0;
}
}
//用于分割作用的下划线
public static char[] SplitUnderline = new char[] { '_' };
//用于分割作用的分号
public static char[] SplitSemicolon = new char[] { ';' };
#if UNITY_STANDALONE_WIN
//默认的目标帧率
public static int DefaultTargetFrameRate = 60;
#else
//默认的目标帧率
public static int DefaultTargetFrameRate = 32;
#endif
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9edf8e5b7f099ba4da0338ae6ef5495f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,172 @@
//**********************************************//
//作者:#何健#
//日期:#DATE#
//简述:#物品枚举#
//*********************************************//
namespace Thousandto.Code.Global
{
public static class ItemType
{
public const int UnDefine = -1; //未定义
public const int Money = 1; //货币
public const int Equip = 2; //装备
public const int Effect = 3; //效果道具:使用后给予玩家一定的效果;效果包括,加属性buff货币等
public const int Material = 4; //材料
public const int GemStone = 5; //宝石
public const int GiftPack = 6; //礼包道具
public const int SpecialPingZiItem = 7;//碎片
public const int Gift = 8; //礼物
public const int Normal = 9; //普通物
public const int Special = 10; //特殊类物品
public const int Title = 11; //称号
public const int MonsterSoulEquip = 12;//神兽装备
public const int MonsterSoulMaterial = 13;//魂兽水晶 神兽装备强化材料
public const int HolyEquip = 14;//圣装
public const int SpecialBox = 15; //多选一宝箱
public const int ChangeJob = 16; //转职道具
public const int XiShui = 17; //转职洗髓普通道具
public const int VipExp = 18; //VIP经验
public const int ImmortalEquip = 19; //仙甲
public const int LingPo = 21; //灵魄
public const int PetEquip = 23; //宠物装备
public const int SoulPearl = 24; //神印(魂珠)
public const int HorseEquip = 25; //坐骑装备
public const int DevilSoulEquip = 26; //魔魂装备
public const int DevilSoulChip = 27; //魔魂碎片
}
public static class ItemTypeCode
{
//Money =1, //未使用
public const int Gold = 1; //蓝钻
public const int BindGold = 2; //火钻
public const int BindMoney = 3;//绑定金币
public const int XianpoExp = 4; //仙魄经验
public const int XianpoSocre = 5; //仙魄积分
public const int TreasurePoint = 6; //机缘积分
public const int GoodEvil = 7; //善恶值
public const int Exp = 8; //经验
public const int Reputation = 9; //声望
public const int Achievement = 10; //成就
public const int UnionContribution = 11;//帮贡
public const int Lingshi = 12; // 灵石
public const int CourageValue = 13; // 勇气值
public const int Lingjing = 14; //灵晶 装备熔炼获得
public const int HolyEquipScore = 15; //圣装精粹
public const int VipExp = 16; //vip经验
public const int TitleValue = 17; //称号龙灵值
public const int WorldLevelScore = 18; //创世积分
public const int BaokuPoints = 19; //天启宝库积分
//UnUsed5 = 20; //未使用
public const int ActivePoint = 21; //活跃点
public const int LingPoJc = 22; //灵魄精粹
public const int LingPoSp = 23; //灵魄碎片
public const int LingPoSw = 24; //灵魄神物
public const int LingPoMb = 25; //灵魄秘宝
public const int LuckyDraw = 26; //一周福利抽奖卷
public const int HDShengDianBi = 27; //活跃兑换活动盛典币
public const int TianJinLingPoint = 28; //技能点
public const int StoreSocre = 29;// 仓库积分
public const int DuanWeiSocre = 30;// 段位积分
public const int GongxunSocre = 31;// 功勋值
public const int SoulSocre = 32;// 灵魂值
public const int BloodScrap = 33; // 血之精魄
public const int LingMaiDian = 34; //灵脉点
public const int GodToolZi = 35; //神器铸造·紫
public const int GodToolJin = 36; //神器铸造·金
public const int GodToolHong = 37; //神器铸造·红
public const int GodToolFen = 38; //神器铸造·粉
//后面的不是玩家货币,请不要使用它
public const int ItemBegin = 0;
public const int ItemEnd = 99999;
public const int EquipBegin = 100000;
public const int EquipEnd = 999999;
public const int OtherBegin = 1000000; //暂时如此
public const int OtherEnd = 9999999;
}
//物品的大类分类
public enum ItemBigType
{
UnDefine = -1, //未定义
All, //全部
ImmortalEquip, //圣装
Equip, //装备
Other, //其他
}
/// <summary>
/// 物品操作枚舉,會隨著以後開發增加.
/// </summary>
public static class ItemOpertion
{
public const int Equip = 1; //穿载
public const int Use = 2; //使用
public const int Batch = 3; //批量使用
public const int Get = 4; //获取途径
public const int Sell = 5; //卖出 = 2;商店或者交易
public const int Stall = 6; //摆摊
public const int Synth = 7; //合成
public const int Give = 8; //赠送
public const int Split = 9; //拆分
public const int Resolve = 10; //分解
public const int Change = 11; //兑换
public const int TakeOut = 12; //取出
}
/// <summary>
/// 背包类型
/// </summary>
public enum ContainerType
{
UnDefine = -1 , //未定义
ITEM_LOCATION_BAG, //玩家背包
ITEM_LOCATION_EQUIP , //玩家身上装备
ITEM_LOCATION_STORAGE, //玩家仓库
ITEM_LOCATION_CLEAR, //清理包裹
ITEM_LOCATION_BACKEQUIP,//玩家备用装备栏
ITEM_LOCATION_IMMORTAL, //仙甲背包
ITEM_LOCATION_COUNT, //物品容器总和
}
//装备品质
public static class QualityCode
{
public const int White = 1; //白色
public const int Green = 2; //绿色
public const int Blue = 3; //蓝色
public const int Violet = 4; //紫色
public const int Orange = 5; //橙色
public const int Golden = 6; //金色
public const int Red = 7; //红色
public const int Pink = 8;//粉色
public const int DarkGolden = 9;//暗金
public const int Colorful = 10;//七彩
public const int Count = 11;
}
//item tips 调用位置
public enum ItemTipsLocation
{
Defult = -1, //此为所有按钮不显示
Bag = 0, //背包
Equip = 1, //装备
PutInStorage, //放入仓库
OutStorage, //放入背包
PutInSell, //放入分解列表
OutSell, //放入背包
LingTi, //灵体
EquipSelect, //装备选择
Market, //拍卖行
XJTreasure, //寻宝
Nomal, //普通TIPS
PutinGuildStore,//放入公会仓库即捐献
OutGuildStore, //从公会仓库兑换出
Synth, //合成放入
SynthPutOut, //合成取出
EquipDisplay, //纯显示tips没有按钮没有比较
Count, //总和
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6120071c4a0c5b94f93b32b3fb3e81f0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Code.Global
{
//地图类型-1登录场景0世界地图1副本地图2竞技场3跨服副本5位面
public enum MapTypeDef
{
Map = 0, //普通地图
Copy = 1, //副本
JJC = 2, //竞技场
CrossCopy = 3, // 3跨服副本
PlanCopy = 5, //位面副本
UnDefine
}
public enum TransportTypeDef
{
// 0 普通 1 世界地图传送 2日常任务传送 3世界boss 4 区域npc传送
WorldMap = 1,
TaskSkill = 2,
Boss = 3,
Npc = 4,
TaskCollect = 5,
DuJie = 6,
}
//昼夜类型
public enum DayAndNightType
{
Day, //白天
Night, //夜晚
Count,
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 60dc3604a7d5130408db724d2838bb34
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Code.Global
{
/// <summary>
/// 个人提示类型 -- 服务器主动发送的提示信息类型
/// </summary>
public enum PersonNoticeTypeDefine
{
//错误通知
ERROR = 1,
//正常提示
NORMAL = 2,
//成功通知
SUCCESS = 3,
//滚动公告
MARQUEE = 4,
//切出
SHOWBOX = 5,
//聊天框系统提示
CHAT = 6,
//系统栏公告
CHAT_SYS_BULL = 7,
//高阶公告
HIGH_ORDER_NOTICE = 8,
//跑马灯
CHAT_SYS_MARQUEE = 9,
//可链接的跑马灯
CHAT_SYS_URL_MARQUEE = 10,
//屏幕中间闪烁提示
CENTER_BLINK_TIPS = 11,
//运营活动专用跑马灯
YUNYING_MARQUEE = 12,
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 17fe6866cf090c94381ca52ef0422eec
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,165 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using Thousandto.Cfg.Data;
namespace Thousandto.Code.Global
{
public enum RoleBaseAttribute
{
UniqueID = 0, //角色唯一IDuint64
AccountId = 1, //角色所属账号IDuint64
Name = 2, //角色名字string
DisableTalkStartTime = 3, //禁言开始时间int,单位为分钟)
DisableTalkTime = 4, //禁言时间int,单位分钟,-1表示永久禁言0表示无禁言大于0表示禁言时间
PkMode = 5, //当前PK模式
Level = 7, //当前角色总等级uint
XiSuiLevel = 8, //洗髓等级
Exp = 9, //当前经验ulong
Occupation = 10, //职业byte0女1男
Guild = 11, //公会IDulong
GuildName = 12, //公会名称
LoginDays = 14, //累计登录天数
CurHP = 15, //当前生命uint
ContinuousDays = 16, //连续登录天数(uint)
ExpRate = 17, //当前经验倍数
SceneCampID = 18, //场景阵营ID
BodyScale = 19, //身体缩放
LogicBodyRadius = 20, //逻辑大小
PicTitle = 21, //图片称号
RollDodgeLevel = 22, //当前翻滚等级
Military = 23, //当前军衔
CurArmor = 24, //当前护甲
EscortUID = 25, //护送ID
StateLevel = 26, //境界等级
FaBaoCfgID = 29, //法宝配置ID
FaBaoUID = 30, //法宝唯一ID
ShiHaiID = 31, //识海ID
VipLevel = 32, //vip等级
VipExp = 33, //vip经验
GuildRank = 34, //公会职位
CurLinLi = 35, //当前灵力值
FaBaoSprite1ID = 36, //法宝器灵1ID
FaBaoSprite2ID = 37, //法宝器灵2ID
FaBaoSprite3ID = 38, //法宝器灵3ID
FlySwordCfgID = 39, //飞剑配置ID
FlySwordUID = 40, //飞剑唯一ID
GrowthWayID = 41, //成长之路模型ID
FlySwordSkillID = 42, //飞剑技能ID
ChangeJobLevel = 43, //转职等级
MarryChildID = 44, //仙娃ID
MarryChildName = 45, //仙娃名字
Count
}
public enum AllBattleProp
{
Attack = 1, //物攻
MaxHP = 2,//最大血量
SunderArmor = 3,//破甲[新增]
Defense = 4, //物防
Precise = 5,//精准[新增]
Deflect = 6,//偏斜[新增]
ShowAttackSpeed = 7, // 7, //攻速
ShowMoveSpeed= 8, // 8, //移速
Luck = 9, //幸运
IgnoreDefense = 10, //无视防御
Critical = 11, //暴击
Toughness = 12,//韧性[新增]
DamageAddition = 13, //伤害加成
DamageReduce = 14, //伤害减少
BrokenAttackPro = 15,//破击率[新增]
BrokenDefensePro = 16,//御破率[新增]
PrecisePro = 17,//精准率[新增]
DeflectPro = 18,//偏斜率[新增]
CriticalPro = 19,//暴击率[新增]
ResistCriticalPro = 20,//抗暴率[新增]
ExtensionControl = 21,//控制延长[新增]
ShortenControl = 22,//控制缩短[新增]
HitHeartPro = 23,//会心几率[新增]
HitHeartProDefense = 24,//会心抵抗[新增]
ComboPro = 25,//连击几率[新增]
BlockPro = 26,//格挡几率[新增]
FollowPro = 27,//追击几率[新增]
SeeThroughPro = 28,//识破几率[新增]
AttackAdd = 29, //物攻提升
HPAdd = 30, //生命提升
SunderArmorAdd = 31,//破甲提升
DefenseAdd = 32, //物防提升
AttackSpeedPercent = 33, //攻速加成提升比
MoveSpeedPercent = 34, //移速加成提升比
MonsterDamageAdd = 35,//对怪物攻击伤害提升[新增]
BeMonsterDamageReduce = 36,//被怪物攻击伤害降低[新增]
PlayerDamageAdd = 37,//对玩家攻击伤害提升[新增]
BePlayerDamageReduce = 38,//被玩家攻击伤害降低[新增]
HPPercent = 39, //当前等级角色生命提升比
AttackPercent = 40, //当前等级角色攻击提升比
DefensePercent = 41,//当前等级角色防御提升比
BrokenPercent = 42, //当前等级角色破甲提升比
KillMonsterExpPercent = 43, //杀怪经验提升百分比
IdleRecoverHPPercent = 44,//非战斗回血比
WindElement = 45,//风元素
FireElement = 46,//火元素
WaterElement = 47,//水元素
ThunderElement = 48,//雷元素
SoilElement = 49,//土元素
WindElementResistant = 50,//风元素抗性值
FireElementResistant = 51,//火元素抗性值
WaterElementResistant = 52,//水元素抗性值
ThunderElementResistant = 53,//雷元素抗性值
SoilElementResistant = 54,//土元素抗性值
CritsDamageMultiple = 55,//暴击伤害倍数
HitHeartDamageMultiple = 56,//会心伤害倍数
ComboDamageMultiple = 57,//连击伤害倍数
FollowDamageMultiple = 58,//追击伤害倍数
LingLi = 59,//灵力值
LingLiAtk = 60,//灵力攻击
LingLiDef = 61,//灵力减伤
AttackSpeed = 105, //攻速
MoveSpeed = 106, //移速
}
public enum RoleState
{
SkillFreeze = 1, // 技能僵直
SuperArmor = 2, // 霸体
}
// 玩家的PK模式
public enum PKMode : byte
{
PeaceMode = 0, // 和平:玩家不会攻击任何玩家。
AllMode = 1, // 全体:玩家可以攻击除了队伍中的任意玩家。
SelfServer = 2, // 本服:玩家可以攻击除了本服务器的任意玩家
SceneCampMode = 3, // (强制)场景阵营模式,适用于战场中由服务器划分的阵营
GuildMode = 4, // 公会:玩家可以攻击除公会外的其他玩家
Count
}
//玩家亮剑状态
public enum PlayerBrightWeaponState
{
Bright, //亮剑
Receive, //收剑
Receiveing //收剑ing
}
//飞剑类型
public enum FlySwordType
{
FlySword, //飞剑
SwordSoul, //剑灵
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8755af24365194544b4d35bef107ef1f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,42 @@
//UI分页定义文件
namespace Thousandto.Code.Global
{
public enum EquipFormSubPanel
{
Train,
Star,
Compromises,
Skill,
Recast,
Refining,
SkillCom,
Mix,
ItemSynth,
GodTried,
EquipSyn,
Suit,//套装
SoulSyn, //灵魂合成
SoulEquipSyn,//魂兽装备合成
Cast,//铸灵
}
public enum GuildSubPanel
{
GuildJoin,
GuildCreate,
GuildInvit,
GuildInfo,
GuildMember,
GuildBuild,
GuildSkill,
GuildWelfare,
}
public enum BagFormSubPanel
{
Bag, //背包
Store,//仓库
Synth,//合成
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e802235f5f1da044faf422321c56f214
timeCreated: 1476870367
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

5
Assets/Code/Global/Event.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 297af8ae8f3515a48983263875d2aeb7
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,541 @@
//**********************************************//
//作者:#AUTHOR#
//日期:#DATE#
//简述:#DESCRIPTION#
//*********************************************//
using UnityEngine.Gonbest.MagicCube;
namespace Thousandto.Code.Global
{
/// <summary>
/// 逻辑事件的ID定义
/// 这些消息与UI消息的区别是:不会导致UI预制的加载
/// 注意:EID_BASE + {这个数不可以超过100000}
/// </summary>
public enum LogicEventDefine
{
//消息ID基础
EID_BASE = EventConstDefine.EVENT_LOGIC_BASE_ID,
//系统消息=========================================
//GameCenter,内核初始化完毕
EID_GAMECENTER_LOGIC_NEW,
//开始初始化
EID_GAMECENTER_LOGIC_START_INITIALIZE,
//GameCenter,卸载完毕
EID_GAMECENTER_LOGIC_UNINITIALIZED,
//GameCenterprofiler事件注册
EID_GAMECENTER_LOGIC_PROFILER,
//网络,登录以及SDK相关消息,===============================
//登录SDK成功
EID_EVENT_SDK_LOGIN_SUCCESS,
//登录游戏成功
EID_EVENT_GAME_LOGIN_SUCCESS,
//登录场景准备完毕
EID_EVENT_LOGINSCENE_READYOK,
//进入登录状态
EID_EVENT_ENTER_LOGINSTATE,
//离开登录状态
EID_EVENT_LEAVE_LOGINSTATE,
//断线重连
EID_EVENT_RECONNECT,
//玩家属性改变事件ID=========================================
//人物战斗属性改变
EID_EVENT_PLAYER_BATTLE_ATTR_CHANGED,
//人物基础属性改变
EID_EVENT_PLAYER_BASE_ATTR_CHANGED,
//人物等级改变
EID_EVENT_PLAYER_LEVEL_CHANGED,
//玩家的目标改变
EID_EVENT_PLAYER_TARGET_CHANGED,
EID_EVENT_PLAYER_TARGET_SELECT,
//刷新采集物上占领Falg
EID_EVENT_OBJ_ZANLING_REFRESH,
//显示Obj上方对话泡泡
EID_EVENT_OBJHEDAPOPO_SHOW,
//本地玩家信息刷新
EID_EVENT_LOCAL_PLAYER_REFRESH,
//当前玩家进入场景
EID_EVENT_PLYAER_ENTER_SCENE,
//主角战斗状态改变
EID_EVENT_FIGHT_STATE_CHANGED,
//挂机状态改变
EID_EVENT_MANDATE_STATE_CHANGED,
//PK模式改变
EID_EVENT_PKMODE_CHANGED,
//主角技能僵直状态改变
EID_EVENT_SKILLSTIFFSTATE_CHANGED,
//功能按钮刷新
EID_EVENT_FUNCTION_UPDATE,
//同步功能状态
EID_EVENT_SYNC_FUNCTION_INFO,
//开启主菜单
EID_EVENT_OPEN_MAINMENU,
//关闭主菜单
EID_EVENT_CLOSE_MAINMENU,
//打开副本跨服匹配信息界面
EID_EVENT_OPEN_CROSSMATCHPANEL,
//关闭副本跨服匹配信息界面
EID_EVENT_CLOSE_CROSSMATCHPANEL,
//关闭所有的窗体
EID_EVENT_CLOSE_ALL_FORM,
//当某个窗体关闭或者显示时,发送的消息
EID_EVENT_FORM_SHOW_AFTER,
EID_EVENT_FORM_CLOSE_AFTER,
//某个窗体关闭或者显示时,发送他的窗体ID,也就是UIConfig中的ID
EID_EVENT_FORM_ID_SHOW_AFTER,
EID_EVENT_FORM_ID_CLOSE_AFTER,
//暂时挂起和恢复所有的窗体
EID_EVENT_SUSPEND_ALL_FORM,
EID_EVENT_RESUME_ALL_FORM,
//显示和隐藏所有UI摄像机
EID_EVENT_SHOWALL_UICAMERA,
EID_EVENT_HIDEALL_UICAMERA,
//关闭当前的全屏界面
EID_EVENT_HIDE_CURFULLSCREEN_FORM,
//所有窗体挂起或者回复之后的处理
EID_EVENT_ON_SUSPEND_ALL_FORM_AFTER,
EID_EVENT_ON_RESUME_ALL_FORM_AFTER,
//挂起和恢复UIFormManager的消息系统 --- 这两个事件要慎用
//这两个事件只用于返回登录以及返回更新的处理里,其他地方不要用
//这两个事件只用于返回登录以及返回更新的处理里,其他地方不要用
//这两个事件只用于返回登录以及返回更新的处理里,其他地方不要用
EID_EVENT_SUSPEND_FORM_EVENT_SYSTEM,
EID_EVENT_RESUME_FORM_EVENT_SYSTEM,
//卸载所有的窗体资源
EID_EVENT_CLEAR_ALL_FORM_ASSET,
//关闭当前界面
EID_EVENT_HIDE_CURRENT_FORM,
//技能列表改变
EID_EVENT_SKILL_LIST_CHANGED,
//变身技能改变
EID_EVENT_CHANGE_SKILL_CHANGED,
// 任务系统
EID_EVENT_TASKCHANG, // 任务变更
EID_EVENT_GETNEWTASK, //获取新的任务
EID_EVENT_TASKFINISH, // 任务完成
EID_EVENT_ISTASKFINISH, //返回任务是否完成
EID_EVENT_TASKINIT, // 登录完成客户度端收到任务数据后的事件
EID_EVENT_TASKFINISH_ONEKEY, //任务一键完成
EID_EVENT_TASK_RECOMMEND_CHANGE, //任务推荐目标变化
//修改HUD对于玩家生命名称称号的显示
EID_EVENT_UPDATEPLAYERHPSHOW_STATE,
EID_EVENT_UPDATEPLAYERHUDHEADSHOW_STATE,
EID_EVENT_UPDATEPETHUDHEADSHOW_STATE,
//更新玩家的名字颜色
EID_EVENT_HUD_UPDATEHUDNAMECOLOR,
//更新玩家隐身状态
EID_EVENT_HUD_UPDATEHUD_INVISIBLE_STATE,
//聊天消息来了
EID_EVENT_CHAT_REFRESH,
//聊天还原语言
EID_EVENT_CHAT_REVERT_LAN,
//公会聊天消息,显示主界面按钮红点
EID_EVENT_GUILD_CHAT_REDPOINT_REFRESH,
//私聊消息来了
EID_EVENT_CHAT_PRIVATE_REFRESH,
//获取当前地图的线路信息
EID_EVENT_GET_MAP_LINES_RESULT,
//更新地图界面
EID_EVENT_UPDTAE_MAPUI,
//buff增加或者减少事件
EID_EVENT_BUFF_COUNT_CHANGED,
//buff增加事件
EID_EVENT_ON_BUFF_ADD,
//buff删除事件
EID_EVENT_ON_BUFF_REMOVE,
//buff更新事件
EID_EVENT_BUFF_UPDATED,
//战斗力改变事件
EID_EVENT_FIGHT_POWER_CHANGED,
EID_EVENT_WARINGBACKPACKCHANGE,
//HUD的消息
EID_EVENT_HUD_POPUP_DAMAGE,
EID_EVENT_HUD_POPUP_BUFFDAMAGE,
EID_EVENT_HUD_UPDATE_HEADINFO,
EID_EVENT_HUD_UPDATE_DROPINFO,
EID_EVENT_HUD_SHOWMONSTER_HP,
EID_EVENT_HUD_HIDEMONSTER_HP,
EID_EVENT_HUD_SHOWEMONSTER_SERVERPOP,
EID_EVENT_HUD_SHOWEMONSTER_SERVERSTRINGPOP,
EID_UIHUD_ADDHUD,
EID_UIHUD_REMOVEEHUD,
EID_PAUSE_HUD, //暂停HUD
// 角色模型刷新
EID_EVENT_EQUIPMENTFORM_MODELUPDATE,
//弹出hud buff名字
EID_EVENT_HUD_POPUP_BUFFNAME,
//高阶提示
EID_EVENT_HIGHNOTIFY,
//清除关闭跑马灯消息的处理
EID_EVENT_MSG_MARQUEE_CLEAR,
//进入跳跃状态
EID_EVENT_ENTERJUMPSTATE,
//离开跳跃状态
EID_EVENT_LEAVEJUMPSTATE,
//进入轻功状态
EID_EVENT_ENTERFLYSTATE,
//进入轻功后段状态
EID_EVENT_ENTERFLYENDESTAGE,
//离开轻功状态
EID_EVENT_LEAVEFLYSTATE,
//上下坐骑
EID_EVENT_UPDATMOUNTRIDE_STATE,
//主角移动方向,用于更新摄像机朝向
EID_EVENT_MOVEDIR_UPDATE,
//摇杆事件
EID_EVENT_JOYSTICK_DRAGBEGIN,
EID_EVENT_JOYSTICK_DRAGING,
EID_EVENT_JOYSTICK_DRAGEND,
//增加主摄像机隐藏计数
EID_EVENT_ADD_MAINCAMERA_HIDECOUNTER,
//减少主摄像机的隐藏计数
EID_EVENT_DEC_MAINCAMERA_HIDECOUNTER,
//增加主摄像机的显示计数
EID_EVENT_ADD_MAINCAMERA_SHOWCOUNTER,
//减少主摄像机的显示计数
EID_EVENT_DEC_MAINCAMERA_SHOWCOUNTER,
// 背包
EVENT_BACKFORM_ITEM_UPDATE,
EVENT_BACKFORM_UPDATE_ALL,
EVENT_COIN_CHANGE_UPDATE,
EVENT_COIN_ADD_UPDATE,
EVENT_COIN_EXP_CHANGE_UPDATE,//经验值改变专用
EVENT_ITEM_CHANGE_UPDATE,
EVENT_MOUNTLV_ITEM_CHANGE,//坐骑升级物品改变
EVENT_WEAPONLV_ITEM_CHANGE,//神兵升级物品改变
EVENT_WINGLV_ITEM_CHANGE,//翅膀升级物品改变
EVENT_PETLV_ITEM_CHANGE,//宠物升级物品改变
EVENT_EQUIP_ADD,
EVENT_EQUIP_DEL,
EVENT_BACKFORM_NEW_ITEM,
EID_EVENT_CLEARBAG_UPDATE,
EID_EVENT_ITEM_DELETELIST_UPDATE,
EID_EVENT_ONLINE_ITEMINFO,
EID_EVENT_BAG_OPENCELL_UPDATE,
//更新设置界面
EID_EVENT_UPDATEGAMESETTING_FORM,
//新功能开放界面关闭
EID_EVENT_NEWFUNCTION_CLOSE,
//模型展示界面打开
EID_EVENT_SHOWMODEL_OPEN,
//模型展示界面关闭
EID_EVENT_SHOWMODEL_CLOSE,
//仓库
EVENT_STORAGE_ITEM_UPDATE,
EVENT_STORAGE_FORM_UPDATE,
EID_EVENT_STORE_ITEM_UNSELECT,
EID_EVENT_BACKFORM_ITEM_UNSELCT,
EVENT_EQUIPMENTFORM_ITEM_UPDATE,
EVENT_EQUIPMENTFORM_UPDATE_FORM,
//好友
EID_EVENT_FRIEND_UPDATE_FRIENDLIST,
EID_EVENT_FRIEND_OPEN_FRIENDPANEL,
EID_EVENT_FRIEND_UPDATE_SEARCHFRIENDPANEL,
EID_EVENT_FRIEND_UPDATE_INTIMACY,
EID_EVENT_FRIEND_UPDATE_REDPOINT,
EID_EVENT_FRIEND_UPDATE_DEATHRECORD,
//装备
EID_EVENT_UI_EQUIPSELECT_UPDATE,
EID_EVENT_UI_EQUIPSKILLCOM_SUC,
EID_EVENT_UI_EQUIPSYNRESULT_UPDATE,
EID_EVENT_UI_SOULEQUIPSYNRESULT_UPDATE,
EID_EVENT_WEAREQUIPSUC,
EID_EVENT_UNWEAREQUIPSUC,
EID_EVENT_CLOSEREMAINTIME_EQUIP,
EID_EVENT_EQUIPSYNTH_RED_UPDATE,
EID_EVENT_IMMORTALEQUIP_WEAR_SUC,
//组队
EID_EVENT_UITEAMFORM_UPDATE,
//聊天插入表情
EID_EVENT_CHAT_INSERT_EXPRESSION,
//聊天插入物品
EID_EVENT_CHAT_INSERT_ITEM,
//聊天插入历史
EID_EVENT_CHAT_INSERT_HISTORY,
//自动抓宠
EID_EVENT_GM_AUTO_CATCH,
//采集进度更新
EID_EVENT_UPDATECOLLECT_PROGRESS,
//客户端变量数据返回
EID_EVENT_CLIENTVARIABLERETURN,
EID_EVENT_GUILD_LEAVE,//离开公会
EID_EVENT_GUILDTASKLIST_UPDATE,
//公共UI进度更新
EID_EVENT_UPDATECOMMON_PROGRESS,
EID_EVENT_WELFARE_CARD_RECEIVED, //领取月卡
//弹幕 开启和关闭
EID_EVENT_DANMU_ENABLE, //开启弹幕
EID_EVENT_DANMU_DISABLE, //关闭弹幕
//实时语音
EID_EVENT_VOICE_CHANNEL_CHANGED, //玩家更改频道的SDK返回
EID_EVENT_VOICE_MEMBERINFO_CHANGED, //用户列表改变
EID_EVENT_GUILD_COMMANDER_LIST_CHANGED, //帮会的指挥官列表被改变
EID_EVENT_GUILD_COMMANDER_PLAYER_CHANGED, //帮会的指挥官玩家信息改变
//场景点击
EID_EVENT_ON_HIT_SCENE,
//狂轰乱炸副本伤害返回
EID_EVENT_ON_FLYPET_SKILLRESULT,
//狂轰乱炸伤害数字
EID_EVENT_ADD_FLYPET_DAMAGE,
//显示破甲效果
EID_EVENT_SHOWPOJIA_EFFECT,
//显示Boss技能释放提示
EID_EVENT_SHOWSKILLWARNING_EFFECT,
//怪物泡泡显示更新
EID_POP_MONSTER_UPDATESTRING,
//展示boss警示圈
EID_EVENT_SHOWBOSS_WARNINGFILED,
//主角使用技能
EID_EVENT_ON_LP_USE_SKILL,
//取消主界面摇杆和技能操作
EID_EVENT_CANEL_MAINHANDLE,
//显示FPS
EID_EVENT_SHOW_MAINFPS,
//主界面菜单开启
EID_EVENT_ON_MAINMENU_OPEN,
EID_EVENT_ON_MAINMENU_CLOSE,
//断线重连成功
EID_EVENT_RECONNECT_SUCCESS,
//开始强制引导
EID_EVENT_START_FORCEGUIDE,
//头像裁剪回调
EID_EVENT_CLIP_IMG_CALLBACK,
//头像开始上传
EID_EVENT_UPLOAD_HEAD_START,
//头像上传结束
EID_EVENT_UPLOAD_HEAD_END,
//记录步骤的事件
EID_EVENT_UPDATE_RECORDER_STEP,
//主动退出位面副本逻辑消息
EID_EVENT_INITIATIVE_EXIT_PLANECOPY,
//进入位面
EID_EVENT_ENTET_PLANECOPY,
//离开位面
EID_EVENT_EXIT_PLANECOPY,
//增加强制引导
EID_EVENT_BLOCK_ADD_FORCEGUIDE,
//增加模型展示
EID_EVENT_BLOCK_ADD_SHOWMODEL,
//增加新功能开启
EID_EVENT_BLOCK_ADD_NEWFUNCTION,
//增加对话
EID_EVENT_BLOCK_ADD_DIALOG,
//增加剧情展示
EID_EVENT_BLOCK_ADD_CINEMATIC,
//增加飞行传送
EID_EVENT_BLOCK_ADD_FLYTELEPORT,
//增加章节展示
EID_EVENT_BLOCK_ADD_TASKCHAPTER,
//日常界面 刷新
EID_EVENT_REFRESH_DAILYPANEL,
//日常活动刷新
EID_EVENT_REFRESH_ACTIVITYLIST,
// 与远程玩家交互
EID_EVENT_SHOW_REMOTE_PLAYER_HEAD,
//设置预加载form
EID_EVENT_SETPRELOADFORM,
//打开预加载form
EID_EVENT_OPENPRELOADFORM,
//ResEquipPartInfo消息这个消息C#和lua都要用到。原因
//里面包含1.装备信息C#端要使用、2.部位强化信息lua、3.部位洗炼信息lua、4.部位宝石信息lua
EID_EVENT_RESEQUIPPARTINFO,
//改变maplight
EID_EVENT_LIGHTMAP_CHANGED,
//装备洗炼面板刷新
EID_EVENT_REFRESH_EQUIPFORGE,
// 刷新称号数据
EID_EVENT_TITLE_REFRESH_TITLEINFO,
EID_EVENT_TITLE_REFRESH_TITLESTATE,
// 称号红点
EID_EVENT_TITLE_REDPOINT,
//播放怪物出生特效事件
EID_EVENT_ONMONSTER_BRITHVFX_PLAYED,
//背包中的仙魄改变
EID_EVENT_XIANPO_BAG_ITEM_CHANGED,
//血量变化通知消息
EID_EVENT_HP_CHANGE,
//增加圣装
EID_EVENT_ADD_HOLYEQUIP,
//删除圣装
EID_EVENT_DELETE_HOLYEQUIP,
//更新圣装装备栏
EID_EVENT_UPDATE_HOLYEQUIP_PART,
//刷新圣装背包
EID_EVENT_UPDATE_HOLYEQUIP_BAG,
//上线刷新圣装
EID_EVENT_HOLYEQUIP_ONLINE,
//强化圣装返回
EID_EVENT_INTENSIFY_HOLYEQUIP,
//圣魂使用返回
EID_EVENT_HOLYEQUIP_SOUL_UPDATE,
//播放合成成功效果
EID_EVENT_MERGE_SUCC,
//新技能消息
EID_EVENT_PLAYER_SKILL_ONLINE,
EID_EVENT_PLAYER_SKILL_UPCELL,
EID_EVENT_PLAYER_SKILL_UPSTAR,
EID_EVENT_PLAYER_SKILL_UPMERIDIAN,
EID_EVENT_PLAYER_XINFA_CHANGED,
//自定义传送消息
EID_EVENT_CUSTOM_TRIGGER_TELEPORT,
//采集物头顶改变
EID_EVENT_COLLECTION_TITLE_CHANGED,
//第一次进入游戏场景
EID_EVENT_FIRSTENTERMAP,
//程序暂停切后台
EID_EVENT_APPFOCUS,
//曲面屏缩放设置改变
EID_CURVEDSCREENSCALE_CHANGE,
//服务器屏蔽字数据改变
EID_SERVER_FORBID_TEXT_CHANGED,
//跨天O点触发事件
EID_EVENT_CROSSDAY,
//UIPanel填充频率改变
EID_PANEL_FILLDRAWCALLRATE_CHANGED,
//打印NGUI缓存信息
EID_NGUI_PRINTCACHE_INFO,
//飞剑技能刷新
EID_EVENT_FLYSWORD_SKILL_UPDATE,
//飞剑模型加载完成,用于渡劫播放特效
EID_EVENT_LOCALFLYSWORD_LOADFINISH,
//enable摄像机后处理脚本
EID_EVENT_ENABLE_CAMERA_POSTEFFECT,
//disable摄像机后处理脚本
EID_EVENT_DISABLE_CAMERA_POSTEFFECT,
//播放飞剑技能
EID_EVENT_PLAY_FLYSWORD_SKILL,
//重新刷新刘海和曲面屏界面
EID_EVENT_REFRESH_NOTCHANDCURVESCREEN,
//关闭所有UI
EID_EVENT_HIDEALLUI,
//刷新剑冢
EID_EVENT_FLYSWORDGRAVESCENE_LOADFINISH,
EID_EVENT_UPDATE_FLYSWORDGRAVE,
EID_EVENT_FLYSWORDGRAVE_PLAYANI,
EID_EVENT_FLYSWORDGRAVE_PLAYANIEND,
EID_EVENT_FLYSWORDGRAVE_PLAYHIDEANI,
EID_EVENT_FLYSWORDGRAVE_SCENE_HIDE,
EID_EVENT_FLYSWORDGRAVE_SCENECAMERA_HIDE,
EID_EVENT_FLYSWORDGRAVE_ACITVE_NEW,
EID_EVENT_FLYSWORDGRAVE_SHOWRESULT,
//显示数字输入Info
EID_EVENT_SHOW_NUMINPUTINFO,
//怪物出生事件
EID_EVENT_ON_MONSTER_BORN,
//开始飞行传送事件
EID_EVENT_FLYTELEPORT_START,
//结束飞行传送事件
EID_EVENT_FLYTELEPORT_FINISH,
//检测技能系统红点
EID_EVENT_CHECK_SKILL_REDPOINT,
//玩家状态改变现在只在idle和sitdown触发
EID_EVENT_LOCALPLAYER_STATECHANGE,
//刘海屏设置改变
EID_NOTCHSHOW_CHANGED,
//刷新助战宠物
EID_EVENT_REFRESH_ASSIST_PET,
//传道打坐
EID_EVENT_CHUANDAO_SITDOWN_START,
//使用经验丹
EID_EVENT_USEEXP_ITEM,
//主角死亡消息
EID_EVENT_ON_LP_DEAD,
//刷新圣装战力
EID_EVENT_REFRESH_HOLY_FIGHTPOWER,
//任务更新
EID_EVENT_TASKBASE_UPDATED,
//套装石合成返回
EID_EVENT_EQUIPSUITSTONE_RESULT,
//主界面分页开启关闭状态刷新
EID_EVENT_MAIN_SUBPANELOPENSTATE,
//打开主界面某个分页
EID_EVENT_MAIN_OPENSUBPANEL,
//关闭主界面某个分页
EID_EVENT_MAIN_CLOSESUBPANEL,
//播放主界面显示动画
EID_EVENT_MAIN_SHOWANIMATION,
//播放主界面隐藏动画
EID_EVENT_MAIN_HIDEANIMATION,
//更新月卡尊享卡界面
EID_EVENT_WELFARE_CARD_REFRESH,
//开始技能CD
EID_EVENT_BEGIN_SKILLCD,
//结束技能CD
EID_EVENT_END_SKILLCD,
//使用技能
EID_EVENT_ON_USED_SKILL,
//设置变身技能列表
EID_EVENT_SET_CHANGEMODEL_SKILL,
//清理变身技能列表
EID_EVENT_CLEAR_CHANGEMODEL_SKILL,
//设置自动释放剑灵技能
EID_EVENT_SETAUTOUSE_FLYSWORD_SKILL,
//引导开始
EID_EVENT_ONGUIDEFORM_OPEN,
//引导结束
EID_EVENT_ONGUIDEFORM_CLOSE,
//柔体效果改变
EID_EVENT_SOFTBONE_ENABLE_CHANGED,
//跟NPC聊天
EID_EVENT_TALKTONPC_CLICK,
//头像开始下载
EID_EVENT_DOWNLOAD_HEAD_START,
//头像结束下载
EID_EVENT_DOWNLOAD_HEAD_END,
//头像开始检查
EID_EVENT_CHECK_HEAD_START,
//头像开始完成
EID_EVENT_CHECK_HEAD_END,
//点击了屏幕
EID_EVENT_ON_FINGER_DOWN,
//自动点击主线任务
EID_EVENT_CLICK_MAIN_TASK,
/// <summary>
/// !!其他游戏内的 事件枚举 请加在前面!!
/// 专用于timeline的事件枚举
/// 请和Assets\Launcher\ExternalLibs\TimelineTrack\TimelineEnumDefine.cs文件中的枚举值一致
/// 否则相互不能接收/发送消息
/// </summary>
EID_EVENT_TIMELINEEVENT_START = 190000,
EID_EVENT_TIMELINEEVENT_NEXT, //ui类型timeline中暂停轨道使用的消息。继续播放 [下一段] timeline
EID_EVENT_REFRESH_TIMELINEFORM_DEPTH, //改变timeline的窗体的深度
EID_EVENT_TIMELINE_STARTREPEAT, //开始timeline循环
EID_EVENT_TIMELINE_ENDREPEAT, //结束timeline循环
EID_EVENT_TIMELINE_CHOOSE, //timeline循环选择支
EID_EVENT_TIMELINE_FADEINBLACK, //淡入全屏黑色
EID_EVENT_TIMELINE_FADEOUTBLACK, //淡出全屏黑色
EID_EVENT_TIMELINE_FULLBLACK, //直接全黑
EID_EVENT_TIMELINE_FADEBLACKTRACK_OVER, //淡入淡出黑屏轨道结束
EID_EVENT_TIMELINE_CONTROLCAMERA_START, //开始自由控制camera
EID_EVENT_TIMELINE_CONTROLCAMERA_END, //结束自由控制camera
EID_EVENT_TIMELINE_PRELOAD_TEXTURE, //预加载texture
EID_EVENT_TIMELINE_REFRESH_TEXTURE, //刷新texture
EID_EVENT_TIMELINE_REFRESH_SPRITE, //刷新sprite
EID_EVENT_TIMELINE_PLAYEYEBLINKEFF, //播放眨眼特效
EID_EVENT_TIMELINE_TWEENCAMERA, //tween摄像机至原位看向localplayer的位置
EID_EVENT_TIMELINEEVENT_END, //timeline播放结束之后发送该消息
EID_EVENT_DOWNLOAD_GAMERES_START, //后台资源下载开始的消息
EID_EVENT_DOWNLOAD_GAMERES_END, //领取了更新有礼的奖励,关闭掉按钮
EID_EVENT_NPCTALK_END, //交互和NPC对话结束
EID_EVENT_SHOW_INTERACTOR_END, //显示交互物说明结束
EID_EVENT_CALENDAR_END, //日历结束消息推送
EID_EVENT_LOADTIMELINE_END, //加载timeline完成
EID_EVENT_PAYLIST_REFESHED, //下载服务器列表成功
EID_EVENT_GAMESETTING_SAVE_BEFORE, //游戏这只保存之前调用的事件
EID_EVENT_UISCENEN_LOADFINISH, //ui背景模型加载完成
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d3e2bdffe6d234948bbfacfe1b29f481
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

5
Assets/Code/Global/Event/Params.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 310a55d293fd32f4d8063ce179544a6b
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,20 @@
using Thousandto.Core.Base;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace Thousandto.Code.Global
{
public class NumInputInfoParam
{
//最大数量
public int MaxCount { get; set; }
//单价
public int Price { get; set; }
//拥有货币
public int HaveCoin { get; set; }
//货币图片ID
public int IconId { get; set; }
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ef6e02efb50d679438df06714461ee24
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a7c3d75d44542064bb82a2d1089cd277
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

5
Assets/Code/Global/Interface.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: f16cb3a880da4b9458d37eb6169a8101
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Plugins.Common
{
/// <summary>
/// 按钮功能信息
/// </summary>
public interface IButtonFunctionInfo
{
//图标字符串
string Icon { get;}
//显示文字
string Text { get;}
//序列号
int SortNum { get; }
//是否显示
bool IsVisible { get; }
//是否显示红色点点
bool IsShowRedPoint { get; }
//是否显示特效
bool IsEffectShow { get; }
//点击按钮后的回调
void OnClickHandler(object param);
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 10d64f3e749de364984393e23822ff25
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Plugins.Common
{
/// <summary>
/// 弹出PopSelectItem基础类
/// </summary>
public class PopSelectItem
{
public string Text;
public int Id;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: df87fac5adf431b4197100417274cfcc
timeCreated: 1515642112
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

5
Assets/Code/Logic.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 4e9a8464464e3bf45acca69b60737512
folderAsset: yes
DefaultImporter:
userData:

8
Assets/Code/Logic/BISystem.meta generated Normal file
View File

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

View File

@ -0,0 +1,417 @@
using Thousandto.Code.Center;
using Thousandto.Code.Logic;
using Thousandto.Core.Base;
using Thousandto.CoreSDK;
using MSG_BI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Thousandto.Cfg.Data;
using System.Text;
using System;
namespace Thousandto.Code.Logic
{
//打点系统
public class BISystem
{
private ValMap _tempValMap = new ValMap();
//点击数据{[0]=1,[1]=1598607932,[2]=2,[3]=1598607955,...} id、时间戳
private int[] _clickInfoArr = new int[256];
//当前可写入的位置
private int _writePos = 0;
//下一次保存到本地的时间戳
private double _nextSaveUTCTime = 0;
//下一次发送到服务器的时间戳
private double _nextReqUTCTime = 0;
//缓存数量+本地存储数量 的最大值
private int _maxCount = 128;
//发送到服务器的时间间隔 秒
private double _reqSpacingTime = 300;
//保存到本地的时间间隔 秒
private double _saveSpacingTime = 10;
//是否检测
private bool _isCheck = false;
//本地保存的角色Id
private ulong _playerPrefsRoleId = 0;
//当前玩家id
private ulong _curRoleId = 0;
public void Initialize()
{
GameCenter.RegFixEventHandle(Global.LogicEventDefine.EID_EVENT_FIRSTENTERMAP, OnFirstEnterMap);
if (PlayerPrefs.HasKey("[Bi_RoleId]"))
{
var strId = PlayerPrefs.GetString("[Bi_RoleId]");
ulong id = 0;
if (ulong.TryParse(strId, out id))
{
_playerPrefsRoleId = id;
}
else
{
PlayerPrefs.DeleteKey("[Bi_RoleId]");
}
}
}
//首次进入场景
private void OnFirstEnterMap(object param, object sender)
{
_curRoleId = GameCenter.GameSceneSystem.GetLocalPlayerID();
if (_playerPrefsRoleId != 0)
{
ReqAllClickEvent();
}
if (_playerPrefsRoleId != _curRoleId)
{
PlayerPrefs.SetString("[Bi_RoleId]", _curRoleId.ToString());
_playerPrefsRoleId = _curRoleId;
}
Start();
}
public void Uninitialize()
{
GameCenter.UnRegFixEventHandle(Global.LogicEventDefine.EID_EVENT_FIRSTENTERMAP, OnFirstEnterMap);
Stop();
_curRoleId = 0;
}
#region//消息
//message ValMap
//{
// required string key = 1; // key
// required string value = 2; // value
//}
// message ReqBiDevice
// {
// enum MsgID { eMsgID = 185201; };
// required int32 appId = 1; // 平台游戏的游戏id,用于区分游戏由sdk获取
// required int32 roleId = 2; // 角色ID
// required string channelId = 3; // 平台唯一的渠道id,用于区分渠道厂商由sdk获取
// required string sourceId = 4; // 游戏包体id由sdk获取
// required string deviceId = 5; // 平台唯一的设备id由sdk获取
// required int32 platform = 6; // 运行平台IOS=1/安卓=2/H5=3
//}
public void ReqBiDevice()
{
var _reqBiDevice = new ReqBiDevice();
_reqBiDevice.device = CreatDevictData();
_reqBiDevice.Send();
}
//创建设备信息
public Device CreatDevictData()
{
var _device = new Device();
//绿岸
// app id
int appId = 0;
if (!string.IsNullOrEmpty(SDKCacheData.AppID))
int.TryParse(SDKCacheData.AppID, out appId);
_device.appId = appId;
// 角色ID
int roleID = 0;
if (!string.IsNullOrEmpty(SDKCacheData.RoleID))
int.TryParse(SDKCacheData.RoleID, out roleID);
_device.roleId = roleID;
// 渠道ID
_device.channelId = SDKCacheData.ChannelID != null ? SDKCacheData.ChannelID : "";
// 游戏包体ID
_device.sourceId = SDKCacheData.SourceId != null ? SDKCacheData.SourceId : "";
// 设备ID
_device.deviceId = SDKCacheData.DevicesId != null ? SDKCacheData.DevicesId : "";
// 运行平台IOS=1/安卓=2/H5=3/web=4/pc=5
_device.platform = Application.platform == RuntimePlatform.IPhonePlayer ? 1 : Application.platform == RuntimePlatform.Android ? 2 : 4;
//通用
// 客户端资源版本6.21.3
_device.app_version = GameGlobalData.RES_VERSION != string.Empty ? GameGlobalData.RES_VERSION :GameCenter.SDKSystem.AppVersion;
// 运营商中国联通
_device.merchant = SDKCacheData.Merchant != null ? SDKCacheData.Merchant : "";
// 网络类型5G
_device.net_type = Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork ? "CarrierData" : "WIFI";
// 屏幕分辨率480*800
_device.screen = string.Format("{0}*{1}", Screen.width, Screen.height);
// 手机操作系统,如android、iOS
string operatingSystem = SystemInfo.operatingSystem;
_device.os = operatingSystem.IndexOf("Android OS") > -1 ? "android" : (operatingSystem.IndexOf("iPhone OS") > -1 ? "ios" : "");
// 操作系统版本号,如2.3.4
if (_device.os == "android")
{
_device.os_version = operatingSystem.Substring(10).Trim();
}
else if (_device.os == "ios")
{
_device.os_version = operatingSystem.Substring(9).Trim();
}
else
{
_device.os_version = "";
}
// 服务器名字
_device.server_name = GameCenter.LuaSystem.Adaptor.GetCurrServerName();// .ServerListSystem.GetCurrentServer().Name;
//第三方
// SDK获取的gameID
int cpgameId = 0;
if (!string.IsNullOrEmpty(SDKCacheData.CPGameId))
int.TryParse(SDKCacheData.CPGameId, out cpgameId);
_device.cpgameId = cpgameId;
// 用户设备IDAndroid系统取IMEI码iOS6.0以前系统取设备号iOS6.0及以后的系统取广告标示符IDFA -Identifier For Advertising, PC可以采用mac地址。请注意不要用MD5加密did字段
_device.cpdid = SDKCacheData.CPDid;
// 设备名称三星GT-S5830
_device.cpdevice_name = SystemInfo.deviceModel;
// 这个是设备的自定义名字
//_device.cpdevice_name = SystemInfo.deviceName;
// SDK获取的平台ID
int platformId = 0;
if (!string.IsNullOrEmpty(SDKCacheData.CPPlatformId))
int.TryParse(SDKCacheData.CPPlatformId, out platformId);
_device.cpplatformId = platformId; // SDK获取的平台ID
// 渠道账号ID
_device.cpuserid = SDKCacheData.CPUserID;
// 渠道账号名
_device.cpuserName = SDKCacheData.CPUserName;
// 游戏简称
_device.cpgameName = SDKCacheData.CPGameName;
// 游戏平台简称
_device.cpPlatformGname = SDKCacheData.CPPlatformGname;
return _device;
}
//// 具体的BI数据内部数据格式由对接人协商负责
//message ReqBi
//{
// enum MsgID { eMsgID = 185202; };
//required int32 roleId = 1; // 角色ID
// required string biName = 2; // BI数据名表名
//repeated ValMap valMaps = 3; // 数据列表key,value
//}
public void ReqBi(string biName, List<ValMap> valMaps)
{
ReqBi reqBi = new ReqBi();
reqBi.biName = biName;
int roleID = 0;
int.TryParse(SDKCacheData.RoleID, out roleID);
reqBi.roleId = roleID;
for (int i = 0; i < valMaps.Count; i++)
{
reqBi.valMaps.Add(valMaps[i]);
}
reqBi.Send();
}
public void ReqBi(string biName, string key, string value = "")
{
ReqBi reqBi = new ReqBi();
reqBi.biName = biName;
int roleID = 0;
int.TryParse(SDKCacheData.RoleID, out roleID);
reqBi.roleId = roleID;
_tempValMap.Clear();
_tempValMap.key = key;
_tempValMap.value = value;
reqBi.valMaps.Add(_tempValMap);
reqBi.Send();
}
public void ReqBi(string biName, params string[] strArr)
{
ReqBi reqBi = new ReqBi();
reqBi.biName = biName;
int roleID = 0;
int.TryParse(SDKCacheData.RoleID, out roleID);
reqBi.roleId = roleID;
int count = strArr.Length;
for (int i = 0; i < count; i += 2)
{
var _map = new ValMap();
_map.key = strArr[i];
if (i + 1 < count)
{
_map.value = strArr[i + 1];
}
else
{
_map.value = "";
}
reqBi.valMaps.Add(_map);
}
reqBi.Send();
}
//发送ui埋点
public void ReqClickEvent(int id)
{
if (DeclareBi.Get(id).IsOpen == 1)
{
if (_writePos > _clickInfoArr.Length)
{
//保存到本地
Save();
_writePos = 0;
}
_clickInfoArr[_writePos++] = id;
_clickInfoArr[_writePos++] = (int)GameCenter.HeartSystem.ServerTime;
}
}
//发送ui埋点
public void ReqAllClickEvent()
{
int playerPrefsCnt = 0;
if (PlayerPrefs.HasKey("[Bi_Count]"))
{
playerPrefsCnt = PlayerPrefs.GetInt("[Bi_Count]");
}
if (playerPrefsCnt + _writePos > 0)
{
List<UIData> uIDatas = new List<UIData>(playerPrefsCnt + _writePos);
if (_writePos > 0)
{
for (int i = 0; i < _writePos; i += 2)
{
UIData uIData = new UIData();
uIData.id = _clickInfoArr[i];
uIData.time = _clickInfoArr[i + 1];
uIDatas.Add(uIData);
}
}
if (playerPrefsCnt > 0)
{
int row = PlayerPrefs.GetInt("[Bi_DataRow]");
for (int i = 0; i < row; i++)
{
var key = string.Format("[Bi_Data{0:D3}]", i + 1);
var s = PlayerPrefs.GetString(key);
if (s != "")
{
var arr = s.Split(',');
var cnt = arr.Length;
for (int j = 0; j < cnt; j += 2)
{
UIData uIData = new UIData();
int id = -1;
int time = -1;
if (int.TryParse(arr[j], out id))
{
uIData.id = id;
}
if (int.TryParse(arr[j + 1], out time))
{
uIData.time = time;
}
if (id != -1 && time != -1)
{
uIDatas.Add(uIData);
}
}
}
PlayerPrefs.DeleteKey(key);
}
}
ReqUiBi reqUiBi = new ReqUiBi();
reqUiBi.roleId = (long)_playerPrefsRoleId;
reqUiBi.uiData = uIDatas;
reqUiBi.Send();
PlayerPrefs.SetInt("[Bi_Count]", 0);
PlayerPrefs.SetInt("[Bi_DataRow]", 0);
}
var t = GameCenter.HeartSystem.ServerTime;
_nextSaveUTCTime = t + _saveSpacingTime;
_nextReqUTCTime = t + _reqSpacingTime;
}
//保存到本地
public void Save()
{
if (_writePos > 0)
{
int cnt = _writePos;
if (PlayerPrefs.HasKey("[Bi_Count]"))
{
cnt = PlayerPrefs.GetInt("[Bi_Count]") + _writePos;
}
if (cnt >= _maxCount)
{
ReqAllClickEvent();
return;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < _writePos; i++)
{
if (i == _writePos - 1)
{
sb.Append(_clickInfoArr[i]);
}
else
{
sb.Append(_clickInfoArr[i] + ",");
}
}
int row = 0;
if (PlayerPrefs.HasKey("[Bi_DataRow]"))
{
row = PlayerPrefs.GetInt("[Bi_DataRow]");
}
PlayerPrefs.SetInt("[Bi_DataRow]", row + 1);
PlayerPrefs.SetString(string.Format("[Bi_Data{0:D3}]", row + 1), sb.ToString());
PlayerPrefs.SetInt("[Bi_Count]", cnt);
PlayerPrefs.Save();
_writePos = 0;
}
var t = GameCenter.HeartSystem.ServerTime;
_nextSaveUTCTime = t + _saveSpacingTime;
}
public void Start()
{
ReqAllClickEvent();
_isCheck = true;
}
public void Stop()
{
_isCheck = true;
}
public void Update(float dt)
{
if (_isCheck)
{
var t = GameCenter.HeartSystem.ServerTime;
if (t >= _nextSaveUTCTime)
{
Save();
}
if (t > _nextReqUTCTime)
{
ReqAllClickEvent();
}
}
}
#endregion
}
}

View File

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

9
Assets/Code/Logic/BlockingUpPrompt.meta generated Normal file
View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 74fbd706d8ac9994db4c455b178cf7bb
folderAsset: yes
timeCreated: 1477487378
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
using XLua;
namespace Thousandto.Code.Logic
{
[CSharpCallLua]
public interface IBlockingUpPromptSystem
{
bool IsRunning();
bool AddNewFunction(int type, int dataID);
}
}

View File

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

8
Assets/Code/Logic/CacheSceneSystem.meta generated Normal file
View File

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

View File

@ -0,0 +1,116 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Thousandto.Core.Asset;
using Thousandto.Core.Base;
using Thousandto.Update.Manager;
using UnityEngine;
/// <summary>
/// 场景预加载
/// </summary>
public class CacheSceneSystem
{
#region//私有变量
private bool _isLock = false;
private string _lockSceneName = string.Empty;
//已经缓存了的场景名字
private List<string> _cacheSceneNames = new List<string>();
#endregion
#region//常量
private const string CONST_STR_PREFS_KEY = "CacheSceneData";
#endregion
#region//公共函数
public void Initialize()
{
_isLock = false;
string value = string.Empty;
_cacheSceneNames.Clear();
value = PlayerPrefs.GetString(CONST_STR_PREFS_KEY, string.Empty);
if (string.IsNullOrEmpty(value))
return;
string[] array = value.Split('_');
if (array != null)
{
for (int i = 0; i < array.Length; i++)
{
string name = array[i];
_cacheSceneNames.Add(name);
}
}
}
public void UnInitialize()
{
_isLock = false;
_lockSceneName = string.Empty;
_cacheSceneNames.Clear();
}
/// <summary>
/// 预先缓存场景
/// </summary>
/// <param name="sceneName">场景名字</param>
/// <param name="action">缓存结束回调</param>
/// <param name="isUser">是否加载后使用该场景</param>
public void PreLoadSceneForCache(string sceneName, MyAction<bool> action = null)
{
if (_isLock)
return;
bool isLoading = false;
//判断是否有场景正在加载
if (isLoading)
{
action(false);
}
_isLock = true;
_lockSceneName = sceneName;
if (_cacheSceneNames.Contains(sceneName))
{
//该场景已经缓存过了 不用在load
CacheFinish();
}
else
{
SceneRootAssetsLoader.PreLoadSceneAssets(sceneName, CacheFinish);
}
}
#endregion
#region//私有函数
//缓存完成
private void CacheFinish()
{
string value = string.Empty;
if(!_cacheSceneNames.Contains(_lockSceneName))
_cacheSceneNames.Add(_lockSceneName);
//保存设置
StringBuilder sb = new StringBuilder();
for (int i = 0; i < _cacheSceneNames.Count; i++)
{
if (i == 0)
{
sb.Append(_cacheSceneNames[i]);
}
else
{
string str = string.Format("_{0}", _cacheSceneNames[i]);
sb.Append(str);
}
}
value = sb.ToString();
PlayerPrefs.SetString(CONST_STR_PREFS_KEY, value);
_lockSceneName = string.Empty;
_isLock = false;
}
#endregion
}

View File

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

5
Assets/Code/Logic/Chat.meta generated Normal file
View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: de0deee72bdf8024fae59360850e3727
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Thousandto.Code.Logic
{
/// <summary>
///聊天信息中的颜色标记
/// </summary>
public class ChatColorFlag
{
public string ColorText;
public int Left;
public int Right;
public int Len;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b7835a161e1bdba4791d88cc6e3982e9
timeCreated: 1531448470
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,134 @@
using Thousandto.Code.Center;
using Thousandto.Plugins.Common;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Thousandto.Core.RootSystem;
using Thousandto.Core.Base;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 0文字 1语音 ,这个是针对协议本身分为3种
/// </summary>
public enum ChatType
{
TEXT =0, //纯文字
AUDIO, //语音
IMG, //图片
}
/// <summary>
/// 消息频道 0世界 1帮会 2队伍 3私聊 4系统 5 小聊天窗口 6王府 7综合
/// </summary>
public enum ChatChanelType
{
WORLD = 0, //世界
GUILD, //帮会 1
TEAM, //队伍 2
PERSONAL, //私聊 3
SYSTEM, //系统 4
MINI, //小聊天框,也当做一个频道处理 5
PALACE, //王府频道 6
ALL, //综合 7
CURRENT, //当前 8
JOINTEAM, //组队 9
Live, //直播 10
Friend, //好友 11
Experience, //历练、冒险频道 12
Cross, //跨服 13
ChuanWen, //传闻 14
CH = 20, //中文 东南亚新增
EN, //英文 东南亚新增
TH, //泰文 东南亚新增
COUNT, //计数
}
// chat node type这个是消息节点类型
public enum TNodeType
{
None = -1,
Text = 0,
Player = 1,
Item = 2,
Image = 3,
Position = 4,
Equipment = 5,
Private = 6,
Audio = 7,
Team = 8,
Vip = 9,
SpaceText = 10, //占位用的,私聊中不显示,其他地方要显示占位空格
Function = 11, //功能节点,用来做点击链接的效果
BigImage = 12,
End,
All = End,
// 代码使用,不能输入
PlayerEx,
TextEx,
ImageEx, // photo mask
CMD, //GM命令
}
public enum TLabelType
{
None = -1,
Content = 0, //普通内容
Player = 1, //角色
World = 2, //世界频道
Private = 3, //私聊
Team = 4, //队伍
Guild = 5, //帮派
System = 6, //系统
Position = 7, //位置
Extra_1 = 8, //额外配置参数
Extra_2 = 9, //额外配置参数
Current = 10, //当前
JoinTeam = 11, //招募
Live = 12, //主播
Friend = 13, //好友
ChuanWen = 14, //传闻
EndID,
}
public enum TLabelColor
{
White = 1, //白
Green = 2, //绿
Blue = 3, //蓝
Purple = 4, //紫
Orange = 5, //橙
Golden = 6, //金
Red = 7, //红
EndID,
}
//坐标节点的类型这是坐标节点的Param3
public enum PositionNodeType
{
Default = 0, //默认,玩家自己发送
System_Move = 1, //系统发送, 仅移动 <t=4>1,mapID,x,y</t>
System_Trans = 2, //系统发送,可直接传送,需要判断是否能传送 <t=4>2,mapID,x,y</t>
System_CloneMapTrans = 3, //系统发送,可直接传送到副本, <t=4>3,mapId_cloneId,x,y</t>
}
//功能节点这是Function节点的Param3
public enum FuncNodeType
{
Default = 0, //默认,暂时不用
Guild_Jion = 1, //加入帮会 <t=11>1,,帮会id</t>
Tean_Jion = 2, //组队招募 <t=11>2,组队id,[自定义显示文字,可以空]</t>
ToGuildNPC = 3, //寻路到公会地图中npc <t=11>3,npcid,[自定义显示文字,可以空]</t>
FunctionStartId = 4, //触发functionStar <t=11>4,[配置表id],</t>
FightSoul = 5, //战魂,不是装备物品 <t=11>5,[配置表id],战魂名字</t>
FuDiHelp = 6, //福地支援 <t=11>6,bossId(配置表ID),[自定义显示文字,可以空]</t>
OpenUI = 7, //打开界面 <t=11>7,ID,[自定义显示文字,可以空]</t>
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 651c6c8ce9d18ab4a976a4195d1c961c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,99 @@
using System.Collections.Generic;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 用于聊天消息收发
/// </summary>
public class ChatInfo
{
public int ChatType = -1; // 消息类型
public ulong SendId = 0; // 发送人id
public string SendName = ""; // 发送人名字
public int SendVipLevel = -1; //发送人的vip等级
public ulong Receiver = 0; // 接收人id
public string ReceiverName = ""; // 接收人名字
public int RecvVipLevel = -1; // 接收人VIP类型
public string Content = ""; // 聊天消息
public int Channel = 1; //聊天频道
public int VipLevel = 0;
public int MoonardCard = 0; //月卡
public int SenderLevel = 0; //发送者等级
public int HeadId = 0; //头像ID
public int HeadFrameId = 0; //头像框ID
public string HeadPicID = string.Empty; //图片头像id
public bool ShowHeadPic = false; //是否展示图片头像
public int ChatBgId = 0; //气泡ID
public bool IsRobot = false; //是否是机器人
public int Sid = 0; //服务器id
public bool canTranslate = false; //是否可以翻译
public bool IsShowTranslate = false; //是否显示翻译后的文字
public bool IsTranslate = false; //是否是翻译
public string ReceiveTime = string.Empty; //消息接收时间
//发送者职业,默认为小学生
public int SenderOcc = 0;
//聊天面板
public object ChatPannel = null;
//是否读过
public bool IsRead = false;
//是否显示miniChat
public bool IsShowMini = true;
//一条聊天信息,包含若干字符节点
public List<ChatNode> ChatDatas = new List<ChatNode>();
//是否是系统消息
public bool IsSystemMsg
{
get
{
return Channel == (int)(ChatChanelType.SYSTEM) || Channel == (int)(ChatChanelType.ChuanWen);
}
}
private System.Action _cleanFunc = null;
public void SetCleanFunc(System.Action action)
{
_cleanFunc = action;
}
public static ChatInfo Copy(ChatInfo info)
{
ChatInfo infoCopy = new ChatInfo();
infoCopy.ChatDatas = info.ChatDatas;
infoCopy.ChatType = info.ChatType;
infoCopy.SendId = info.SendId;
infoCopy.SendName = info.SendName;
infoCopy.SendVipLevel = info.SendVipLevel;
infoCopy.Receiver = info.Receiver;
infoCopy.ReceiverName = info.ReceiverName;
infoCopy.RecvVipLevel = info.RecvVipLevel;
infoCopy.Content = info.Content;
infoCopy.MoonardCard = info.MoonardCard;
infoCopy.Channel = info.Channel;
infoCopy.VipLevel = info.VipLevel;
infoCopy.SenderOcc = info.SenderOcc;
infoCopy.SenderLevel = info.SenderLevel;
infoCopy.ChatBgId = info.ChatBgId;
infoCopy.HeadId = info.HeadId;
infoCopy.HeadFrameId = info.HeadFrameId;
infoCopy.HeadPicID = info.HeadPicID;
infoCopy.ShowHeadPic = info.ShowHeadPic;
infoCopy.IsRead = info.IsRead;
infoCopy.ReceiveTime = info.ReceiveTime;
infoCopy.canTranslate = info.canTranslate;
infoCopy.IsShowMini = info.IsShowMini;
return infoCopy;
}
public void Destroy()
{
if(_cleanFunc != null)
{
_cleanFunc();
}
}
}
}

8
Assets/Code/Logic/Chat/ChatInfo.cs.meta generated Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: de8238faa20ec714faf49bc86e6d4729
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,74 @@
using Thousandto.Code.Center;
using Thousandto.Plugins.Common;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Thousandto.Core.RootSystem;
using Thousandto.Core.Base;
using System;
using Thousandto.Cfg.Data;
using Thousandto.Core.Asset;
using Thousandto.Core.Framework;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 聊天插入面板逻辑类
/// </summary>
public class ChatInsertSystem
{
public enum ChatType
{
Expression = 1,
Item = 2,
History = 3,
}
//历史记录最大数
public const int MAX_HISTORY_COUNT = 10;
//私聊界面是否打开
public bool IsChatPrivateFormOpened = false;
public void Destroy()
{
}
/// <summary>
/// 添加聊天记录到历史数据中
/// </summary>
/// <param name="nodes"></param>
public void AddChatToHistoryData(List<ChatNode> nodes)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for(int i = 0; i < nodes.Count; ++i)
{
sb.Append(nodes[i].GetDisplayText());
}
var historyTxt = sb.ToString().Trim();
if (string.IsNullOrEmpty(historyTxt))
return;
if (GameCenter.ChatSystem.HistoryData.Count >= MAX_HISTORY_COUNT)
{
GameCenter.ChatSystem.HistoryData.RemoveAt(GameCenter.ChatSystem.HistoryData.Count - 1);
}
GameCenter.ChatSystem.HistoryData.Insert(0, nodes.ToArray());
}
//是否从大聊天框打开
public void Open(bool fromMainChatForm = true, ChatType type = ChatType.Expression)
{
IsChatPrivateFormOpened = !fromMainChatForm;
GameCenter.EventManager.PushFixEvent((int)UIEventDefine.UIChatInsertForm_OPEN, new object[] { fromMainChatForm, type });
}
public void Close()
{
GameCenter.EventManager.PushFixEvent((int)UIEventDefine.UIChatInsertForm_CLOSE);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6886a9dd2d2e2e14688a73d099cbd01f
timeCreated: 1482407273
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

8
Assets/Code/Logic/Chat/ChatNode.cs.meta generated Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 830bde58c72e797448055728b01898a7
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,204 @@
using Thousandto.Code.Center;
using Thousandto.Plugins.Common;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Thousandto.Core.RootSystem;
using Thousandto.Core.Base;
using System;
using Thousandto.Cfg.Data;
namespace Thousandto.Code.Logic
{
/// <summary>
/// UIEntergameForm的逻辑处理类
/// </summary>
public class ChatParse
{
/// <summary>
/// 解析接收到的字符串
/// </summary>
/// <param name="content">接收到的字符串</param>
/// <returns>解析后生成的节点用于创建对应的控件如UILabel、UISprite</returns>
public static List<ChatNode> ParseContent(String content, ulong specialId = 0, bool isPrivateChatNode = false)
{
List<ChatNode> nodes = new List<ChatNode>();
//以&开头是GM命令直接跳过解析
if (!content.StartsWith("<t="))
{
ChatNode node = new ChatNode();
node.isPrivateChatNode = isPrivateChatNode;
node.Type = (int)TNodeType.Text;
node.Param1 = content;
nodes.Add(node);
return nodes;
}
try
{
// node style
// ("<t={0}>{1},{2},{3}</t>", Type, Param3, Param2, Param1);
const string flag_s = "<t=";
const string flag_e = "</t>";
int s_p = 0;
int e_p = 0;
string tmp = "";
while (s_p < content.Length)
{
s_p = content.IndexOf(flag_s, e_p);
e_p = content.IndexOf(flag_e, s_p);
e_p += flag_e.Length; // + "</t>"
if (s_p < e_p)
{
ChatNode node = new ChatNode();
node.isPrivateChatNode = isPrivateChatNode;
node.specialId = specialId;
// chunk <t=type>p3,p2,p1</t>
tmp = content.Substring(s_p, e_p - s_p);
ParseNode(tmp, flag_s, flag_e, ref node);
nodes.Add(node);
}//if (s_p < e_p)
s_p = e_p + flag_e.Length; // reset start position
} // while(s_p < content.Length)
}
catch (System.Exception ex)
{
UnityEngine.Debug.LogError(ex.Message);
nodes.Clear();
ChatNode node = new ChatNode();
node.isPrivateChatNode = isPrivateChatNode;
node.Type = (int)TNodeType.Text;
node.Param1 = content;
nodes.Add(node);
}
return nodes;
}
/// <summary>
/// 解析单个字符串节点 如 <t=type>p3,p2,p1</t>
/// </summary>
/// <param name="tmp"></param>
/// <param name="flag_s"></param>
/// <param name="flag_e"></param>
/// <param name="node"></param>
static void ParseNode(string tmp, string flag_s, string flag_e, ref ChatNode node)
{
if (node != null && tmp.Length > 0)
{
int len = 0;
//<t=type>
int type_e = tmp.IndexOf(">", flag_s.Length);
if (type_e > flag_s.Length && type_e < tmp.Length)
{
//real text
len = type_e - flag_s.Length;
if (len >= 0)
{
string type = tmp.Substring(flag_s.Length, len);
node.Type = Convert.ToInt32(type);
}
else
{
node.Type = (int)TNodeType.Text;
}
}
// >p3,p2,p1<
int p3_e = tmp.IndexOf(",", type_e + 1); // ">"
if (p3_e < tmp.Length)
{
//real text
len = p3_e - type_e - 1;// 1 ">"
string p3 = len <= 0 ? "" : tmp.Substring(type_e + 1, len);
node.Param3 = p3;//Convert.ToUInt64(p2);
}
// >p3,p2,p1<
int p2_e = tmp.IndexOf(",", p3_e + 1); // ","
if (p2_e < tmp.Length)
{
//real text
len = p2_e - p3_e - 1; // 1 ">"
string p2 = len <= 0 ? "" : tmp.Substring(p3_e + 1, len);
node.Param2 = p2;//Convert.ToUInt64(p2);
}
// >p3,p2,p1<
{
//real text
len = tmp.Length - flag_e.Length - (p2_e + 1); // 1 ","
node.Param1 = len <= 0 ? "" : tmp.Substring(p2_e + 1, len);
}
switch (node.Type)
{
case (int)TNodeType.Equipment:
node.ItemParam = ItemBase.ToItemBase(node.Param3);
if (node.ItemParam != null)
{
node.Param1 = DeclareMessageString.Format(DeclareMessageString.C_CHAT_ITEMEQUIP_LINK, node.ItemParam.Name);
}
break;
case (int)TNodeType.Item:
int itemId = 0;
if(int.TryParse(node.Param2, out itemId))
{
node.ItemParam = ItemBase.CreateItemBase(itemId, true);
if (node.ItemParam != null)
{
node.Param1 = DeclareMessageString.Format(DeclareMessageString.C_CHAT_ITEMEQUIP_LINK, node.ItemParam.Name);
}
}
else
{
node.Param1 = string.Empty;
}
break;
case (int)TNodeType.Function:
node.Param1 = GameCenter.LanguageConvertSystem.ConvertLan(node.Param1);
break;
}
}
}
/// <summary>
/// 将结构转成纯字符串,便于发送
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
public static string GetTransferContent(List<ChatNode> msg, bool isPrivateChatNode = false)
{
string content = "";
for (int i = 0; i < msg.Count; ++i)
{
if (isPrivateChatNode)
{
if (msg[i].isPrivateChatNode)
{
content += msg[i].GetTransferText();
}
}
else
{
content += msg[i].GetTransferText();
}
}
return content;
}
public void OnInputChange()
{
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e46ac00b88869c94fa13f34e18ba4276
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,28 @@
using Thousandto.Code.Center;
using Thousandto.Plugins.Common;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Thousandto.Core.RootSystem;
using Thousandto.Core.Base;
using System.Text;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 私聊名字面板数据
/// </summary>
public class ChatPrivateInfo
{
public ulong ID; //角色id
public string Name; //角色名
public ulong SendId;//发送者id
public int Occ;//职业
public int Level;//等级
public bool HasUnReadMsg; //有未读消息
public bool IsOnline;
public string ReceiveTime = string.Empty; //接收时间
public bool IsTranslate = false; //是否是翻译
public bool IsNPC = false; //是否是npc好友
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a739f902d2dd2ae4e900e07243d41faf
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,218 @@
using Thousandto.Code.Center;
using Thousandto.Plugins.Common;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Thousandto.Core.RootSystem;
using Thousandto.Core.Base;
using Thousandto.Code.Global;
using Thousandto.Cfg.Data;
namespace Thousandto.Code.Logic
{
public class ChatPrivateSystem
{
//私聊数据, <角色ID 聊天数据>
public Dictionary<ulong, List<ChatInfo>> PrivateChatDatas = new Dictionary<ulong, List<ChatInfo>>();
private List<ChatInfo> _cacheTranslateInfos = new List<ChatInfo>(100);
//私聊窗口是否打开着
//public bool IsOpen = false;
//当前聊天玩家PlayerID
public ulong currentChatPlayerId = 0;
public int RemovedChatNodeCount = 0;
private double _cd = 4f;
private double _nextTime = 0;
// 当前私聊的玩家
private ChatPrivateInfo _currentChatPlayerInfo = new ChatPrivateInfo();
public ChatPrivateInfo CurrentChatPlayerInfo
{
get
{
return _currentChatPlayerInfo;
}
set
{
_currentChatPlayerInfo = value;
}
}
public void Initialize()
{
_cd = float.Parse(DeclareGlobal.Get((int)GlobalName.Private_Chat_Interval).Params)*0.001f + 0.5f;
}
//发起私聊
public void ChatToPlayer(ulong id, string name, int career, int level, bool online, object parent , bool isNPC = false)
{
ChatPrivateInfo info = new ChatPrivateInfo()
{
ID = id,
Name = name,
Occ = career,
Level = level,
IsOnline = online,
IsNPC = isNPC,
};
GameCenter.PushFixEvent((int)UIEventDefine.UICHATPRIVATEFORM_OPEN, info, parent);
}
//保存翻译数据
public void CacheTranslateInfo(ChatInfo info)
{
if (info == null)
return;
bool isFind = false;
for (int i = 0; i < _cacheTranslateInfos.Count; i++)
{
var data = _cacheTranslateInfos[i];
if (data != null)
{
if (data.ReceiveTime == info.ReceiveTime)
{
isFind = true;
}
}
}
if (!isFind)
{
if (_cacheTranslateInfos.Count > 99)
{
_cacheTranslateInfos.RemoveAt(0);
}
_cacheTranslateInfos.Add(info);
}
}
public ChatInfo GetTranslateInfo(string time)
{
ChatInfo info = null;
for (int i = 0; i < _cacheTranslateInfos.Count; i++)
{
var data = _cacheTranslateInfos[i];
if (data != null)
{
if (data.ReceiveTime == time)
{
info = data;
}
}
}
return info;
}
//将私聊数据放到缓存
public void CachePrivateData(ChatInfo info, ulong id)
{
info = ChatInfo.Copy(info);
if (PrivateChatDatas.ContainsKey(id))
{
if (PrivateChatDatas[id].Count >= ChatSystem.MAX_MSG_COUNT)
{
ChatInfo infos = PrivateChatDatas[id][0];
RemovedChatNodeCount++;
PrivateChatDatas[id].RemoveAt(0);
}
PrivateChatDatas[id].Add(info);
}
else
{
List<ChatInfo> chatDatas = new List<ChatInfo>();
chatDatas.Add(info);
PrivateChatDatas.Add(id, chatDatas);
}
}
// 获取player最后一条聊天信息
public ChatInfo GetLastestChat(ulong player)
{
if (!PrivateChatDatas.ContainsKey(player))
{
return null;
}
List<ChatInfo> allDatas = PrivateChatDatas[player];
ChatInfo latestChat = allDatas[allDatas.Count - 1];
return latestChat;
}
//获取玩家当前聊天数量
public int GetChatCount(ulong player)
{
if (!PrivateChatDatas.ContainsKey(player))
{
return 0;
}
List<ChatInfo> allDatas = PrivateChatDatas[player];
return allDatas.Count;
}
//获取剩余cd时间
public double GetCD()
{
return _nextTime - GameCenter.HeartSystem.ServerTime;
}
public bool SendMessage(ChatInfo info)
{
if(GameCenter.HeartSystem.ServerTime >= _nextTime)
{
_nextTime = GameCenter.HeartSystem.ServerTime + _cd;
GameCenter.ChatSystem.SendMessage(info, true);
return true;
}
else
{
GameCenter.MsgPromptSystem.ShowPrompt(string.Format(DeclareMessageString.Get(DeclareMessageString.ChatColding), Mathf.Ceil((float)(_nextTime - GameCenter.HeartSystem.ServerTime))));
return false;
}
}
// 是否有未读消息
public bool IsHasUnReadMessage(ulong playerId)
{
List<ChatInfo> list = null;
if (PrivateChatDatas.TryGetValue(playerId, out list))
{
foreach (var item in list)
{
if (!item.IsRead)
{
return true;
}
}
}
return false;
}
// 检测红点
public void CheckRedPointShow()
{
GameCenter.RedPointSystem.CleraFuncCondition(FunctionStartIdCode.Friend);
var iter = PrivateChatDatas.GetEnumerator();
try
{
while(iter.MoveNext())
{
for(int i = 0; i < iter.Current.Value.Count; ++i)
{
if(!iter.Current.Value[i].IsRead)
{
GameCenter.RedPointSystem.AddFuncCondition(FunctionStartIdCode.Friend, 0, new RedPointCustomCondition(true));
return;
}
}
}
}
finally
{
iter.Dispose();
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9edfe953d2ade004da524284626845f8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c0f77d52a1afde4cac76163ad8e52d3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 61c5c2683cf7ffe40a58e58a25845416
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,324 @@
//using MoPhoGames.USpeak.Core;
using System.Collections.Generic;
using Thousandto.Code.Center;
using Thousandto.Core.Asset;
using Thousandto.Core.Base;
using UnityEngine;
namespace Thousandto.Code.Logic
{
/// <summary>
/// UIEntergameForm的逻辑处理类
/// </summary>
public partial class ChatSystem
{
public const int MAX_RECORD_DURATION = 15; //最长录音时间
public int VoiceIndex; //接收到的语音序列从0开始增加
public int LocalVoiceIndex; //本人发送的语音,发送时就计算序列
public MyAction _action; //回调
public MonoBehaviour Coro; //用于启动协程,每次打开聊天窗的时候赋值
private bool _recording; //是否正在录音
private float MinLenght = 1.0f; //最短有效录音
private int _audioLength; //录音时长
private AudioClip _audioClip;
private byte[] _compressedRecordData;
//通常的无损音质的采样率是44100即每秒音频用44100个float数据表示但是语音只需8000通常移动电话是8000就够了
//不然音频数据太大,不利于传输和存储
public const int SamplingRate = 8000;
public AudioSource ChatAudioSource;
private Dictionary<int, byte[]> _voiceDataDic = new Dictionary<int, byte[]>();
private Dictionary<string, string> _voiceKeyToVoiceData = new Dictionary<string, string>();
#region
public void StartRecord()
{
_audioLength = 0;
_compressedRecordData = null;
_recording = true;
StopPlayingAudio();
SuspendAllSound();
//GameCenter.UniSoundSystem.SuspendSystem();
//按钮按下开始录音
//Microphone.End(null);//这句可以不需要,但是在开始录音以前调用一次是好习惯
//string[] micDevices = Microphone.devices;
//for (int i = 0; micDevices != null && i < micDevices.Length; ++i)
//{
// UnityEngine.Debug.LogError("话筒: " + micDevices[i]);
//}
_audioClip = null;
//_audioClip = Microphone.Start(null, false, MAX_RECORD_DURATION, SamplingRate);
}
//是否正在录音
public bool IsRecording()
{
return _recording;
}
public void EndRecord()
{
/*
//按钮弹起结束录音
int audioLength;//录音的长度单位为秒ui上可能需要显示
int lastPos = Microphone.GetPosition(null);
if (Microphone.IsRecording(null))
{
//录音小于10秒
audioLength = lastPos / SamplingRate;//录音时长
}
else
{
audioLength = MAX_RECORD_DURATION;
}
Microphone.End(null);//此时录音结束clip已可以播放了
ResumeAllSound();
//GameCenter.UniSoundSystem.ResumeSystem();
if (audioLength < MinLenght) return;//录音小于2秒就不处理了
int samples = 0;
_compressedRecordData = null;// USpeakAudioClipCompressor.CompressAudioClip(_audioClip, out samples, BandMode.Narrow);
//_audioClip = null;
_audioLength = audioLength;
_recording = false;
*/
}
public void SuspendAllSound()
{
if (GameCenter.GameSetting.GetSetting(GameSettingKeyCode.EnableBGMusic) != 0)
{
AudioPlayer.SetVolume(AudioTypeCode.Music, 0f);
}
if (GameCenter.GameSetting.GetSetting(GameSettingKeyCode.EnableSound) != 0)
{
AudioPlayer.SetVolume(AudioTypeCode.Sfx, 0f);
AudioPlayer.SetVolume(AudioTypeCode.Ambient, 0f);
AudioPlayer.SetVolume(AudioTypeCode.Speech, 0f);
AudioPlayer.SetVolume(AudioTypeCode.UI, 0f);
}
}
public void ResumeAllSound()
{
if (GameCenter.GameSetting.GetSetting(GameSettingKeyCode.EnableBGMusic) != 0)
{
float v = (float)GameCenter.GameSetting.GetSetting(GameSettingKeyCode.BGMusicVolume)/100f;
AudioPlayer.SetVolume(AudioTypeCode.Music, v);
}
if (GameCenter.GameSetting.GetSetting(GameSettingKeyCode.EnableSound) != 0)
{
float v = (float)GameCenter.GameSetting.GetSetting(GameSettingKeyCode.SoundVolume) / 100f;
AudioPlayer.SetVolume(AudioTypeCode.Sfx, v);
AudioPlayer.SetVolume(AudioTypeCode.Ambient, v);
AudioPlayer.SetVolume(AudioTypeCode.Speech, v);
AudioPlayer.SetVolume(AudioTypeCode.UI, v);
}
}
public void SendRecord(ChatInfo info)
{
if (_recording)
{
EndRecord();
}
LocalVoiceIndex = ++VoiceIndex;
addVoiceDataToCache(LocalVoiceIndex, _compressedRecordData);
string content = byteToString(_compressedRecordData);
MSG_Chat.ChatReqCS req = new MSG_Chat.ChatReqCS();
req.chattype = info.ChatType;
req.recRoleId = info.Receiver;
req.condition = content;
req.voiceLen = _audioLength;
req.chatchannel = info.Channel;
req.Send();
//UnityEngine.Debug.LogError("录音时长:" + _audioLength);
//UnityEngine.Debug.LogError("录音数据长度:" + _compressedRecordData.Length);
}
#endregion
#region
//是否有语音在播放
public bool IsAudioPlaying()
{
if (ChatAudioSource != null)
{
return ChatAudioSource.isPlaying;
}
return false;
}
//关闭正在播放的语音
public void StopPlayingAudio()
{
if (ChatAudioSource != null && ChatAudioSource.isPlaying)
{
ChatAudioSource.Stop();
}
}
// method
public bool PlayAudio(byte[] data, AudioSource audioSrc)
{
if (audioSrc == null)
{
return false;
}
audioSrc.clip = null;
AudioClip clip = null;// USpeakAudioClipCompressor.DecompressAudioClip(data, 0, 1, false, BandMode.Narrow, 1.0f);
// play test
audioSrc.clip = clip;
audioSrc.Play();
SuspendAllSound();
//GameCenter.UniSoundSystem.SuspendSystem();
return true;
}
#endregion
#region
public void OnFormClose()
{
//关闭窗体时,关闭语音,并且恢复背景声音
if (IsAudioPlaying())
{
StopPlayingAudio();
}
ResumeAllSound();
//GameCenter.UniSoundSystem.ResumeSystem();
}
#endregion
#region
//添加聊天数据到缓存中保存
private void addVoiceDataToCache(int index, byte[] data)
{
//超30个就remove
if (_voiceDataDic.Count >= 30)
{
var itor = _voiceDataDic.Keys.GetEnumerator();
itor.MoveNext();
int key = itor.Current;
_voiceDataDic.Remove(key);
//在_voiceKeyToVoiceData中去移除对应的key
var itor2 = _voiceKeyToVoiceData.GetEnumerator();
string keyStr = "" + key;
while (itor2.MoveNext())
{
if (itor2.Current.Value == keyStr)
{
_voiceKeyToVoiceData.Remove(itor2.Current.Key);
break;
}
}
}
else
{
if (_voiceDataDic.ContainsKey(index))
{
_voiceDataDic[index] = data;
}
else
_voiceDataDic.Add(index, data);
}
}
private string byteToString(byte[] voiceData)
{
char[] charArray = new char[voiceData.Length];
for (int i = 0; i < voiceData.Length; ++i)
{
charArray[i] = (char)voiceData[i];
}
string str = new string(charArray);
return str;
}
private byte[] stringToBytes(string str)
{
char[] charArray = str.ToCharArray();
byte[] data = new byte[charArray.Length];
for (int i = 0; i < charArray.Length; ++i)
{
data[i] = (byte)charArray[i];
}
return data;
}
#endregion
#region
public void ReqVoiceData(string key, MyAction action)
{
_action = action;
if (_voiceKeyToVoiceData.ContainsKey(key))
{
int voiceIndexKey = int.Parse(_voiceKeyToVoiceData[key]);
if (_voiceDataDic.ContainsKey(voiceIndexKey))
{
PlayAudio(_voiceDataDic[voiceIndexKey], ChatAudioSource);
if (_action != null)
_action();
return;
}
}
MSG_Chat.ChatGetContentCS reqVoice = new MSG_Chat.ChatGetContentCS();
reqVoice.key = key;
reqVoice.Send();
}
#endregion
#region
public void GS2U_ChatGetContentSC(MSG_Chat.ChatGetContentSC result)
{
byte[] voiceData = stringToBytes(result.voice);
//有保存,重置数据
if (_voiceKeyToVoiceData.ContainsKey(result.voiceKey))
{
int index = int.Parse(_voiceKeyToVoiceData[result.voiceKey]);
addVoiceDataToCache(index, voiceData);
}
PlayAudio(voiceData, ChatAudioSource);
if (_action != null)
_action();
//CoroutinePool.AddTask(playAudioIE(obj, this));
}
public void TestOnChatVoiceReceive(int channel, int voiceID, int length)
{
//Audio: m_param1 = key; m_param2 = length m_param3 = ""
ChatNode node = new ChatNode();
node.ChannelID = channel;
node.Param1 = "" + voiceID;
node.Param2 = "" + length;
node.Param3 = null;
}
#endregion
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b9249fb817e279148ba3fa1cf0e6e4e0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 生产者消费者模型线程池
/// </summary>
public class ChatThreadPool
{
//处理函数,处理数据
public delegate void HandleFunc(MSG_Chat.ChatResSC nodes);
//处理完成回调
public delegate MSG_Chat.ChatResSC FinishCallback();
//待处理的数据
private Queue<MSG_Chat.ChatResSC> _dataQueue;
//是否工作
private bool _working;
//线程个数
private int _threadNum = 1;
//处理函数
private HandleFunc _handleFunc;
//完成回调
private FinishCallback _finishCallback;
private List<Thread> _threadList;
//构造函数
public ChatThreadPool()
{
_working = true;
_dataQueue = new Queue<MSG_Chat.ChatResSC>();
_threadList = new List<Thread>();
//创建线程
for (int i = 0; i < _threadNum; ++i)
{
Thread workThread = new Thread(workFactory);
workThread.IsBackground = true;
workThread.Start();
_threadList.Add(workThread);
}
}
public void Destory()
{
_working = false;
_dataQueue.Clear();
_threadList.Clear();
}
public void SetHandleFunc(HandleFunc func)
{
_handleFunc = func;
}
public void SetFinishFunc(FinishCallback func)
{
_finishCallback = func;
}
/// <summary>
/// 是否有线程存活
/// </summary>
/// <returns></returns>
public bool Running()
{
for (int i = 0; i < _threadList.Count; ++i)
{
if (_threadList[i].IsAlive)
{
return true;
}
}
return false;
}
/// <summary>
/// 放入数据
/// </summary>
/// <param name="data"></param>
public void AddData(MSG_Chat.ChatResSC data)
{
_dataQueue.Enqueue(data);
}
/// <summary>
/// 线程取数据
/// </summary>
/// <returns></returns>
private MSG_Chat.ChatResSC getData()
{
lock (_dataQueue)
{
if (_dataQueue != null && _dataQueue.Count > 0)
{
return _dataQueue.Dequeue();
}
return null;
}
}
private void workFactory()
{
while (_working)
{
Thread.Sleep(100);
MSG_Chat.ChatResSC data = getData();
if (_handleFunc != null)
{
_handleFunc(data);
}
if (_finishCallback != null)
{
_finishCallback();
}
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3af24cd959282c04ebbe280eda164be8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using Thousandto.Core.Base;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 用于logic代码和UI代码中间转换避免logic代码直接使用NGUI的内容
/// </summary>
public interface IChatNodeTool
{
bool AddCommponentToGO(ChatNode node, MyAction<GameObject> eventFunc = null, bool enableClick = true);
void PlayAnim(ChatNode node);
void StopAnim();
void Destory();
MonoBehaviour CopyLabelProperty(MonoBehaviour from, MonoBehaviour to);
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ab3e4c4053a214e4fb5e9f72e832cd67
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 用于logic代码和UI代码中间转换避免logic代码直接使用NGUI的内容
/// </summary>
public interface IChatSystemTool
{
IEnumerable<ChatNode> calcMutiLine(int channel, IEnumerable<ChatNode> nodes, object label, int maxLineWidth);
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 88142e2524858d54e9abca5a55baae66
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,199 @@
using Thousandto.Code.Center;
using Thousandto.Code.Logic;
using Thousandto.Core.Base;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 一句聊天内容包含多个ChatNode这个类就是管理这些ChatNode的
///
/// </summary>
public class OneTalkManager
{
public int CurrentChannel { get; set; }
public GameObject Label { get; set; }
public bool HasSetClickEvent { get; set; }
private Dictionary<int, Dictionary<ChatNode, List<Rect>>> _dataDic = new Dictionary<int, Dictionary<ChatNode, List<Rect>>>();
public OneTalkManager()
{
}
/// <summary>
/// 添加ChatNode对应的Rect范围用于点击UILabel获取到坐标判断是否落在Rect范围
/// </summary>
/// <param name="node"></param>
/// <param name="rect"></param>
public void AddNode(int chatChannel, ChatNode node, Rect rect)
{
CurrentChannel = chatChannel;
int channel = chatChannel;
if (_dataDic.ContainsKey(channel))
{
Dictionary<ChatNode, List<Rect>> nodeToRectDic = _dataDic[channel];
if (!nodeToRectDic.ContainsKey(node))
{
List<Rect> rectList = new List<Rect>();
rectList.Add(rect);
nodeToRectDic.Add(node, rectList);
}
else
{
nodeToRectDic[node].Add(rect);
}
}
else
{
List<Rect> rectList = new List<Rect>();
rectList.Add(rect);
Dictionary<ChatNode, List<Rect>> nodeToRectDic = new Dictionary<ChatNode, List<Rect>>();
nodeToRectDic.Add(node, rectList);
_dataDic.Add(channel, nodeToRectDic);
}
}
//返回当前聊天内容中所有的ChatNode节点
public List<ChatNode> GetChatNodeByChannel(int channel)
{
if (!_dataDic.ContainsKey(channel))
{
return null;
}
Dictionary<ChatNode, List<Rect>> nodeRectDic = _dataDic[channel];
List<ChatNode> nodeList = new List<ChatNode>();
var itor = nodeRectDic.Keys.GetEnumerator();
while (itor.MoveNext())
{
nodeList.Add(itor.Current);
}
return nodeList;
}
/// <summary>
/// 获取带img的节点, 包括表情、vip、语音图片
/// </summary>
/// <param name="channel"></param>
/// <returns></returns>
public List<ChatNode> GetImageChatNode(int channel)
{
List<ChatNode> imgNodes = new List<ChatNode>();
List<ChatNode> nodes = GetChatNodeByChannel(channel);
for (int i = 0; nodes != null && i < nodes.Count; ++i)
{
if (nodes[i].Type == (int)TNodeType.Image ||
nodes[i].Type == (int)TNodeType.BigImage ||
nodes[i].Type == (int)TNodeType.ImageEx ||
nodes[i].Type == (int)TNodeType.Vip ||
nodes[i].Type == (int)TNodeType.Audio)
{
imgNodes.Add(nodes[i]);
}
}
return imgNodes;
}
public void OnClick(GameObject go)
{
//20180327-yuqiang-屏蔽掉打开不能发言的频道
var keyItor = _dataDic[CurrentChannel].Keys.GetEnumerator();
keyItor.MoveNext();
if (keyItor.Current.ChannelID != (int)ChatChanelType.JOINTEAM &&
keyItor.Current.ChannelID != (int)ChatChanelType.Experience)
{
GameCenter.ChatSystem.Open(keyItor.Current.ChannelID);
}
else
GameCenter.ChatSystem.Open();
return;
{
//获取屏幕坐标
Vector3 mScreenPos = Input.mousePosition;
//定义射线
Ray mRay = GameCenter.ChatSystem.UICamera.ScreenPointToRay(mScreenPos);
RaycastHit[] hits = Physics.RaycastAll(mRay);
for (int i = 0; hits != null && i < hits.Length; ++i)
{
if (hits[i].collider.gameObject == Label)
{
Vector3 tPos = hits[i].point;
Vector3 lPos = go.transform.InverseTransformPoint(tPos);
if (!_dataDic.ContainsKey(CurrentChannel))
{
return;
}
Dictionary<ChatNode, List<Rect>> nodeToRectDir = _dataDic[CurrentChannel];
var itor = nodeToRectDir.GetEnumerator();
float x = 0;
float y = 0;
float width = 0;
float height = 0;
int line = 0;
while (itor.MoveNext())
{
ChatNode node = itor.Current.Key;
//表情跳过
if (node.Type == (int)TNodeType.Image || node.Type == (int)TNodeType.BigImage || node.Type == (int)TNodeType.ImageEx || node.Type == (int)TNodeType.Vip)
{
continue;
}
List<Rect> rectList = itor.Current.Value;
//换行了
if (line != node.Line)
{
x = 0;
line = node.Line;
}
y = -(node.Height * (node.Line));
width = node.Width;
height = node.Height;
for (int m = 0; m < rectList.Count; ++m)
{
if (x <= lPos.x &&
y >= lPos.y &&
x + width >= lPos.x &&
y - height <= lPos.y)
{
if (node.GO == null)
{
node.TriggerClick(go);
}
else
node.TriggerClick(node.GO);
return;
}
}
x += node.Width;
}
}
}
}
}
public void Destory()
{
if (Label != null)
{
GameObject.Destroy(Label);
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c97df37f6ffb2f24c961568b7c8a9463
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,270 @@

using Thousandto.Cfg.Data;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using Thousandto.Core.Base;
using System;
using Thousandto.Code.Center;
using PathUtils = UnityEngine.Gonbest.MagicCube.PathUtils;
using FFileReader = UnityEngine.Gonbest.MagicCube.FFileReader;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 新的敏感字过滤系统
/// </summary>
public static class WordFilter
{
#region//私有变量
private static Dictionary<char, List<string>> _firstCharDic = null;
private static bool _isLoad = false;
private static List<string> _serverForbidList = null;
private static List<int> _replaceIndexs = new List<int>(128);
private static Dictionary<char, bool> _ignoreDic = null;
#endregion
#region//公有函数
public static void BuildFilter()
{
if (_firstCharDic != null)
{
return;
}
_isLoad = false;
//加载一次数据
var loadThread = new Thread(LoadThread);
loadThread.Start();
}
//替换关键字
public static string ReplaceKeyWords(string text)
{
if (!_isLoad || _firstCharDic == null)
{
return text;
}
if (string.IsNullOrEmpty(text))
{
return text;
}
var charArray = text.ToCharArray();
List<string> tmpList = null;
List<char> notFindedCharList = new List<char>(charArray.Length);
bool changed = false;
for (int i = 0; i < charArray.Length; ++i)
{
if (!notFindedCharList.Contains(charArray[i]))
{
if (_firstCharDic.TryGetValue(charArray[i], out tmpList))
{
bool finded = false;
for (int j = 0; j < tmpList.Count; ++j)
{
var offStr = tmpList[j];
if(Replace(charArray, i, offStr))
{
finded = true;
changed = true;
break;
}
}
if (!finded)
{
notFindedCharList.Add(text[i]);
}
}
}
}
if (changed)
{
for(int i = 0; i < charArray.Length; ++i)
{
if(charArray[i] == '&')
{
charArray[i] = '*';
}
}
text = new string(charArray);
}
else if(text.IndexOf('&') >= 0)
{
text = text.Replace('&', '*');
}
if (_serverForbidList != null)
{
for (int i = 0; i < _serverForbidList.Count; ++i)
{
if (text.Contains(_serverForbidList[i]))
{
text = text.Replace(_serverForbidList[i], GetStarByCount(_serverForbidList[i].Length));
}
}
}
return text;
}
//是否包含敏感词
public static bool IsContainsSensitiveWord(string orgStr)
{
if (!_isLoad || _firstCharDic == null)
{
return false;
}
string replacedStr = ReplaceKeyWords(orgStr);
var result = (replacedStr == orgStr) ? false : true;
//UnityEngine.Debug.LogErrorFormat("WorldFilter:RealStr:{0}-------ReplaceStr:{1}", orgStr, replacedStr);
if (_serverForbidList != null)
{
for (int i = 0; i < _serverForbidList.Count; ++i)
{
if(replacedStr.Contains(_serverForbidList[i]))
{
result = true;
break;
}
}
}
return result;
}
//服务器操作屏蔽字列表
public static void ResForbidWord(MSG_Chat.ResForbidWord result)
{
if (result.wordList == null || result.wordList.Count <= 0)
{
return;
}
//0上线推送1增加2删除
if (result.type == 0)
{
_serverForbidList = new List<string>(result.wordList.Count);
for (int i = 0; i < result.wordList.Count; ++i)
{
_serverForbidList.Add(result.wordList[i]);
}
}
else if (result.type == 1)
{
if (_serverForbidList == null)
{
_serverForbidList = new List<string>(result.wordList.Count);
}
for (int i = 0; i < result.wordList.Count; ++i)
{
if (!_serverForbidList.Contains(result.wordList[i]))
{
_serverForbidList.Add(result.wordList[i]);
}
}
}
else if (result.type == 2)
{
if (_serverForbidList == null)
{
return;
}
for (int i = 0; i < result.wordList.Count; ++i)
{
_serverForbidList.Remove(result.wordList[i]);
}
}
GameCenter.PushFixEvent(Global.LogicEventDefine.EID_SERVER_FORBID_TEXT_CHANGED);
}
#endregion
#region//私有函数
private static void LoadThread()
{
var fullPath = PathUtils.GetConfigFilePath("Offstring.bytes");
FFileReader.ReadBytesAsync(fullPath, bytes => {
if (bytes != null)
{
int readLen = 0;
var count = BitConverter.ToInt32(bytes, readLen);
readLen += 4;
var firstCharCount = BitConverter.ToInt32(bytes, readLen);
readLen += 4;
_firstCharDic = new Dictionary<char, List<string>>(firstCharCount);
for (int i = 0; i < count; ++i)
{
if (readLen >= bytes.Length)
break;
UInt16 len = BitConverter.ToUInt16(bytes, readLen);
readLen += 2;
string tmpStr = System.Text.Encoding.Unicode.GetString(bytes, readLen, len);
readLen += len;
var firstChar = tmpStr[0];
List<string> tmpList = null;
if (!_firstCharDic.TryGetValue(firstChar, out tmpList))
{
int fistCharCount = BitConverter.ToInt32(bytes, readLen);
readLen += 4;
tmpList = new List<string>(fistCharCount);
_firstCharDic.Add(firstChar, tmpList);
}
tmpList.Add(tmpStr);
}
}
_isLoad = true;
});
}
private static StringBuilder _tmpBuilder = new StringBuilder(64);
private static string GetStarByCount(int count)
{
_tmpBuilder.Length = 0;
for (int i = 0; i < count; ++i)
{
_tmpBuilder.Append('*');
}
return _tmpBuilder.ToString();
}
private static bool Replace(char[] array, int startIndex, string offStr)
{
if (offStr.Length <= 0)
return false;
if (array.Length < startIndex + offStr.Length)
return false;
int offStrIndex = 0;
_replaceIndexs.Clear();
if (_ignoreDic == null)
{
_ignoreDic = new Dictionary<char, bool>();
string ignoreStr = GameCenter.LuaSystem.Adaptor.GetWordFilterIngore();
for (int i = 0; i < ignoreStr.Length; i++)
{
_ignoreDic[ignoreStr[i]] = true;
}
}
for (int i = startIndex; i < array.Length; i++)
{
char c = array[i];
if (_ignoreDic.ContainsKey(c))
{
continue;
}
if (array[i] != offStr[offStrIndex])
{
return false;
}
_replaceIndexs.Add(i);
offStrIndex += 1;
if (offStrIndex >= offStr.Length)
{
break;
}
}
if (offStrIndex == offStr.Length)
{
//全部匹配
for (int i = 0; i < _replaceIndexs.Count; i++)
{
array[_replaceIndexs[i]] = '*';
}
}
return true;
}
#endregion
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 130b45e4482c55c449882ea546f7a957
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

9
Assets/Code/Logic/DropAscription.meta generated Normal file
View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 94b51086c8dcb8a439ca411379eda1e0
folderAsset: yes
timeCreated: 1508236170
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,104 @@
using Thousandto.Code.Center;
using Thousandto.Code.Global;
using System.Collections.Generic;
namespace Thousandto.Code.Logic
{
//掉落归属系统
public class DropAscriptionSystem
{
#region//私有变量
private Dictionary<ulong, Dictionary<ulong, int>> _playerDropMonsters = new Dictionary<ulong, Dictionary<ulong, int>>();
private Dictionary<ulong, ulong> _monsterTopRankPlayer = new Dictionary<ulong, ulong>();
#endregion
#region//函数
//改变消息
public void UpdateMonsterDropOwners(ulong monsterID, List<long> owners)
{
if(owners == null || owners.Count <= 0)
{
_monsterTopRankPlayer.Remove(monsterID);
}
else
{
_monsterTopRankPlayer[monsterID] = (ulong)owners[0];
}
//先移除这个monster的所有数据
var removeList = new List<ulong>(_playerDropMonsters.Count);
var iterPlayer = _playerDropMonsters.GetEnumerator();
while (iterPlayer.MoveNext())
{
var valueDic = iterPlayer.Current.Value;
if (valueDic.ContainsKey(monsterID))
{
valueDic.Remove(monsterID);
}
if (valueDic.Count <= 0)
{
//此玩家已经不在任何列表了,移除他
removeList.Add(iterPlayer.Current.Key);
}
}
for (int i = 0; i < removeList.Count; ++i)
{
_playerDropMonsters.Remove(removeList[i]);
}
if (owners != null && owners.Count > 0)
{
//重新设置这个monster的所有数据只需要前三个目标数据
for (int i = 0; i < owners.Count && i < 3; ++i)
{
Dictionary<ulong, int> curMonsterDic = null;
if(!_playerDropMonsters.TryGetValue((ulong)owners[i], out curMonsterDic))
{
curMonsterDic = new Dictionary<ulong, int>();
_playerDropMonsters.Add((ulong)owners[i], curMonsterDic);
}
curMonsterDic[monsterID] = i;
}
}
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_HUD_UPDATE_DROPINFO);
}
//获取玩家最高排名
public int GetPlayerMaxRank(ulong roleID, out ulong monsterId)
{
int result = int.MaxValue;
monsterId = 0;
Dictionary<ulong, int> curMonsterDic = null;
if(_playerDropMonsters.TryGetValue(roleID, out curMonsterDic))
{
var iter = curMonsterDic.GetEnumerator();
try
{
while(iter.MoveNext())
{
if(iter.Current.Value < result)
{
monsterId = iter.Current.Key;
result = iter.Current.Value;
}
}
}
finally
{
iter.Dispose();
}
}
return result;
}
//获取第一名的玩家id
public ulong GetRankTopPlayerID(ulong monsterID)
{
ulong result = 0;
_monsterTopRankPlayer.TryGetValue(monsterID, out result);
return result;
}
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8b650cd8b99fcac4ca7a323a01047181
timeCreated: 1508236170
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Code/Logic/Equipment.meta generated Normal file
View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2d58875d553efc24bb04ee8812d154c6
folderAsset: yes
timeCreated: 1476414720
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,52 @@
//资质比计算类,用于计算装备资质比
using Thousandto.Cfg.Data;
using Thousandto.Code.Global;
using MSG_backpack;
using System;
using System.Collections.Generic;
namespace Thousandto.Code.Logic
{
public class EquipQuality
{
private bool _isInit = false;
private static EquipQuality instance = new EquipQuality();
private Dictionary<int, Key_Value> equipQua = new Dictionary<int, Key_Value>();
private void OnInit()
{
_isInit = true;
var global = DeclareGlobal.Get(1050);
var stts = global.Params.Split(GameDefine.SplitSemicolon, StringSplitOptions.RemoveEmptyEntries);
for(int i = 0; i < stts.Length; i++)
{
var attrs = stts[i].Split(GameDefine.SplitUnderline, StringSplitOptions.RemoveEmptyEntries);
if(attrs.Length == 3)
{
int iType = int.Parse(attrs[0]);
int baseAttr = int.Parse(attrs[1]);
int growAttr = int.Parse(attrs[2]);
Key_Value value = new Key_Value();
value.key = baseAttr;
value.value = growAttr;
equipQua.Add(iType, value);
}
}
}
public static float GetQualityNum(int iType, ulong Num)
{
if(!instance._isInit)
{
instance.OnInit();
}
float qualityNum = 0;
if(Num > (ulong)instance.equipQua[iType].value)
{
qualityNum = (float)(Num - (ulong)instance.equipQua[iType].value) / instance.equipQua[iType].key * 10;
}
return qualityNum;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e356cd9c2fd2ef34babaa80d1ae11fad
timeCreated: 1478070130
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,55 @@
//**********************************************//
//作者:#何健#
//日期:#2017.01.09#
//简述:#用于打开装备界面时,传入分页及装备数据#
//*********************************************//
using UnityEngine;
using Thousandto.Code.Global;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 类ItemSelect说明
/// </summary>
public class EquipSelect
{
#region //属性
/// <summary>
/// 分页
/// </summary>
public EquipFormSubPanel Locatioin
{
get;
set;
}
/// <summary>
/// 用于传入装备
/// </summary>
public object obj
{
get;
set;
}
#endregion
#region//公共接口
public EquipSelect()
{
Locatioin = EquipFormSubPanel.Train;
obj = null;
}
#endregion
#region//回调函数
#endregion
#region//私有函数
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b2c1b2d5ea9a2a2468ee9a63d551085f
timeCreated: 1483952251
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,617 @@
//**********************************************//
//作者:#何健#
//日期:#2016.10.14#
//简述:#装备数据结构#
//*********************************************//
using UnityEngine;
using System;
using System.Collections.Generic;
using Thousandto.Cfg.Data;
using Thousandto.Code.Global;
using Thousandto.Code.Center;
using Thousandto.Plugins.Common;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 类Equipment说明
/// </summary>
public class Equipment: ItemBase
{
#region//静态变量
public static Dictionary<int, Dictionary<int, ulong>> EquipBaseAttDic = null;
public static Dictionary<int, Dictionary<int, ulong>> EquipSpecialAttDic = null;
public static Dictionary<int, Dictionary<int, ulong>> EquipGodAttDic = null;
#endregion
#region //私有变量
private DeclareEquip _equip; //装备表数据
private int _suitID; //当前套装ID
private DeclareEquipSuit _suitCfg; //当前套装配置
private int _curSuitEquipCount;//当前装备的套装数量
private int _curLevelSuitEquipCount; //当前套装等级的套装数量
private List<int> _activeSuitNums; //激活的套装数量列表
private List<int> _activeSuitIds; //激活的套装的id列表
private uint _power;
//基础属性
private Dictionary<int, ulong> _baseAttrs;
private Dictionary<int, ulong> _specialAttrs;
private Dictionary<int, ulong> _godAttrs;
private MSG_backpack.ItemInfo _itemInfoFromServer;
#endregion
#region //属性
public DeclareEquip ItemInfo
{
get
{
return _equip;
}
}
public int SuitID
{
get
{
return _suitID;
}
}
public DeclareEquipSuit SuitCfg
{
get
{
return _suitCfg;
}
}
public int CurSuitEquipCount
{
get
{
return _curSuitEquipCount;
}
set
{
_curSuitEquipCount = value;
}
}
public int CurLevelSuitEquipCount
{
get
{
return _curLevelSuitEquipCount;
}
set
{
_curLevelSuitEquipCount = value;
}
}
public List<int> ActiveSuitNums
{
get
{
if (_activeSuitNums == null)
{
_activeSuitNums = new List<int>();
}
return _activeSuitNums;
}
}
public List<int> ActiveSuitIds
{
get
{
if (_activeSuitIds == null)
{
_activeSuitIds = new List<int>();
}
return _activeSuitIds;
}
}
#endregion
#region//继承父类
public override bool Initialization()
{
base.Initialization();
_equip = DeclareEquip.Get( CfgID );
if (_equip == null)
{
Debug.LogError("equip info initialization declareequip is null id = " + CfgID);
}
_suitID = 0;
_suitCfg = null;
return true;
}
public override void UnInitialization()
{
_baseAttrs.Clear();
}
public override int GetItemType()
{
return ItemType.Equip;
}
public override string GetName()
{
string ret = "";
if (null != ItemInfo)
{
if (SuitCfg != null)
{
ret = SuitCfg.Prefix + ItemInfo.Name;
}
else
{
ret = ItemInfo.Name;
}
}
return ret;
}
public override int GetIcon()
{
int ret = -1;
if (ItemInfo != null)
ret = ItemInfo.Icon;
return ret;
}
public override int GetEffect()
{
int ret = -1;
if (ItemInfo != null)
ret = ItemInfo.Effect;
return ret;
}
public override int GetQuality()
{
int ret = -1;
if (ItemInfo != null)
ret = ItemInfo.Quality;
return ret;
}
public override int GetStarNum()
{
var ret = 0;
if (ItemInfo != null)
ret = ItemInfo.DiamondNumber;
return ret;
}
public override string GetOcc()
{
if (ItemInfo != null)
{
return ItemInfo.Gender;
}
return "";
}
public override int GetPart()
{
var ret = -1;
if (ItemInfo != null)
ret = ItemInfo.Part;
return ret;
}
public override int GetGrade()
{
var ret = 0;
if (ItemInfo != null)
ret = ItemInfo.Grade;
return ret;
}
public override uint GetPower()
{
return _power;
}
public override bool IsCanUse( int useType = ItemOpertion.Use )
{
return base.IsCanUse( useType );
}
public override bool CheckLevel( int level )
{
return ItemInfo.Level <= level;
}
public override bool CheackOcc( int sex )
{
if (Occ.IndexOf("9") >= 0)
return true;
bool ret = false;
if ( ItemInfo.Gender.IndexOf(sex.ToString()) >= 0 )
{
ret = true;
}
else
{
ret = false;
}
return ret;
}
public override bool CheckBetterThanDress()
{
var dressEquip = GameCenter.EquipmentSystem.GetPlayerDressEquip(Part);
if(dressEquip != null)
{
return Power > dressEquip.Power;
}
return true;
}
public override bool CheckCanEquip()
{
return GameCenter.EquipmentSystem.OnCheckCanEquip(this);
}
public override bool CheckClass()
{
if (ItemInfo.Classlevel <= 0)
return true;
else
{
LocalPlayer p = GameCenter.GameSceneSystem.GetLocalPlayer();
if (p != null)
{
if (p.ChangeJobLevel >= ItemInfo.Classlevel)
{
return true;
}
else
{
return false;
}
}
}
return false;
}
public override bool isTimeOut()
{
return base.isTimeOut();
}
public override bool IsNeedSecond( int useType = ItemOpertion.Use )
{
bool ret= false;
if (ItemInfo == null)
{
return false;
}
switch ( useType )
{
case ItemOpertion.Use:
ret = ItemInfo.Quality >= 4; //紫色以上装备就需要提示
break;
case ItemOpertion.Split:
ret = false;
break;
case ItemOpertion.Sell:
case ItemOpertion.Stall:
case ItemOpertion.Resolve:
ret = ItemInfo.Quality >= 4; //紫色以上装备就需要提示
break;
}
return ret;
}
public override bool IsUsedInBatches()
{
return false;
}
//检测是否可以上架
public override bool CanAuction()
{
if (!GameCenter.MainFunctionSystem.FunctionIsVisible(FunctionStartIdCode.Auchtion))
return false;
if (IsBind)
return false;
if (ItemInfo.AuctionMaxPrice == 0)
return false;
return true;
}
//使用物品
public override void UseItem()
{
GameCenter.EquipmentSystem.RequestEquipWear(this);
}
//获取和已穿戴装备的战斗力差
public override int GetDressPowerDiff()
{
var dressEquip = GameCenter.EquipmentSystem.GetPlayerDressEquip(Part);
if (dressEquip != null)
{
return (int)Power - (int)dressEquip.Power;
}
return (int)Power;
}
//判断是否是首饰
public bool IsJewelry()
{
if (Part == EquipmentType.FingerRing || Part == EquipmentType.Necklace)
return true;
return false;
}
#endregion
#region//公共接口
public Equipment( MSG_backpack.ItemInfo info ):
base(info)
{
Initialization();
_suitID = info.suitId;
_suitCfg = DeclareEquipSuit.Get(_suitID);
SetAttribute();
_itemInfoFromServer = info;
}
public Equipment( Equipment info ):
base(info)
{
Initialization();
_suitID = info._suitID;
_suitCfg = info._suitCfg;
SetAttribute();
_itemInfoFromServer = info._itemInfoFromServer;
}
public string ToProtoBufferBytes()
{
byte[] bytes = Plugins.Common.ProtoBufUtils.Serialize(_itemInfoFromServer);
return Convert.ToBase64String(bytes);
}
public static Equipment ToEquipment(string str)
{
Equipment result;
byte[] message = Convert.FromBase64String(str);
MSG_backpack.ItemInfo itemInfo = new MSG_backpack.ItemInfo();
ProtoBufUtils.Deserialize(itemInfo, message);
result = new Equipment(itemInfo);
return result;
}
public Equipment(int id) :
base(id)
{
Initialization();
_suitID = 0;
_suitCfg = null;
SetAttribute();
}
/// <summary>
/// 获取装备的最基本的属性值
/// </summary>
/// <returns>属性类型,属性值</returns>
public Dictionary<int , ulong> GetBaseAttribute()
{
if (_baseAttrs != null)
return _baseAttrs;
return new Dictionary<int, ulong>();
}
/// <summary>
/// 获取装备的最基本的属性值
/// </summary>
/// <returns>属性类型,属性值</returns>
public Dictionary<int, ulong> GetSpecialAttribute()
{
if (_specialAttrs != null)
return _specialAttrs;
return new Dictionary<int, ulong>();
}
/// <summary>
/// 获取装备的最基本的属性值
/// </summary>
/// <returns>属性类型,属性值</returns>
public Dictionary<int, ulong> GetGodAttribute()
{
if (_godAttrs != null)
return _godAttrs;
return new Dictionary<int, ulong>();
}
//是否有效
public override bool IsValid()
{
return _equip != null;
}
//增加套装激活数
public void AddSuitActiveNum(int num, int id)
{
if(!ActiveSuitNums.Contains(num))
{
ActiveSuitNums.Add(num);
ActiveSuitIds.Add(id);
}
}
//清除套装激活数
public void ClearSuitActiveNum()
{
ActiveSuitNums.Clear();
ActiveSuitIds.Clear();
}
#endregion
#region//私有方法
/// <summary>
/// 计算当前装备的属性值
/// </summary>
/// <param name="level"></param>
/// <returns>属性类型,增加的属性值</returns>
private void SetAttribute()
{
if (EquipBaseAttDic == null)
{
EquipBaseAttDic = new Dictionary<int, Dictionary<int, ulong>>(512);
}
if(EquipBaseAttDic.ContainsKey(_equip.Id))
{
_baseAttrs = EquipBaseAttDic[_equip.Id];
}
else
{
if (_baseAttrs == null)
_baseAttrs = new Dictionary<int, ulong>();
_baseAttrs.Clear();
if (_equip == null) return;
var attrsArr = _equip.Attribute1.Split(GameDefine.SplitSemicolon, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < attrsArr.Length; i++)
{
string[] attrs = attrsArr[i].Split(GameDefine.SplitUnderline, StringSplitOptions.RemoveEmptyEntries);
if (attrs.Length == 2)
{
int iType = int.Parse(attrs[0]);
int baseAttr = int.Parse(attrs[1]);
if (_baseAttrs.ContainsKey(iType))
continue;
_baseAttrs.Add(iType, (ulong)baseAttr);
}
}
//将属性缓存起来下次使用的时候不会再次GC
EquipBaseAttDic[_equip.Id] = _baseAttrs;
}
if (EquipSpecialAttDic == null)
{
EquipSpecialAttDic = new Dictionary<int, Dictionary<int, ulong>>(512);
}
if (EquipSpecialAttDic.ContainsKey(_equip.Id))
{
_specialAttrs = EquipSpecialAttDic[_equip.Id];
}
else
{
if (_specialAttrs == null)
_specialAttrs = new Dictionary<int, ulong>();
_specialAttrs.Clear();
var attrsArr = _equip.Attribute2.Split(GameDefine.SplitSemicolon, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < attrsArr.Length; i++)
{
string[] attrs = attrsArr[i].Split(GameDefine.SplitUnderline, StringSplitOptions.RemoveEmptyEntries);
if (attrs.Length == 2)
{
int iType = int.Parse(attrs[0]);
int baseAttr = int.Parse(attrs[1]);
if (_specialAttrs.ContainsKey(iType))
continue;
_specialAttrs.Add(iType, (ulong)baseAttr);
}
}
//将属性缓存起来下次使用的时候不会再次GC
EquipSpecialAttDic[_equip.Id] = _specialAttrs;
}
if (EquipGodAttDic == null)
{
EquipGodAttDic = new Dictionary<int, Dictionary<int, ulong>>(512);
}
if (EquipGodAttDic.ContainsKey(_equip.Id))
{
_godAttrs = EquipGodAttDic[_equip.Id];
}
else
{
if (_godAttrs == null)
_godAttrs = new Dictionary<int, ulong>();
_godAttrs.Clear();
var attrsArr = _equip.Attribute3.Split(GameDefine.SplitSemicolon, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < attrsArr.Length; i++)
{
string[] attrs = attrsArr[i].Split(GameDefine.SplitUnderline, StringSplitOptions.RemoveEmptyEntries);
if (attrs.Length == 2)
{
int iType = int.Parse(attrs[0]);
int baseAttr = int.Parse(attrs[1]);
if (_godAttrs.ContainsKey(iType))
continue;
_godAttrs.Add(iType, (ulong)baseAttr);
}
}
//将属性缓存起来下次使用的时候不会再次GC
EquipGodAttDic[_equip.Id] = _godAttrs;
}
_power = FightPowerHelper.GetPropetryPower(_baseAttrs) + FightPowerHelper.GetPropetryPower(_specialAttrs) + FightPowerHelper.GetPropetryPower(_godAttrs);
}
#endregion
#region //辅助方法 此为静态方法
//装备职业名字
public static string GetOccNameWithOcc( string gender)
{
if (!string.IsNullOrEmpty(gender))
{
string rest = null;
var arr = gender.Split('_');
for(int i = 0; i < arr.Length; i++)
{
//如果在配置文件中找到,那么就返回名字,如果找不到,返回通用
var cfg = DeclarePlayerOccupation.Get(int.Parse(arr[i]));
if (cfg != null)
{
if (string.IsNullOrEmpty(rest))
rest = cfg.JobName;
else
rest = string.Format("{0},{1}", rest, cfg.JobName);
}
else
{
return DeclareMessageString.Get(DeclareMessageString.C_ITEM_OCC_NAME_COMMON);
}
}
return rest;
}
return DeclareMessageString.Get(DeclareMessageString.C_ITEM_OCC_NAME_COMMON);
}
/// <summary>
/// 阶数转换,输入等阶
/// </summary>
/// <param name="level"></param>
/// <returns></returns>
public static string LevelConvert(int level)
{
string str = "";
switch(level)
{
case 1:
case 2:
case 3:
case 4:
str = DeclareMessageString.Get(DeclareMessageString.C_GUILD_SORT_LEVEL_1 + level - 1);
break;
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
str = DeclareMessageString.Get(DeclareMessageString.C_GUILD_SORT_LEVEL_5 + level - 5);
break;
}
return str;
}
#endregion
}
}

Some files were not shown because too many files have changed in this diff Show More