游戏框架(框架入门篇)

《游戏框架》

##《游戏框架》发布说明:

++++“游戏框架”还是“游戏架构”,立钻哥哥还是以“游戏框架”来命名这个主题吧。

++++“游戏框架”作为整个游戏的框架,具有核心的地位,一个游戏的层次和后期维护性就取决于游戏框架。

++++《游戏框架》当然也是一个探索篇,作为这个分类的第一篇博文,还是先探索一段时间,后期根据需要再推出一个精品博文。

====>立钻哥哥带您学游戏框架。


##《游戏框架》目录:

#第一篇:框架入门篇

#第二篇:框架夯实篇

#第三篇:框架实战篇

#第四篇:框架进阶篇

#第五篇:框架高级实战篇

#第六篇:立钻哥哥带您学框架



#第一篇:框架入门篇

++第一篇:框架入门篇

++++第一章:框架概述

++++第二章:UI框架



++第一章:框架概述

++++1.1Unity3D游戏客户端基础框架

++++1.2、立钻哥哥带您学游戏框架

游戏框架(框架入门篇)_第1张图片




###1.1Unity3D游戏客户端基础框架

++1.1Unity3D游戏客户端基础框架

++++一些通用的基础系统的框架搭建,其中包括:

--UI框架(UGUI+MVC

--消息管理(Message Manager

--网络层框架(Socket + Protobuf

--表格数据(Protobuf

--资源管理(Unity5.xAssetBundle方案)

--热更框架(tolua

游戏框架(框架入门篇)_第2张图片

++1.1.1UI框架

++++编写UI框架的意义:

--打开、关闭、层级、页面跳转等管理问题集中化,将外部切换等逻辑交给UIManager处理。

--功能逻辑分散化,每个页面维护自身逻辑,依托于框架便于多人协同开发,不用关心跳转和显示关闭细节。

--通用性框架能够做到简单的代码复用和“项目经验”沉淀。

++++基于Unity3DUGUI实现的简单的UI框架,实现内容:

--1、加载、显示、隐藏、关闭页面,根据标示获得相应界面实例;

--2、提供界面显示隐藏动画接口;

--3、单独界面层级,Collider,背景管理;

--4、根据存储的导航信息完成界面导航;

--5、界面通用对话框管理;

--6、便于进行需求和功能扩展;

游戏框架(框架入门篇)_第3张图片

++1.1.2、消息管理(Message Manager

++++一个消息系统的核心功能:

--一个通用的事件监听器;

--管理各个业务监听的事件类型(注册和解绑事件监听器);

--全局广播事件;

--广播事件所传参数数量和数据类型都是可变的(数量可以是0~3,数据类型是泛型)

++++消息管理设计思路:在消息系统初始化时将每个模块绑定的消息列表,根据消息类型分类(用一个string类型的数据类标识),即建立一个字典Dictionary>:每条消息触发时需要通知的模块列表:某条消息触发,遍历字典中绑定的模块列表。

++1.1.3、网络层框架(NetworkManager

++++除了单机游戏,限制绝大多数的网游都是以强联网的方式实现的,选用Socket通信可以实时地更新玩家状态。

++++选定了联网方式后,还需要考虑网络协议定制的问题,Protobuf无疑是个比较好的选择,一方面是跨平台特性好,另一方面是数据量小可以节省通信成本。

++++Socket通信:联网方式、联网步骤,数据收发以及协议数据格式。(加入线程池管理已经用一个队列来管理同时发起的请求,让Socket请求和接收异步执行,基本的思路就是引入多线程和异步等技术。)

++++Protobuf网络框架主要用途是:数据存储(序列化和反序列化),功能类似xmljson等;制作网络通信协议等。(Protobuf不仅可以进行excel表格数据的导出,还能直接用于网络通信协议的定制。)

++++Protobuf是由Google公司发布的一个开源的项目,是一款方便而又通用的数据传输协议。(在Unity中可借助Protobuf来进行数据存储和网络协议两方面的开发。)

++1.1.4、表格数据

++++在游戏开发中,有很多数据是不需要通过网络层从服务器拉取下来的,而是通过表格配置的格式存储在本地。

++++游戏中的一个道具,通常服务器只下发该道具的ID(唯一标识)和LV(等级),然后客户端从本地数据中检索到该道具的具体属性值。(通常使用Excel表格来配置数据,可以使用ProtobufJSONXML等序列化和反序列化特性对表格数据转化。)

游戏框架(框架入门篇)_第4张图片

++1.1.5、资源管理(AssetBundle

++++AssetBundleUnity引擎提供的一种资源压缩文件,文件扩展名通常为unity3dassetbundle

++++对于资源的管理,其实是为热更新提供可能,Unity制作游戏的资源管理方式就通过AssetBundle工具将资源打成多个ab包,通过网络下载新的ab包来替换本地旧的包,从而实现热更的目的。

++++AssetBundleUnity编辑器在编辑环境创建的一系列的文件,这些文件可以被用在项目的运行环境中。(包括的资源文件有:模型文件(models)、材质(materials)、纹理(textures)和场景(scenes)等。)

++++Editor打包AssetBundle

//立钻哥哥:Editor打包AssetBundle

[MenuItem(Assets/Build AssetBundles)]

static void BuildAllAssetBundles(){

    BuildPipeline.BuildAssetBundles(Application.dataPath + /AssetBundles, BuildAssetBundleOptions.None, BuildTarget.StandaloneOSXIntel);

}

++1.1.6、热更新框架(tolua

++++使用C#编写底层框架,使用lua编写业务逻辑,这是业内最常见的设计方式,还有一个非常成熟的热更新框架tolua

++++通常可热更新的有:图片资源、UI预制和lua脚本,而处于跨平台的考虑,C#脚本是不允许进行热更的。



##第二章:UI框架

++第二章:UI框架

++++2.1MVC

++++2.2UIBase

++++2.3UIManager

++++2.4ResourceManager

++++2.5Defines

++++2.6Singleton

++++2.7SingletonException

++++2.8DDOLSingleton

++++2.9GameController

++++2.10CoroutineController

++++2.11StartGame

++++2.12TestOne

++++2.13TestTwo

++++2.14BaseController

++++2.15BaseModel

++++2.16BaseModule

++++2.17ModuleManager

++++2.18Message

++++2.19MessageCenter

++++2.20MessageType

++++2.21EventTriggerListener

++++2.22MethodExtension

++++2.23TestOneModule

++++2.24PropertyItem

++++2.25IDynamicProperty

++++2.26BaseActor

++++2.27BaseScene

++++2.28SceneManager

++++2.29MailUI

++++2.30MailRewardUI

++++2.31MailModule

++++2.32MailData

++++2.33、立钻哥哥带您学UI框架。


++UI框架前言

++++前端开发中实际上大量的编码工作都在UI编码上,基本上占前端编码的70%左右。一个良好的UI框架决定了前端的开发效率和后期的维护成本。

++UI框架涉及内容

++++1BaseUIUI界面的基类,定义了统一的UI功能接口(事件,开关,动画,声音)。

++++2UIManager:管理UI的管理器,管理是否缓存UI对象,是否需要互斥UI对象,管理一些通用UI

++++3ResourceManager资源管理器,资源加载统一管理,资源加载方式选择(同步、异步、本地、ABObjPool....),资源缓存,资源释放。

++++4Singleton通用单例类的基类。

++++5BaseModule逻辑模块基类,定义模块的通用功能,处理不同系统的数据逻辑。

++++6ModuleManager:逻辑模块管理器,管理游戏内所有逻辑的注册注销等。

++++7、自定义事件系统:不同模块直接的通信,模块内界面和数据逻辑分离。

++++8BaseScene:场景逻辑基类。

++++9SceneManager: 管理项目所有场景切换,加载等。

++++10CommonUI:项目中一些通用UI,继承BaseUI可重用UI

++++11NetWork:如何在我们的框架中添加网络模块。

游戏框架(框架入门篇)_第5张图片

游戏框架(框架入门篇)_第6张图片



###2.1MVC

###2.1MVC

++2.1MVC

++++MVC全名是Model View Controller,是模型(model-视图(view-控制器(controller)的缩写,一种软件设计典范,用一种业务逻辑、数据、界面显示分离的方式组织代码,将业务逻辑聚集到一个部件里面,在改进和个性化定制界面及用户交互的同时,不需要重新编写业务逻辑。

++++Model(模型)】:是应用程序中用于处理应用程序数据逻辑的部分。(通常模型对象负责在数据库中存取数据。)

++++View(视图)】:是应用程序中处理数据显示的部分。(通常视图是依据模型数据创建的。)

++++Controller(控制器)】:是应用程序中处理用户交互的部分。(通常控制器负责从视图读取数据,控制用户输入,并向模型发送数据。)

游戏框架(框架入门篇)_第7张图片

++2.1.1MVC模式设计流程

++++【抽象Model层】=>【为Model提供一套增删改查的方法】=>Controller层,把我们的需求(问题)转化成增删改查】=>【将Model层的信息,以一种用户可以接受的形式表现到View层。】

++2.1.2PureMVC

++++PureMVC是经典MVC设计框架的一个变种:“纯粹的MVC框架”。(是基于MVC模式建立的轻量级应用框架。)




###2.2BaseUI

###2.2BaseUI

++2.2BaseUI

++++UIBaseUI的公共基类。(定义了统一的UI功能接口(事件、开关、动画、声音)等。)

++++Scripts/YanlzFramework/BaseClass/BaseUI.cs

++2.2.1、一个简单UI代码参考(没有BaseUI

//立钻哥哥:一个简单UI代码参考:一个Panel上点击一个按钮进行Panel切换

using UnityEngine;

using System.Collections;

using UnityEngine.UI;

 

public class TestOne: MonoBehaviour{

    private Button bth;

 

    void Start(){

        btn = transform.Find(Panel/Button).GetComponent<Button>();

        btn.onClick.AddListener(OnClickBtn);

    }

 

    private void OnClickBth(){

        GameObject go = Instantiate<GameObject>(Resource.Load<GameObject>Prefabs/TestTwo);

        TestTwo testTwo= go.GetComponent<TestTwo>();

        if(null == testTwo){

            testTwo= go.AddComponent<TestTwo>();

        }

 

        Close();

    }

 

    private void Close(){

        Destroy(gameObject);

    }

}


++2.2.1BaseUI.csUI公共基类)

//立钻哥哥:UI的公共基类(Scripts/YanlzFramwork/BaseClass/BaseUI.cs

using UnityEngine;

using System.Collections;

 

namespace YanlzFramework{

    public abstract class BaseUI : MonoBehaviour{

 

        #region Cache gameObject &transform

        private GameObject _cacheGameObject;

        public GameObject CacheGameObject{

            get{

                if(null == _cacheGameObject){

                    _cacheGameObject = this.gameObject;

                }

 

                return _cacheGameObject;

            }

        }

 

        private Transform _cacheTransform;

        public Transform CacheGameObject{

            get{

                if(null == _cacheTransform){

                    _cacheTransform = this.transform;

                }

 

                return _cacheTransform;

            }

        }

        #endregion

 

        #region EnumObjectState & UI Type

        protected EnumObjectState _state = EnumObjectState.None;

        public event StateChangeEvent StateChanged;

 

        public EnumObjectState State{

            protected get{

                return this._state;

            }

 

            set{

                EnumObjectState oldState = this._state;

                this._state = value;

        

                if(null != StateChanged){

                    StateChanged(this, this._state, oldState);  //立钻哥哥:调用事件

                }

            }

 

            public abstract EnumUIType GetUIType();

 

            #endregion

 

            void Awake(){

                this.State = EnumObjectState.Initial;

                OnAwake();

            }

 

            //Use this for initialization

            void Start(){

                OnStart();

            }

 

            //Update is called once per frame

            void Update(){

                if(this._state == EnumObjectState.Ready){

                    OnUpdate(Time.deltaTime);

                }

            }

 

            public void Release(){

                this.State = EnumObjectState.Closing;

                GameObject.Destroy(this.CacheGameObject);

                OnRelease();

            }

 

            void OnDestroy(){

                this.State = EnumObjectState.None;

            }

 

 

            protected virtual void OnAwake(){

                this.State = EnumObjectState.Loading;

                this.OnPlayOpenUIAudio();    //播放音乐

            }

 

            protected virtual void OnStart(){ }

 

            protected virtual void OnUpdate(float delatTime){ }

 

            protected virtual void OnRelease(){

                this.State = EnumObjectState.None;

                this.OnPlayCloseUIAudio();    //关闭音乐

            }

 

            protected virtual void OnLoadData(){  }

 

            //播放打开界面音乐

            protected virtual void OnPlayOpenUIAudio(){ }

 

            //播放关闭界面音乐

            protected virtual void OnPlayCloseUIAudio(){ }

 

            protected virtual void SetUI(params object[] uiParams){

                this.State = EnumObjectState.Loading;

            }

 

            public virtual void SetUIParam(params object[] uiParams){

            }

 

            protected virtual void OnLoadData(){

            }

 

            public void SetUIWhenOpening(params object[] uiParams){

                SetUI(uiParams);

 

                //StartCoroutine(AsyncOnLoadData());    //立钻哥哥:异步加载

               CoroutineController.Instance.StartCoroutine(AsyncOnLoadData());

            }

 

            private IEnumerator AsyncOnLoadData(){

                yield return new WaitForSecond(0);

 

                if(this.State == EnumObjectState.Loading){

                    this.OnLoadData();

                    this.State = EnumObjectState.Ready;

                }

            }

        }

    }

}




###2.3UIManager

###2.3UIManager

++2.3UIManager

++++UIManagerUI管理类。(管理是否缓存UI对象,是否需要互斥UI对象,管理一些通用UI等。)

++++Scripts/YanlzFramework/Manager/UIManager.cs

++2.3.1UIManager.csUI管理类)

//立钻哥哥:UIManager.csUI管理类)(Scripts/YanlzFramework/Manager/UIManager.cs

using System;

 

namespace YanlzFramework{

    public class UIManager : Singleton<UIManager>{

        #region UIInfoData class

        class UIInfoData{

            public EnumUIType UIType{  get;  private set;  }

            public Type ScriptType {  get;  private set;  }

            public string Path{  get;  private set;  }

            public object[] UIParams{  get;  private set;  }

 

            public UIInfoData(EnumUIType _uiType, string _path, params object[] _uiParams){

                this.UIType = _uiType;

                this.Path = _path;

                this.UIParams = _uiParams;

                this.ScriptType = UIPathDefines.GetUIScriptByType(this.UIType);

            }

        }

        #endregion

 

        private Dictionary<EnumUIType, GameObject> dicOpenUIs = null;

 

        private Stack<UIInfoData> stackOpenUIs = null;

 

        public override void Init(){

            dicOpenUIs = new Dictionary<EnumUIType, GameObject>();

            statckOpenUIs = new Stack<UIInfoData>();

        }

 

        //获取指定UI

        public T GetUI<T>(EnumUIType _uiType) where T : BaseUI{

            GameObject _retObj = GetUIObject(_uiType);

            if(_retObj != null){

                return _retObj.GetComponent<T>();

            }

 

            return null;

        }

 

        public GameObject GetUIObject(EnumUIType _uiType){

            GameObject _retObj = null;

            if(!dicOpenUIs.TryGetValue(_uiType, out _retObj)){

                throw new Exception(立钻哥哥:_dicOpenUIs TryGetValue Failure! _uiType:  + _uiType.ToString());

            }

 

            return _retObj;

        }

 

        #region Preload UI Prefab By EnumUIType

 

        public void PreloadUI(EnumUIType[] _uiTypes){

            for(int i = 0;  i < _uiTypes.Length;  i++){

                PreloadUI(_uiTypes[i]);

            }

        }

 

        //立钻哥哥:预先加载UI资源

        public void PreloadUI(EnumUIType _uiType){

            string path = UIPathDefines.GetPrefabPathByType(_uiType);

            Resource.Load(path);

            //ResManager.Instance.ResourcesLoad(path);

        }

 

        #endregion

 

        #region Open UI By EnumUIType

 

        //打开界面

        public void OpenUI(EnumUIType[] _uiTypes){

            OpenUI(false, _uiTypes, null);

        }

 

        public void OpenUI(EnumUIType _uiType, params object[] _uiParams){

            EnumUIType[] _uiTypes = new EnumUIType[1];

            _uiTypes[0] = _uiType;

    

            OpenUI(false, _uiTypes, _uiParams);

        }

 

        public void OpenUICloseOthers(EnumUIType[] _uiTypes){

            OpenUI(true, _uiTypes, null);

        }

 

        public void OpenUICloseOthers(EnumUIType _uiType, params object[] _uiParams){

            EnumUIType[] _uiTypes = new EnumUIType[1];

            _uiTypes[0] = _uiType;

    

            OpenUI(true, _uiTypes, _uiParams);

        }

 

        //打开UI

        public void OpenUI(bool _isCloseOthers, EnumUIType[] _uiTypes, params object[] _uiParams){

            //立钻哥哥:Close Other UI

            if(_isCloseOthers){

                CloseUIAll();    //立钻哥哥:关闭其他UI

            }

 

            //push _uiTypes in stack

            for(int i = 0;  i < _uiTypes.Length;  i++){

                EnumUIType _uiType = _uiTypes[i];

                if(dicOpenUIs.ContainsKey(_uiType)){

                    string _path = UIPathDefines.GetPrefabsPathByType(_uiType);

                    stackOpenUIs.Push(new UIInfoData(_uiType, _path, _uiParams));

                }

            }

 

            //Open UI

            if(stackOpenUIs.Count > 0){

                //GameController.Instance.StartCoroutine();    //立钻哥哥:

                CoroutineController.Instance.StartCoroutine(AsynLoadData());

            }

        }

 

        #endregion

 

        private IEnumerator<int> AsyncLoadData(){

            UIInfoData _uiInfoData = null;

            UnityEngine.Object _prefabObj = null;

            GameObject _uiObject = null;

    

            if(stackOpenUIs != null && stackOpenUIs.Count > 0){

                do{

                    _uiInfoData = stackOpenUIs.Pop();

                    _prefabObj = Resource.Load(_uiInfoData.Path);

            

                    if(_prefabObj != null){

                        _uiObject = MonoBehaviour.Instantiate(_prefabObj) as GameObject;

                        BaseUI _baseUI = _uiObject.GetComponent<BaseUI>();

             

                        if(null == _baseUI){

                            _baseUI = _uiObject.AddComponent(_uiInfoData.ScriptType) as BaseUI;

                        }

                

                        if(null != _baseUI){

                            _baseUI.SetUIWhenOpening(_uiInfoData.UIParams);

                        }

                        dicOpenUIs.Add(_uiInfoData.UIType, _uiObject);

                    }

                }while(stackOpenUIs.Count > 0);

            }

 

            yield return 0;

        }

 

        #region Close UI By EnumUIType

 

        public void CloseUIAll(){

            List<EnumUIType> _keyList = new List<EnumUIType> (dicOpenUIs.Keys);

            foreach(EnumUIType _uiType in _keyList){

                GameObject _uiObj = dicOpenUIs[_uiType];

                CloaseUI(_uiType, _uiObj);

            }

            //CloseUI(_listKey.ToArray());   //立钻哥哥:利用数组关闭

 

            dicOpenUIs.Clear();

         }

 

        public void CloseUI(EnumUIType[] _uiTypes){

            for(int i=0;  i <_uiTypes.Length; i++){

                CloseUI(_uiTypes[i]);

            }

        }

 

        public void CloseUI(EnumUIType _uiType, GameObject _uiObj){

            //GameObject _uiObj = GetUIObject(_uiType);

 

            if(null == _uiObj){

                dicOpenUIs.Remove(_uiType);

 

            }else{

                BaseUI _baseUI = _uiObj.GetComponent<BaseUI>();

 

               if(null == _baseUI){

                    GameObject.Destroy(_uiObj);

                    dicOpenUIs.Remove(_uiType);

                }else{

                    _baseUI.StateChanged += CloseUIHandle;  //立钻哥哥:添加委托

                    _baseUI.Release();

                }

            }

        }

 

        private void CloseUIHandle(object sender, EnumObjectState newState, EnumObjectState oldState){

            if(newState == EnumObjectState.Closing){

                   BaseUI _baseUI = sender as BaseUI;

                    dicOpenUIs.Remove(_baseUI.GetUIType());

                    _baseUI.StateChanged -= CloseUIHandle;

            }

        }

 

        #endregion

 

    }

}




###2.4ResManager

###2.4ResManager

++2.4ResManager

++++ResManager:资源管理器,资源加载统一管理。(资源加载方式选择(同步、异步、本地、ABObjPool....),资源缓存,资源释放等。)

++++Scripts/YanlzFramework/Manager/ResManager.cs

++2.4.1ResManager.cs(资源管理器)(版本2

//立钻哥哥:ResMananger.cs(资源管理器)(YanlzFramework/Manager.ResManager.cs

using System;

using UnityEngine;

using System.Collection.Generic;

 

namespace YanlzFramework{

    //立钻哥哥:资源信息

    public class AssetInfo{

        private UnityEngine.Object _Object;

        public Type AssetType{  get;  set;  }

        public string Path{  get;  set;  }

        public int RefCount{  get;  set;  }

        public bool IsLoaded{

            get{

                return null != _Object;

            }

        }

 

        public UnityEngine.Object AssetObject{

            get{

                if(null == _Object){

                    //_Object = Resources.Load(Path);

                    _ResourcesLoad();

                }

 

                return _Object;

            }

        }

 

        public IEnumerator GetCoroutineObject(Action<UnityEngine.Object> _loaded){

            while(true){

                yield return null;

 

                if(null == _Object){

                    //yield return null;

 

                    //_Object = Resources.Load(Path);

                    _ResourcesLoad();

 

                    yield return null;

                }

 

                if(null != _loaded){

                     _loaded(_Object);

                }

 

                yield break;

            }

        }

 

        private void _ResourcesLoad(){

            try{

                _Object = Resource.Load(Path);

                if(null == _Object){

                    Debug.Log(立钻哥哥:Resources Load Failure! Path:  + Path);

                }

            }catch(Exception e){

                Debug.Log(e.ToString());

            }

        }

 

        public IEnumerator GetAsyncObject(Action<UnityEngine.Object> _loaded){

            return GetAsyncObject(_loaded, null);

        }

 

        public IEnumerator GetAsyncObject(Action<UnityEngine.Object> _loaded, Action<float> _progress){

            //立钻哥哥:have Object

            if(null != _Object){

                _loaded(_Object);

                yield break;

            }

 

            //Object null. Not Load Resources

            ResourceRequest _resRequest = Resources.LoadAsync(Path);

            while(_resRequest.progress < 0.9){

                if(null != _progress){

                    _progress(_resRequest.progress);

                }

 

                yield return null;

            }

 

            while(!_resRequest.isDone){

                if(null != _progress){

                    _progress(_resRequest.progress);

                }

 

                yield return null;

            }

 

            ///???

            _Object = _resRequest.asset;

            if(null != _loaded){

                _loaded(_Object);

            }

 

            yield return _resRequest;

        }

    }

 

    //立钻哥哥:ResManger:资源管理器

    public class ResManager : Singleton<ResManager>{

        private Dictionary<string, GameObject> dicAssetInfo = null;

 

        public override void Init(){

            //Resources.Load();

            //Resources.LoadAsync();

            //Resources.LoadAll();

            //Resources.LoadAssetAtPath();

            dicAssetInfo = new Dictionary<string, AssetInfo>();

            Debug.Log(立钻哥哥:ResManager : Singleton Init);

        }

 

        #region Load Resource & Instantiate Object

 

        public UnityEngine.Object LoadInstance(string _path){

            UnityEngine.Object _obj = Load(_path);

 

            //MonoBehaviour.Instantiate();

            return Instantiate(_obj);

        }

        #endregion

 

        private UnityEngine.Object Instantiate(UnityEngine.Object _obj){

            return Instantiate(_obj, null);

        }

 

        private UnityEngine.Object Instantiate(UnityEngine.Object _obj, Action<UnityEngine.Object> _loaded){

                UnityEngine.Object _retObj = null;

                if(null != _obj){

                    _retObj = MonoBehaviour.Instantiate(_obj);

                    if(null != _retObj){

                        if(null != _loaded){

                            _loaded(_retObj);

                        }else{

                            Debug.LogError(立钻哥哥:null _loaded.);

                       }

                       return _retObj;

 

                  }else{

                      Debug.LogError(立钻哥哥:Errornull Instantiate _retObj.);

                  }

 

              }else{

                 Debug.LogError(立钻哥哥:Errornull Resources Load return _obj.);

             }

        }

 

        #region Load Resource

 

        public UnityEngine.Object Load(string _path){

            AssetInfo _assetInfo = GetAssetInfo(_path);

            if(null != _assetInfo){

                return _assetInfo.AssetObject;

            }

 

             return null;

        }

        #endregion

 

        #region Load Coroutine Resources

 

        public void LoadCoroutine(string _path, Action<UnityEngine.Object> _loaded){

            AssetInfo _assetInfo = GetAssetInfo(_path, _loaded);

                if(null != _assetInfo){

                    CoroutineController.Instance.StartCoroutine(_assetInfo.GetCoroutineObject(_loaded));

                }

         }

        #endregion

 

        #region Load Async Resources

 

        public void LoadAsync(string _path, Action<UnityEngine.Object> _loaded){

            LoadAsync(_path, _loaded, null);

         }

 

        public void LoadAsync(string _path, Action<UnityEngine.Object> _loaded, Action<float> _progress){

            AssetInfo _assetInfo = GetAssetInfo(_path, _loaded);

            if(null != _assetInfo){

                CoroutineController.Instance.StartCoroutine(_assetInfo.GetAsyncObject(_loaded, _progress));

            }

        }

        #endregion

 

 

        private AssetInfo GetAssetInfo(string _path){

            return GetAssetInfo(_path, null);

        }

 

        private AssetInfo GetAssetInfo(string _path, Action<UnityEngine.Object> _loaded){

            if(string.IsNullOrEmpty(_path)){

                Debug.LogError(立钻哥哥:Error: null _path name.);

                if(null != _loaded){

                    _loaded(null);

                }

            }

 

            // Load Res ....

           AssetInfo _assetInfo = null;

           if(!dicAssetInfo.TryGetValue(_path, out _assetInfo)){

                _assetInfo = new AssetInfo();

                _assetInfo.Path = _path;

                dicAssetInfo.Add(_path, _assetInfo);

            }

            _assetInfo.RefCount++;

 

            return _assetInfo;

        }

 

    }

}




###2.5Defines

###2.5Defines

++2.5Defines

++++Defines:自定义空间和类。

++++Scripts/YanlzFramework/Defines/Defines.cs

++2.5.1Defines.cs

//立钻哥哥:自定义空间和类(Scripts/YanlzFramework/Defines/Defines.cs

using System;

 

namespace YanlzFramework{

 

    #region 全局委托Global delegate

    public delegate void StateChangeEvent(Object sender, EnumObjectState newState, EnumObjectSate oldState);

    public delegate void MessageEvent(Message message);

    public delegate void OnTouchEventHandle(GameObject_sender, object _args, params object[] _params);

    public delegate void PropertyChangedHandle(BaseActor actor, int id, object oldValue, object newValue);

 

 

    #endregion

 

    #region 全局枚举对象 Global enum

    public enum EnumObjectState{

        None,

        Initial,

        Loading,

        Read,

        Disabled,

        Closing

    }

 

    public enum EnumUIType : int{

        None = -1,

        TestOne,

        TestTwo,

    }

 

    public enum EnumTouchEventType{

        OnClick,

        OnDoubleClick,    //立钻哥哥:双击

        OnDown,

        OnUp,

        OnEnter,

        OnExit,

        OnSelect,

        OnUpdateSelect,

        OnDeSelect,

        OnDrag,

        OnDragEnd,

        OnDrop,

        OnScroll,

        OnMove,

    }

 

    public enum EnumPropertyType : int{

        RoleName = 1,   //立钻哥哥:角色名

        Sex,    //性别

        RoleID,    //Role ID

        Gold,    //宝石(元宝)

        Coin,    //金币(铜板)

        Level,    //等级

        Exp,    //当前经验

 

        AttackSpeed,    //攻击速度

        HP,    //当前HP

        HPMax,    //生命最大值

        Attack,    //普通攻击(点数)

        Water,    //水系攻击(点数)

        Fire,    //火系攻击(点数)

    }

 

    public enum EnumActorType{

        None = 0,

        Role,

        Monster,

       NPC,

    }

 

    public enum EnumSceneType{

        None = 0,

        StartGame,

        LoadingScene,

        LoginScene,

        MainScene,

        CopyScene,

        PVPScene,

        PVEScene,

    }

 

    #endregion

 

    public class UIPathDefines{

        public const string UI_PREFAB = Prefabs/;    //UI预设

        public const string UI_CONTROLS_PREFAB = UIPrefab/Control/;   //UI小控件预设

        public const string UI_SUBUI_PREFAB = UIPrefab/SubUI/;  //UI子页面预设

        public const string UI_IOCN_PATH = UI/Icon/;    //icon路径

 

        public static string GetPrefabsPathByType(EnumUIType _uiType){

            string _path = string.Empty;

            switch(_uiType){

                case EnumUIType.TestOne:{

                    _path = UI_PREFAB + TestUIOne;

                    break;

                }

 

                case EnumUIType.TestTwo:{

                    _path = UI_PREFAB + TestUITwo;

                    break;

                }

 

                default:{

                    Debug.Log(立钻哥哥:Not Find EnumUIType! Type:  + uiType.ToString());

                    break;

                }

 

                return _path;

            }

        }

 

        public static System.Type GetUIScriptByType(EnumUIType _uiType){

            System.Type _scriptType = null;

            switch(_uiType){

                case EnumUIType.TestOne:{

                    _scriptType = typeof(TestOne);

                    break;

                }

 

                case EnumUIType.TestTwo:{

                     _scriptType = typeof(TestTwo);

                    break;

                }

 

               default:{

                    Debug.Log(立钻哥哥:Not Find EnumUIType! Type:  + _uiType.ToString());

                    break;

                }

            }

 

            return _scriptType;

        }

 

    }

 

 

    public class Defines{

        public Defines(){

        }

    }

}




###2.6Singleton

###2.6Singleton

++2.6Singleton

++++Singleton:单例基类。

++++Scripts/YanlzFramework/Common/Singleton/Singleton.cs

++2.6.1Singleton.cs(单例基类)

//立钻哥哥:Singleton.cs(单例基类)(YanlzFramework/Common/Singleton/Singleton.cs

using System;

 

namespace YanlzFramework{

    public abstract class Singleton<T> where T : class, new() {

        public Singleton(){

            protected static T _Instance = null;

            public static T Instance{

                get{

                    if(null == _Instance){

                        _Instance = new T();

                    }

 

                    return _Instance;

                }

            }

        }

 

        protected Singleton(){

            if(null != _Instance){

                throw new SingletonException(立钻哥哥:This  + (typeof(T)).ToString() +  Singleton Instance is not null !!!);

            }

 

            Init();

        }

 

        public virtual void Init(){

        }

    }

}




###2.7SingletonException

###2.7SingletonException

++2.7SingletonException

++++SingletonException:异常类。

++++Scripts/YanlzFramework/Common/Singleton/SingletonException.cs

++2.7.1SingletonException.cs

//立钻哥哥:SingletonException.cs(异常类)(YanlzFramework/.../SingletonException.cs

using System;

 

namespace YanlzFramework{

    public class SingletonException : Exception{

        public SingletonException(string msg) : base(msg){

        }

    }

}




###2.8DDOLSingleton

###2.8DDOLSingleton

++2.8DDOLSingleton

++++DDOLSingleton:继承MonoBehaviour的单例基类。

++++Scripts/YanlzFramework/Common/Singleton/DDOLSingleton.cs

++2.8.1DDOLSingleton.cs(继承MonoBehaviour的单例基类)

//立钻哥哥:DDOLSingleton.csScripts/YanlzFramework/.../DDOLSingleton.cs

using UnityEngine;

using System.Collections;

 

public class DDOLSingleton<T> : MonoBehaviour where T : DDOLSingleton<T>{

    protected static T _Instance = null;

 

    public static T Instance{

        get{

            if(null == _Instance){

                GameObject go = GameObject.Find(DDOLGameObject);

                if(null == go){

                    go = new GameObject(DDOLGameObject);  

                    DontDestroyOnLoad(go);  //立钻哥哥:创建对象,过场不销毁

                }

 

               _Instance = go.AddComponent<T>();

            }

 

            return _Instance;

        }

    }

 

    //Raises the application quit event.

    private void OnApplicationQuit(){

        _Instance = null;

    }

}




###2.9GameController

###2.9GameController

++2.9GameController

++++GameController:游戏控制器。

++++Scripts/YanlzFramework/Manager/GameController.cs

++2.9.1GameController.cs(游戏控制器)

//立钻哥哥:GameController.csYanlzFramework/Manager/GameController.cs

using UnityEngine;

using System.Collections;

 

public class GameController : DDOLSingleton<GameController>{

}




###2.10CoroutineController

###2.10CoroutineController

++2.10CoroutineController

++++CoroutineController:非继承MonoBehaviour使用协程管理器。

++++Scripts/YanlzFramework/Manager/CoroutineController.cs

++2.10.1CoroutineController.cs(协程管理器)

//立钻哥哥:协程管理器:(YanlzFramework/Manager/CoroutineController.cs

using UnityEngine;

using System.Collections;

 

public class CoroutineController : DDOLSingleton<CoroutineController>{

}




###2.11StartGame

###2.11StartGame

++2.11StartGame

++++StartGame:游戏开始控制。

++++Scripts/GameLogic/StartGame.cs

++2.11.1StartGame.cs(开始游戏)

//立钻哥哥:开始游戏:(Scripts/GameLogic/StartGame.cs

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

using YanlzFramework;   //立钻哥哥:自己的框架命名空间

 

//public class StartGame : MonoBehaviour{

public class GameController : DDOLSingleton{

    //Use this for initialization

    void Start(){

        //RegisterAllMoudles();    //立钻哥哥:模拟GameController:注册模块

        ModuleManager.Instance.RegisterAllModules();    //立钻哥哥:

 

        SceneManager.Instance.RegisterAllScene();    //立钻哥哥:注册场景

 

        //GameObject go = Instantiate(Resource.Load<GameObject>(Prefabs/TestUIOne));

        UIManager.Instance.OpenUI(EnumUIType.TestOne);    //立钻哥哥

     

        TestResManager();    //立钻哥哥:测试ResManager功能

 

        StartCoroutine(AutoUpdateGold());    //立钻哥哥:测试金币更新

        StartCoroutine(NetAutoUpdateGold());    //立钻哥哥:模拟网络金币更新

    }

 

    void TestResManager(){

        float time = System.Enviroment.TickCount;

        for(int i = 1;  i < 1000;  i++){

            GameObject go = null;

            go = Instantiate(Resoureces.Load<GameObject>(Prefabs/Cube));  //1

            go = ResManager.Instance.LoadInstance(Prefabs/Cube) as GameObject; //2

 

            //3、异步加载

            ResManager.Instance.LoadAsyncInstance(Prefabs/Cube, (_obj)=>{

                go = _obj as GameObject;

               go.transform.position = UnityEngine.Random.insideUnitSphere * 20;

           });

 

            //4、协程加载

           ResManager.Instance.LoadCoroutineInstance(Prefabs/Cube, (_obj)=>{

                go = _obj as GameObject;

                go.transform.position = UnityEngine.Random.insideUnitSphere * 20;

            });

 

            //go.transform.position = UnityEngine.Random.insideUnitCircle * 20;

           go.transform.position = UnityEngine.Random.insideUnitSphere * 20;

       }

 

       Debug.Log(立钻哥哥:Times:  + (System.Environment.TickCout - time) * 1000);

    }

 

    private IEnumerator<int> AsyncLoadData(){

    }

 

    private IEnumerator AutoUpdateGold(){

        int gold = 0;

        while(true){

            gold++;

            yield return new WaitForSeconds(1.0f);

 

            Message message = new Message(AutoUpdateGold, this);

            message [gold] = gold;

            message .Send();

        }

    }

 

    private IEnumerator NetAutoUpdateGold(){

        int gold = 0;

        while(true){

            gold++;

            yield return new WaitForSeconds(1.0f);

 

            Message message = new Message(MessageType.Net_MessageTestOne, this);

            message [gold] = gold;

 

            //message .Send();

            //MessageCenter.Instance.SendMessage(NetMessageType.Net_MessageTestOne, this, null, gold);

            MessageCenter.Instance.SendMessage(message);    //立钻哥哥:

        }

    }

 

    //立钻哥哥:模拟GameController中的功能:注册模块

    private void RegisterAllModules(){

        //TestOneModule testOneModule = new TestOneModule();

        //testOneModule.Load();

        LoadModule(typeof(TestOneModule));

    }

 

    private void LoadModule(Type moduleType){

        BassModule bm = System.Activator.CreateInstance(moduleType) as BaseModule;

        bm.Load();

    }

 

}




###2.12TestOne

###2.12TestOne

++2.12TestOne

++++TestOne:第一个UI测试界面。

++++Scripts/GameLogic/UI/TestOne.cs

++2.12.1TestOne.cs(第一个UI测试界面)

//立钻哥哥:第一个UI测试界面:(Scripts/GameLogic/UI/TestOne.cs

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

using YanlzFramework;    //立钻哥哥:自己的框架命名空间

 

public class TestOne : BaseUI{

    private Button btn;

    private Text text;    //立钻哥哥:分数更新测试

 

    private TestOneModule oneModule;

 

    #region implemented abstract members of BaseUI

    public override EnumUIType GetUIType(){

        return EnumUIType.TestOne;

    }

    #endregion

 

    //Use this for initialization

    void Start(){

        //btn = transform.Find(Panel/Button).GetComponent<Button>();

        //btn.onClick.AddListener(OnClickBtn);

 

        text = transform.Find(Panel/Text).GetComponent<Text>();    //分数更新测试

    //EventTriggerListener.Get(transform.Find(Panel/Button).gameObject).SetEventHandle(EnumTouchEventType.OnClick, Close);

        EventTriggerListener listener = EventTriggerListener.Get(transform.Find(Panel/Button).gameObject);

        //listener.SetEventHandle(EnumTouchEventType.OnClick, Close);

        listener.SetEventHandle(EnumTouchEventType.OnClick, Close, 1, 1234);

 

        oneModule = ModuleManager.Instance.Get<TestOneModule>();

        text.text = Gold:  + oneModule.Gold;

    }

 

    public override OnAwake(){

        MessageCenter.Instance.AddListener(AutoUpdateGold, UpdateGold);

        base.OnAwake();

    }

 

    protected override void OnRelease(){

        MessageCenter.Instance.RemoveListener(AutoUpdateGold, UpdateGold);

        base.OnRelease();

    }

 

    private void UpdateGold(Message message){

        int gold = (int)message[gold];

        Debug.Log(立钻哥哥:TestOne UpdateGold:  + gold);

 

        text.text = Gold:  + gold;    //立钻哥哥:分数更新测试

    }

 

    private void OnClickBtn(){

        //GameObject go = Instantiate(Resources.Load<GameObject>(Prefabs/TestUITwo));

        UIManager.Instance.OpenUICloseOthers(EnumUIType.TestTwo);

 

        //Close();    //立钻哥哥:UIManager统一处理

    }

 

    private void Close(){

        Destroy(gameObject);

    }

 

    private void Close(GameObject _sender, objcet _args, params object[] _params){

        int i = (int) _params[0];

        string s = (string) _params[1];

        Debug.Log(i);

        Debug.Log(s);

    

        UIManager.Instance.OpenUICloseOthers(EnumUIType.TestTwo);

    }

}




###2.13TestTwo

###2.13TestTwo

++2.13TestTwo

++++TestOne:第一个UI测试界面。

++++Scripts/GameLogic/UI/TestOne.cs

++2.13.1TestTwo.cs(第二个UI测试界面)

//立钻哥哥:第一个UI测试界面:(Scripts/GameLogic/UI/TestTwo.cs

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

using YanlzFramework;    //立钻哥哥:自己的框架命名空间

 

public class TestOne : BaseUI{

    private Button btn;

 

    #region implemented abstract members of BaseUI

    public override EnumUIType GetUIType(){

        return EnumUIType.TestTwo;

    }

    #endregion

 

    //Use this for initialization

    void Start(){

        btn = transform.Find(Panel/Button).GetComponent<Button>();

        btn.onClick.AddListener(OnClickBtn);

    }

 

    protected override void OnWake(){

        Message.Instance.AddListener(AutoUpdateGold, UpdateGold);

        base.OnAwake();

    }

 

    protected override void OnRelease(){

        MessageCenter.Instance.RemoveListener(AutoUpdateGold, UpdateGold);

        base.OnRelease();

    }

 

    private void UpdateGold(Message message){

        int gold = (int)message[gold];

        Debug.Log(立钻哥哥:TestTwo UpdateGold:  + gold);

    }

 

    private void OnClickBtn(){

        //GameObject go = Instantiate(Resources.Load<GameObject>(Prefabs/TestUIOne));

        UIManager.Instance.OpenUICloseOthers(EnumUIType.TestOne);

 

        //Close();    //立钻哥哥:UIManager统一处理

    }

 

    private void Close(){

        Destroy(gameObject);

    }

}





###2.14BaseController

###2.14BaseController

++2.14BaseController

++++BaseModule:控制器基类。

++++Scripts/YanlzFramework/BaseClass/BaseController.cs

++2.14.1BaseController.cs(控制器基类)

//立钻哥哥:控制器基类:(Srcipts/YanlzFramework/BaseClass/BaseController.cs

using System;

 

namespace YanlzFramework{

    public class BaseController{

        public BaseController(){

        }

    }

}




###2.15BaseModel

###2.15BaseModel

++2.15BaseModel

++++BaseModel:模型基类。

++++Scripts/YanlzFramework/BaseClass/BaseModel.cs

++2.15.1BaseModel.cs(模型基类)

//立钻哥哥:模型基类:(Scripts/YanlzFramework/BaseClass/BaseModel.cs

using System;

 

namespace YanlzFramework{

    public class BaseModel{

        public BaseModel(){

        }

    }

}




###2.16BaseModule

###2.16BaseModule

++2.16BaseModule

++++BaseModule:数据逻辑处理模块基类。

++++Scripts/YanlzFramework/BaseClass/BaseModule.cs

++2.16.1BaseModule.cs

//立钻哥哥:数据逻辑处理模块基类:(YanlzFramework/BaseClass/BaseModule.cs

using System;

 

namespace YanlzFramework{

    public class BaseModule{

        public enum EnumRegisterMode{

            NotRegister,

            AutoRegister,

            AlreadyRegister,

        }

 

        private EnumObjectState state = EnumObjectState.Initial;

        public EnumObjectState State{

            get{

                return state;

            }

 

            set{

                if(state == value){

                    return;

                }

 

               EnumObjectState oldState = state;

               state = value;

 

               if(null != StateChanged){

                   StateChanged(this, state, oldState);

               }

 

              OnStateChanged(state, oldState);

           }

        }

 

        public event StateChangedEvent StateChanged;

 

        protected virtual void OnStateChanged(EnumObjectState newState, EnumObjectState oldState){

        }

 

        private EnumRegisterMode registerMode = EnumRegisterMode.NotRegister;

            public bool AutoRegister{

                get{

                    return registerMode == EnumRegisterMode.NotRegister ? false : true;

                }

 

                set{

                if(registerMode == EnumRegisterMode.NotRegister || registerMode == EnumRegisterMode.AutoRegister){

                        registerMode = value ? EnumRegisterMode.AutoRegister : EnumRegisterMode.NotRegister;

                    }

                }

            }

 

            public bool HasRegistered{

                get{

                    return registerMode == EnumRegisterMode.AlreadyRegister;

                }

            }

 

            public void Load(){

                if(State != EnumObjectState.Initial){

                    return;

                }

 

               State = EnumObjectState.Loading;

 

              //...

             if(registerMode == EnumRegisterMode.AutoRegister){

                 // register

                 ModuleManager.Instance.Register(this);

                 registerMode = EnumRegisterMode.AlreadyRegister;

             }

 

            OnLoad();

            State = EnumObjectState.Ready;

        }

 

        protected virtual void OnLoad(){

        }

 

        public void Release(){

            if(State != EnumObjectState.Disabled){

                State = EnumObjectState.Disabled;

 

                //...

                if(registerMode == EnumRegisterMode.AlreadyRegister){

                    //unregister

                    MoudleManager.Instance.UnRegister(this);

                    registerMode = EnumRegisterMode.AutoRegister;

                }

         

                OnRelease();

            }

        }

 

        protected virtual void OnRelease(){

        }

    }

}




###2.17ModuleManager

###2.17ModuleManager

++2.17ModuleManager

++++ModuleManager:模块管理器。

++++Scripts/YanlzFramework/Manager/ModuleManager.cs

++2.17.1ModuleManager.cs(模块管理器)

//立钻哥哥:模块管理器:(Scripts/YanlzFramework/Manager/ModuleManager.cs

using System;

 

namespace YanlzFramework{

    public class ModuleManager : Singleton{

        private Dictionary<string, BaseModule> dicModules = null;

 

        public override void Init(){

            dicModules = new Dictionary<string, BaseModule>();

        }

 

        #region Get Module

 

        public BaseModule Get(string key){

            if(dicModules.ContainsKey(key)){

                return dicModules[key];

            }

 

            return null;

        }

 

        public T Get<T>() where T : BaseModule{

            Type t = typeof(T);

 

            //return Get(t.ToString()) as T;

            if(dicModules.ContainsKey(t.ToString())){

                return dicModules[t.ToString()] as T;

            }

 

            return null;

        }

        #endregion

 

        public void RegisterAllModules(){

            LoadModule(typeof(TestOneModule));

            LoadModule(typeof(MailModule));    //立钻哥哥:新增邮件模块

            // ..... add

        }

 

        private void LoadModule(Type moduleType){

            BaseModule bm = System.Activator.CreateInstance(modueType) as BaseModule;

            bm.Load();

        }

 

        #region Register Module By Module Type

 

        public void Register(BaseModule module){

            Type t = module.GetType();

            Register(t.ToString(), module);

        }

 

        public void Register(string key, BaseModule module){

            if(!dicModules.ContainsKey(key)){

                dicModules.Add(key, module);

            }

        }

 

        #endregion

 

        #region Un Register Module

 

        public void UnRegister(BaseModule module){

            Type t = module.GetType();

            UnRegister(t.ToString());

        }

 

        public void UnRegister(string key){

            if(dicModules.ContainsKey(key)){

                BaseModule module = dicModules[key];

                module.Release();

                dicModules.Remove(key);

                module = null;

            }

        }

 

        public void UnRegisterAll(){

            List<string> _keyList = new List<string>(dicModules.Keys);

            for(int i = 0; i < _keyList.Count; i++){

                UnRegister(_keyList[i]);

            }

 

            dicModules.Clear();

        }

 

        #endregion

    }

}




###2.18Message

###2.18Message

++2.18Message

++++Message:消息。

++++Scripts/YanlzFramework/Common/Message/Message.cs

++2.18.1Message.cs(消息)

//立钻哥哥:消息:(YanlzFramework/Common/Message/Message.cs

using System;

using System.Collections;

using System.Collections.Generic;

 

namespace YanlzFramework{

    //立钻哥哥:消息描述:

    //foreach();

    //message[key] = value

    //Remove()

    //Send()

    //sender

    //Type or Name

    //Content

 

    public class Message : IEnumerable<KeyValuePair<string, object>>{

        private Dictionary<string, object> dicDatas = null;

 

        public string Name{  get;    private set;  }

        public object Sender{  get;    private set;  }

        public object Content{  get;    set;  }

 

        #region message[key] = value or data = message[key]

 

        //立钻哥哥:实现类似索引器方法:message[key] = value功能

        public object this[string key]{

            get{

                if(null == dicDatas || dicDatas.ContainsKey(key)){

                    return;

                }

 

                return dicDatas[key];

            }

 

            set{

                if(null == dicDatas){

                    dicDatas = new Dictionary<string, object>();

                }

 

               if(dicDatas.ContainsKey(key)){

                   dicDatas[key] = value;

                }else{

                    dicDatas.Add(key, value);

                }

            }

        }

        #endregion

 

        #region IEnumerable implementation

        public IEnumerator<KeyValuePair<string, object>> GetEnumerator(){

            if(null == dicDatas){

                yield break;

            }

 

           foreach(KeyValuePair<string, object> kvp in dicDatas){

                yield return kvp;

            }

        }

        #endregion

 

        #region IEnumerable implementation

        IEnumerator IEnumerable.GetEnumerator(){

            return dicDatas.GetEnumerator();  //立钻哥哥:借用Dictionary接口

        }

        #endregion

 

        #region Message Construction Function(立钻哥哥:构造函数)

 

        public Message(string name, object sender){

            Name = name;

            Sender = sender;

            Content = null;

        }

 

        public Message(string name, object sender, object content){

            Name = name;

            Sender = sender;

            Content = content;

        }

 

        public Message(string name, object sender, object content, params object[] _dicParams){

            Name = name;

            Sender = sender;

            Content = content;

 

            if(_dicParams.GetType() == typeof(Dictionary<string, object>)){

                foreach(object _dicParam in _dicParams){

                    foreach(KeyValuePair<string, object> kvp in _dicParam as Dictionary<string, object>){

                        //dicDatas[kvp.Key] = kvp.Value;    //立钻哥哥:error

                        this[kvp.Key] = kvp.Value;    //立钻哥哥:利用索引器

                    }

                }

            }

        }

 

        //立钻哥哥:类似C++拷贝构造函数

        public Message(Message message){

            Name = message.Name;

            Sender = message.Sender;

            Content = message.Content;

 

            foreach(KeyValuePair<string, object> kvp in message.dicDatas){

                this[kvp.Key] = kvp.Value;

            }

        }

 

        #endregion

 

        #region Add & Remove

 

        public void Add(string key, object value){

            this[key] = value;

        }

 

        public void Remove(string key){

            if(null != dicDatas && dicDatas.ContainsKey(key)){

                dicDatas.Remove(key);

            }

        }

        #endregion

 

        #region Send()

        public void Send(){

            //MessageCenter Send Message

            MessageCenter.Instance.SendMessage(this);

        }

        #endregion

 

    }

}




###2.19MessageCenter

###2.19MessageCenter

++2.19MessageCenter

++++MessageCenter:消息中心。

++++Scripts/YanlzFramework/Common/Message/MessageCenter.cs

++2.19.1MessageCenter.cs(消息中心)

//立钻哥哥:消息中心:(YanlzFramework/Common/Message/MessageCenter.cs

using System;

 

namespace YanlzFramework{

    public class MessageCenter : Singleton{

        private Dictionary<string, List<MessageEvent>> dicMessageEvents = null;

 

        public override void Init(){

            dicMessageEvents = new Dictionary<string, List<MessageEvent>>();

        }

 

        #region Add & Remove Listener

 

        public void AddListener(string messageName, MessageEvent messageEvent){

            Debug.Log(立钻哥哥:AddListener Name:  + messageName);

 

            List<MessageEvent> list = null;

 

            if(dicMessageEvents.ContainsKey(messageName)){

                list = dicMessageEvents[messageName];

     

            }else{

                 list = new List<MessageEvent>();

                dicMessageEvents.Add(messageName, list);

            }

 

            //list.Add(messageEvent);

            //立钻哥哥debug: no same messageEvent then add

            if(!list.Contains(messageEvent)){

                list.Add(messageEvent);

            }

        }

 

        public void RemoveListener(string messageName, MessageEvent messageEvent){

            if(dicMessageEvent.ContainsKey(messageName)){

                List<MessageEvent> list = dicMessageEvents[messageName];

 

                if(list.Contains(messageEvent)){

                    list.Remove(messageEvent);

                }

 

                if(list.Count <= 0){

                    dicMessageEvent.Remove(messageName);

                }

            }

        }

 

        public void RemoveAllListener(){

            dicMessageEvents.Clear();

        }

 

        #endregion

 

        #region Send Message

 

        public void SendMessage(Message message){

            DoMessageDispatcher(message);

        }

 

        public void SendMessage(string name, object sender){

            SendMessage(new Message(name, sender,));

        }

 

        public void SendMessage(string message, object sender, object content){

            SendMessage(new Message(name, sender, content));

        }

 

        public void SendMessage(string name, object sender, object content, params object[] dicParams){

            SendMessage(new Message(name, sender, content, dicParams));

        }

 

        #region 立钻哥哥:基于NetMessageType的消息处理:供参考

 

        public void AddListener(NetMessageType messageType, MessageEvent messageEvent){

            AddListener(messageType.ToString(), MessageEvent);

        }

 

        public void RemoveListener(NetMessageType messageType, MessageEvent messageEvent){

            RemoveListener(messageType.ToString(), messageEvent);

        }

 

        public void SendMessage(NetMessageType messageType, object sender){

            SendMessage(new Message(messageType.ToString(), sender,));

        }

 

        public void SendMessage(NetMessageType messageType, object sender, object content){

            SendMessage(new Message(messageType.ToString(), sender, content));

        }

 

        public void SendMessage(NetMessageType messageType, object sender, object content, params object[] dicParams){

                SendMessage(new Message(messageType.ToString(), sender, content, dicParams));

        }

        #endregion

 

        private void DoMessageDispatcher(Message message){

            Debug.Log(立钻哥哥:DoMessageDispatcher Name: + message.Name);

 

            if(dicMessageEvents == null || dicMessageEvent.ContainsKey(message.Name)){

                return;

            }

 

            List<MessageEvent> list = dicMessageEvents[message.Name];

            for(int i = 0;  i < list.Count;  i++){

                MessageEvent messageEvent = list[i];

 

                if(null != messageEvent){

                    messageEvent(message);

                }

           }

       }

 

        #endregion

    }

}




###2.20MessageType

###2.20MessageType

++2.20MessageType

++++MessageType:消息类型。

++++Scripts/YanlzFramework/Message/MessageType.cs

++2.21.1MessageType.cs(消息类型)

//立钻哥哥:消息类型:(Scripts/YanlzFramework/Message/MessageType.cs

using System;

 

namespace YanlzFramework{

    

    public class MessageType{

        public static string Net_MessageTestOne = Net_MessageTestOne;

        public static string Net_MessageTestTwo = Net_MessageTestTwo;

    }

 

    public Enum OldMessageType : int{

        MessageTestOne = 1,

        MessageTestTwo ,

    }

 

    public Enum NetMessageType : int{

        Net_MessageTestOne = 1,

        Net_MessageTestTwo ,

    }

 

}




###2.21EventTriggerListener

###2.21EventTriggerListener

++2.21EventTriggerListener

++++EventTriggerListener:事件监听。

++++Scripts/YanlzFramework/Common/Tools/EventTriggerListener.cs

++2.21.1EventTriggerListener.cs(事件监听)

//立钻哥哥:事件监听:(YanlzFramework/Common/Tools/EventTriggerListener.cs

using UnityEngine;

using System.Collections;

using UnityEngine.EventSystems;

 

namespace YanlzFramework{

    public class TouchHandle{

        private event OnTouchEventHandle eventHandle = null;

        private object[] handleParmas;

 

        public TouchHandle(OnTouchEventHandle _handle, params object[] _params){

            SetHandle(_handle, _params);

        }

 

        public TouchHandle(){

        }

 

        public void SetHandle(OnTouchEventHandle _handle, params object[] _params){

            DestroyHandle();

 

            eventHandle += _handle;

            handleParams = _params;

        }

 

        public void CallEventHandle(GameObject _sender, object _args){

             if(null != eventHandle){

                eventHandle(_sender, _args, handleParams);

            }

        }

 

        public void DestroyHandle(){

            if(null != eventHandle){

                eventHandle -= eventHandle;

                eventHandle = null;

            }

        }

 

    }

 

    public class EventTriggerListener : MonoBehaviour,

        IPointerClickHandler,

        IPointerDownHandler,

        IPointerUpHander,

        IPointerEnterHandler,

        IPointerExitHandler,

 

        ISelectHandler,

        IUpdateSelectedHandlder,

        IDeselectHandler,

 

        IDragHandler,

        IEndDragHandler,

        IDropHnadler,

        IScrollHandler,

        IMoveHandlder{

 

        public TouchHandler onClick;

        public TouchHandler onDoubleClick;    //立钻哥哥:双击

        public TouchHandler onDown;

        public TouchHandler onEnter;

        public TouchHandler onExit;

        public TouchHandler onUp;

        public TouchHandler onSelect;

        public TouchHandler onUpdateSelect;

        public TouchHandler onDeSelect;

        public TouchHandler onDrag;

        public TouchHandler onDragEnd;

        public TouchHandler onDrop;

        public TouchHandler onScroll;

        public TouchHandler onMove;

 

        static public EventTriggerListener Get(GameObject go){

             //EventTriggerListener listener = go.GetComponent<EventTriggerListener>();

             //EventTriggerListener listener = go.GetOrAddComponent<EventTriggerListener>();

            //return listener;

 

            return go.GetOrAddComponent<EventTriggerListener>();

        }

 

        void OnDestroy(){

            this.RemoveAllHandle();

        }

 

        private void RemoveAllHandle(){

            this.RemoveHandle(onClick);

            this.RemoveHandle(onDoubleClick);

            this.RemoveHandle(onDown);

            this.RemoveHandle(onEnter);

            this.RemoveHandle(onExit);

            this.RemoveHandle(onUp);

            this.RemoveHandle(onDrop);

            this.RemoveHandle(onDrag);

            this.RemoveHandle(onDragEnd);

            this.RemoveHandle(onScroll);

            this.RemoveHandle(onMove);

            this.RemoveHandle(onUpdateSelect);

            this.RemoveHandle(onSelect);

            this.RemoveHandle(onDeSelect);

        }

 

        private void RemoveHandle(TouchHandle _handle){

            if(null != _handle){

                _handle.DestroyHandle();

                _handle = null;

            }

        }

 

        #region IDragHandler implementation

        public void OnDrag(PointerEventData eventData){

            if(onDrag != null){

                onDrag.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IEndDragHandler implementation

        public void OnEndDrag(PointerEventData eventData){

            if(onDragEnd != null){

                onDragEnd.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IDropHandler implementation

        public void OnDrop(PointerEventData eventData){

            if(onDrop != null){

                onDrop.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IPointerClickHandler implementation

        public void OnPointerClick(PointerEventData eventData){

            if(null != onClick){

                onClick.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IPointerDownHandler implementation

        public void OnPointerDown(PointerEventData eventData){

            if(null != onDown){

                onDown.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IPointerUpHandler implementation

        public void OnPointerUp(PointerEventData eventData){

            if(onUp != null){

                onUp.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion        

   

        #region IPointerEnterHandler implementation

        public void OnPointerEnter(PointerEventData eventData){

            if(onEnter != null){

                onEnter.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IPointerExitHandler implementation

        public void OnPointerExit(PointerEventData eventData){

            if(onExit != null){

                onExit.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region ISelectHandler implementation

        public void OnSelect(BaseEventData eventData){

            if(onSelect != null){

                onSelect.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

        

        #region IUpdateSelecteHandler implementation

        public void OnUpdateSelected(BaseEventData eventData){

            if(onUpdateSelect != null){

                onUpdateSelect.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IDeselectHandler implementation

        public void OnDeselect(BaseEventData eventData){

            if(onDeSelect != null){

                onDeSelect.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IScrollHandler implementation

        public void OnScroll(PointerEventData eventData){

            if(onScroll != null){

                onScroll.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        #region IMoveHandler implementation

        public void OnMove(AxisEventData eventData){

            if(onMove != null){

                onMove.CallEventHandle(this.gameObject, eventData);

            }

        }

        #endregion

 

        public void SetEventHandle(EnumTouchEventType _type, OnTouchEventHandle _handle, param object[] _params){

            switch(_type){

                case EnumTouchEventType.OnClick:{

                    if(null == onClick){

                        onClick = new TouchHandle();

                    }

                   onClick.SetHandle(_handle, _params);

  

                    break;

                }

 

                case EnumTouchEventType.OnDoubleClick:{

                    if(null == onDoubleClick){

                        onClick = new TouchHandle();

                    }

                   onClick.SetHandle(_handle, _params);

  

                    break;

                }

 

 

                case EnumTouchEventType.OnDown:{

                    if(null == onDown){

                        onDown= new TouchHandle();

                    }

                   onDown.SetHandle(_handle, _params);

  

                   break;

               }

 

               case EnumTouchEventType.OnUp:{

                    if(null == onUp){

                        onUp = new TouchHandle();

                    }

                    onUp.SetHandle(_handle, _params);

  

                    break;

                }

 

               case EnumTouchEventType.OnEnter:{

                    if(null == onEnter){

                        onEnter = new TouchHandle();

                    }

                   onEnter.SetHandle(_handle, _params);

  

                   break;

               }

 

               case EnumTouchEventType.OnExit:{

                    if(null == onExit){

                        onExit = new TouchHandle();

                    }

                   onExit.SetHandle(_handle, _params);

  

                   break;

               }

 

              case EnumTouchEventType.OnDrag:{

                    if(null == onDrag){

                        onDrag = new TouchHandle();

                    }

                   onDrag.SetHandle(_handle, _params);

  

                   break;

               }

 

               case EnumTouchEventType.OnDrop:{

                    if(null == onDrop){

                        onDrop = new TouchHandle();

                    }

                    onDrop.SetHandle(_handle, _params);

  

                    break;

                }

 

                case EnumTouchEventType.OnDragEnd:{

                    if(null == onDragEnd){

                        onDragEnd = new TouchHandle();

                    }

                    onDragEnd.SetHandle(_handle, _params);

  

                    break;

                }

 

               case EnumTouchEventType.OnSelect:{

                    if(null == onSelect){

                        onSelect = new TouchHandle();

                    }

                   onSelect.SetHandle(_handle, _params);

  

                   break;

               }

 

              case EnumTouchEventType.OnUpdateSelect:{

                    if(null == onUpdateSelect){

                        onUpdateSelect = new TouchHandle();

                    }

                    onUpdateSelect.SetHandle(_handle, _params);

  

                    break;

                }

 

                case EnumTouchEventType.OnDeSelect:{

                    if(null == onDeSelect{

                        onDeSelect = new TouchHandle();

                    }

                   onDeSelect.SetHandle(_handle, _params);

  

                   break;

               }

 

              case EnumTouchEventType.OnScroll:{

                    if(null == onScroll){

                        onScroll = new TouchHandle();

                    }

                   onScroll.SetHandle(_handle, _params);

  

                    break;

                }

 

                case EnumTouchEventType.OnMove:{

                    if(null == onMove){

                        onMove = new TouchHandle();

                    }

                   onMove.SetHandle(_handle, _params);

  

                   break;

               }

           }

       }

 

        //Use this for initialization

        void Start(){

        }

 

    }

}

 



###2.22MethodExtension

###2.22MethodExtension

++2.22MethodExtension

++++MethodExtenson:方法扩展。

++++Scripts/YanlzFramework/Common/Extended/MethodExtension.cs

++2.22.1MethodExtension.cs(方法扩展)

//立钻哥哥:方法扩展:(YanlzFramework/Common/Extended/MethodExtension.cs

using System;

using UnityEngine;

 

namespace YanlzFramework{

    static public class MethodExtension{

        static public T GetOrAddComponent<T>(this GameObject go) where T : Component{

            T ret = go.GetComponent<T>();

            if(null == ret){

                ret = go.AddComponent<T>();

            }

 

            return ret;

        }

    }

}




###2.23TestOneModule

###2.23TestOneModule

++2.23TestOneModule

++++TestOneModule:数据模块。

++++Scripts/GameLogic/Module/TestOneModule.cs

++2.23.1TestOneModule.cs(数据模块)

//立钻哥哥:数据模块:(Scripts/GameLogic/Module/TestOneModule.cs

using System;

using YanlzFramework;

 

public class TestOneModule : BaseModule{

    public int Gold{  set;    private set;  }

 

    public TestOneModule(){

        this.AutoRegister = true;

    }

 

    protected override void OnLoad(){

        MessageCenter.Instance.AddListener(MessageType.Net_MessageTestOne, NetUpdateGold);

        base.OnLoad();

    }

 

    protected override void OnRelease(){

        MessageCenter.Instance.RemoveListener(MessageType.Net_MessageTypeOne, NetUpdateGold);

        base.OnRelease();

    }

 

    //立钻哥哥:模拟网络消息更新

    private void NetUpdateGold(Message msg){

        int gold = (int)msg[gold];

 

        if(gold >= 0){

            Gold = gold;

 

            Message message = new Message(AutoUpdateGold, this);

            message[gold] = gold;

            message.Send();

        }

    }

}




###2.24PropertyItem

###2.24PropertyItem

++2.24PropertyItem

++++PropertyItem:属性类。

++++Scripts/YanlzFramework/BaseClass/PropertyItem.cs

++2.24.1PropertyItem.cs(属性类)

//立钻哥哥:属性类:(YanlzFramework/BaseClass/PropertyItem.cs

using System;

 

namespace YanlzFramework{

    public class PropertyItem{

        public int ID{  get;    set;  }

        private object content;

        private object rawContent;

        private bool canRandom = false;

        private int curRandomInt;

        private float curRandomFloat;

        private Type propertyType;

 

        public IDynamicProperty Owner = null;    //立钻哥哥:owner

 

        public object Content{

            get{

                return GetContent();

            }

            get{

                if(value != GetContent()){

                    object oldContent = GetContent();

                    SetContent(value);

 

                    if(Owner != null){

                        Owner.DoChangeProperty(ID, oldContent, value);   //立钻哥哥

                    }

                }

            }

        }

 

        public void SetValueWithoutEvent(object content){

            if(content != GetContent()){

                object oldContent = GetContent();

                SetContent(content);

            }

        }

 

        public object RawContent{

            get{

                return rawContent;

            }

        }

 

        public PropertyItem(int id, object content){

            ID = id;

            setContent(content);

            rawContent = content;

 

            propertyType = content.GetType();

            if(propertyType == System.Int32 || propertyType == System.Single){

                canRandom = true;

            }

        }

 

        private void SetContent(object content){

            rawContent = content;

 

            if(canRandom){

                if(propertyType == typeof(System.Int32)){

                    curRandomInt = UnityEngine.Random.Range(1, 1000);

                    this.content = (int)content + curRandomInt;

 

                }else if(propertyType == typeof(System.Single)){

                    curRandomFloat = UnityEngine.Random.Range(1.0f, 1000.0f);

                    this.content = (float)content + curRandomFloat;

                }

 

            }else{

                this.content = content;

            }

        }

 

        private object GetContent(){

            if(canRandom){

                if(propertyType == typeof(System.Int32)){

                    int ret = (int)this.content - curRandomInt;

                        if(ret != rawContent){

                            Message message = new Message(PropertyItemDataException, this, ID);

                            message.Send();

                        }

 

                        return ret;

 

                }else if(propertyType == typeof(System.Single)){

                    float ret = (float)this.content - curRandomFloat;

                    if(ret != rawContent){

                        Message message = new Message(PropertyItemDataException, this, ID);

                        message.Send();

                    }

 

                    return ret;

                }

            }

 

            return this.content;

        }

    }

}




###2.25IDynamicProperty

###2.25IDynamicProperty

++2.25IDynamicProperty

++++IDynamicProperty:属性。

++++Scripts/YanlzFramework/Interface/IDynamicProperty.cs

++2.25.1IDynamicProperty.cs(属性)

//立钻哥哥:属性:(YanlzFramework/Interface/IDynamicProperty.cs

using System;

 

namespace YanlzFramework{

    public interface IDynamicProperty{

        void DoChangeProperty(int id, object oldValue, object newValue);

        PropertyItem GetProperty(int id);

    }

}




###2.26BaseActor

###2.26BaseActor

++2.26BaseActor

++++BaseActor:角色基类。

++++Scripts/YanlzFramework/BaseClass/BaseActor.cs

++2.26.1BaseActor.cs(角色基类)

//立钻哥哥:角色基类:(YanlzFramework/BaseClass/BaseActor.cs

using System;

using System.Collections.Generic;

 

namespace YanlzFramework{

    public class BaseActor : IDynamicProperty{

        protected Dictionary<int, PropertyItem> dicProperty;

        public event PropertyChangedHandle PropertyChanged;

 

        public EnumActorType ActorType{  set;    get;  }

        public int ID{  set;    get;  }

 

        private BaseScene currentScene;

        public BaseScene CurrentScene{

            set{

                //add Change Scene Logic ...

                currentScene = value;

            }

 

            get{

                return currentScene;

            }

        }

 

        public virtual void AddProperty(EnumPropertyType propertyType, object content){

            AddProperty((int)propertyType, content);

        }

 

        public virtual void AddProperty(int id, object content){

            PropertyItem item = new PropertyItem(id, content);

            AddProperty(item);

        }

 

       public virtual void AddProperty(PropertyItem property){

            if(null == dicProperty){

                dicProperty = new Dictionary<int, PropertyItem>();

            }

 

           if(dicProperty.ContainsKey(property.ID)){

               //remove same property

    

           }

 

            dicProperty.Add(property.ID, property);

            property.Owner = this;

        }

 

        public void RemoveProperty(EnumPropertyType propertyType){

            RemoveProperty((int)propertyType);

        }

 

        public void RemoveProperty(int id){

            if(null != dicProperty && dicProperty.ContainsKey(id)){

                dicProperty.Remove(id);

            }

        }

 

        public void ClearProperty(){

            if(null != dicProperty){

                dicProperty.Clear();

                dicProperty = null;

            }

        }

 

        public virtual PropertyItem GetProperty(EnumPropertyType propertyType){

            return GetProperty((int)properyType);

        }

 

        protected virtual void OnPropertyChanged(int id, object oldValue, object newValue){

            //add update ....

            //if(id == (int)EnumPropertyType.HP)

 

        }

 

        #region IDynamicProperty implementation

        public void DoChangeProperty(int id, object oldValue, object newValue){

            OnPropertyChanged(id, oldValue, newValue);

 

            if(null != PropertyChanged){

                PropertyChanged(this, id, oldValue, newValue);

            }

        }

 

        public PropertyItem GetProperty(int id){

            if(null == dicProperty){

                return null;

            }

 

            if(dicProperty.ContainsKey(id)){

                return dicProperty[id];

            }

 

           Debug.LogWarning(立钻哥哥:Actor dicProperty non Property ID: + id);

           return null;

        }

        #endregion

 

        public BaseActor(){

        }

    }

}




###2.27BaseScene

###2.27BaseScene

++2.27BaseScene

++++BaseScene:场景基类。

++++Scripts/YanlzFramework/BaseClass/BaseScene.cs

++2.27.1BaseScene.cs(场景基类)

//立钻哥哥:场景基类:(YanlzFramework/BaseClass/BaseScene.cs

using System;

 

namespace YanlzFramework{

    public class BaseScene : BaseModule{

        protected List<BaseActor> actorList = null;

 

        public BaseScene(){

            actorList = new List<BaseActor>();

        }

 

        public void AddActor(BaseActor actor){

            if(null != actor && !actorList.Contains(actor)){

                actorList.Add(actor);

                actor.CurrentScene = this;

                actor.PropertyChanged += OnActorPropertyChanged;

                //actor.Load();

            }

        }

 

        public void RemoveActor(BaseActor actor){

            if(null != actor && actorList.Contains(actor)){

                actorList.Remove(actor);

                actor.PropertyChanged -= OnActorPropertyChanged;

                //actor.Release();

                actor = null;

            }

        }

 

        public virtual BaseActor GetActorByID(int id){

            if(null != actorList && actorList.Count > 0){

                for(int i = 0;  i < actorList.Count;  i++){

                    if(actorList[i].ID == id){

                        return actorList[i];

                    }

                }

            }

 

            return null;

        }

 

        protected void OnActorPropertyChanged(BaseActor actor, int id, object oldValue, object newValue){

        }

 

    }

}




###2.28SceneManager

###2.28SceneManager

++2.28SceneManager

++++SceneManager:场景管理器。

++++Scripts/YanlzFramework/Manager/SceneManager.cs

++2.28.1SceneManager.cs(场景管理器)

//立钻哥哥:场景管理器:(YanlzFramework/Manager/SceneManager.cs

using System;

 

namespace YanlzFramework{

    public class SceneManager : Singleton<SceneManger>{

        #region SceneInfoData class

        public class SceneInfoData{

            public Type SceneType{  get;    private set;  }

            public string SceneName{  get;  private set;  }

            public object[] Params{  get;    private set;  }

 

            public SceneInfoData(string _sceneName, Type _sceneType, params object[] _params){

                this.SceneType = _sceneType;

                this.SceneName = _sceneName;

                this.Params = _params;

            }

        }

        #endregion

 

        private Dictionary<EnumSceneType, SceneInfoData> dicSceneInfos = null;

 

        private BaseScene currentScene = new BaseScene();

        public BaseScene CurrentScene{

            get{

                return currentScene;

            }

 

            set{

                currentScene = value;

                if(null != currentScene){

                    currentScene.Load();

                }

            }

        }

 

        public EnumSceneType LastSceneType{  get;    set;  }

        public EnumSceneType ChangeSceneType{  get;    private set;  }

 

        private EnumUIType sceneOpenUIType = EnumUIType.None;

        private object[] sceneOpenUIParams = null;

 

        public override void Init(){

            dicSceneInfos = new Dictionary<EnumSceneType, SceneInfoData>();

        }

 

        public void RegisterAllScene(){

            RegisterScene(EnumSceneType.StartGame, StartGameScene, null, null);

            RegisterScene(EnumSceneType.LoginScene, LoginScene, typeof(BaseScene), null);

            RegisterScene(EnumSceneType.MainScene, MainScene, null, null);

            RegisterScene(EnumSceneType.CopyScene, CopyScene, null, null);

        }

 

        public void RegisterScene(EnumSceneType _sceneID, string _sceneName, Type _sceneType, params object[] params){

               if(_sceneType == null || _sceneType.BaseType != typeof(BaseScene)){

                   throw new Exception(立钻哥哥:Register scene type must not null and extends BaseScene);

               }

 

            if(dicSceneInfos.ContainsKey(_sceneID)){

               SceneInfoData sceneInfo = new SceneInfoData(_sceneName, _sceneType, _params);

               dicSceneInfos.Add(_sceneID, sceneInfo);

           }

        }

 

        public void UnRegisterScene(EnumSceneType _sceneID){

            if(dicSceneInfos.ContainsKey(_sceneID)){

                dicSceneInfos.Remove(_sceneID);

            }

        }

 

        public bool IsRegisterScene(EnumSceneType _sceneID){

            return dicSceneInfos.ContainsKey(_sceneID);

        }

 

        internal BaseScene GetBaseScene(EnumSceneType _sceneType){

            Debug.Log(立钻哥哥:GetBaseScene sceneId =  + _sceneType.ToString());

 

            SceneInfoData sceneInfo = GetSceneInfo(_sceneType);

            if(sceneInfo == null || sceneInfo.SceneType == null){

                return null;

            }

 

            BaseScene scene = System.Activator.CreateInstance(sceneInfo.SceneType) as BaseScene;

            return scene;

 

            //BaseScene scene = Game.Instance.GetBaseScene(Game.Instance.ChangeSceneId);

            //Game.Instance.CurrentScene = scene;

            //scene.Load();

        }

 

        public SceneInfoData GetSceneInfo(EnumSceneType _sceneID){

            if(dicSceneInfos.ContainsKey(_sceneID)){

                return dicSceneInfos[_sceneID];

            }

 

            Debug.LogError(立钻哥哥:This Scene is not register! ID:  + _sceneID.ToString());

            return null;

        }

 

        public string GetSceneName(EnumSceneType _sceneID){

            if(dicSceneInfos.ContainsKey(_sceneID)){

                return dicSceneInfo[_sceneID].SceneName;

            }

 

            Debug.LogError(立钻哥哥:This Scene is not register! ID:  + _sceneID.ToString());

            return null;

        }

 

        public void ClearScene(){

            dicSceneInfos.Clear();

        }

 

        #region Change Scene

 

        public void ChangeSceneDirect(EnumSceneType _sceneType){

            UIManager.Instance.CloseUIAll();

 

            if(CurrentScene != null){

                CurrentScene.Release();

                CurrentScene = null;

            }

 

            LastSceneType = ChangeSceneType;

            ChangeSceneType = _sceneType;

 

            string sceneName = GetSceneName(_sceneType);

 

            //change scene

            CoroutineController.Instance.StartCoroutine(AsyncLoadScene(sceneName));

        }

 

        public void ChangeSceneDirect(EnumSceneType _sceneType, EnumUIType _uiType, params object[] _params){

            sceneOpenUIType = _uiType;

            sceneOpenUIParams = _params;

 

            if(LastSceneType == _sceneType){

                if(sceneOpenUIType == EnumUIType.None){

                    return;

                }

                UIManager.Instance.OpenUI(sceneOpenUIType, sceneOpenUIParams);

                sceneOpenUIType = EnumUIType.None;

 

            }else{

                ChangeSceneDirect(_sceneType);

            }

        }

 

        private IEnumerator<AsyncOperation> AsyncLoadScene(string sceneName){

            AsyncOperation oper = Application.LoadLevelAsync(sceneName);

            yield return oper;

 

            //message send

            if(sceneOpenUIType != EnumType.None){

                UIManager.Instance.OpenUI(sceneOpenUIType, sceneOpenUIParams);

                sceneOpenUIType = EnumUIType.None;

            }

        }

 

        #endregion

 

        public void ChangeScene(EnumSceneType _sceneType){

            UIManager.Instance.CloseUIAll();

 

            if(CurrentScene != null){

                CurrentScene.Release();

                CurrentScene = null;

            }

 

            LastSceneType = ChangeSceneType;

            ChangeSceneType = _sceneType;

 

            string sceneName = GetSceneName(_sceneType);

 

            //change loading scene

            CoroutineController.Instance.StartCoroutine(AsyncLoadOtherScene());

        }

 

        public void ChangeScene(EnumSceneType _sceneType, EnumUIType _uiType, params object[] _params){

            sceneOpenUIType = _uiType;

            sceneOpenUIParams = _params;

 

            if(LastSceneType == _sceneType){

                if(sceneOpenUIType == EnumUIType.None){

                    return;

                }

               UIManager.Instance.OpenUI(sceneOpenUIType, sceneOpenUIParams);

               sceneOpenUIType = EnumUIType.None;

 

            }else{

                ChangeScene(_sceneType);

            }

        }

 

        private IEnumerator AsyncLoadOtherScene(){

            string sceneName = GetSceneName(EnumSceneType.LoadingScene);

            AsyncOperation oper = Application.LoadLevelAsync(sceneName);

            yield return oper;

 

            //message send

            if(oper.isDone){

                GameObject go = GameObject.Find(LoadingScenePanel);

                LoadingSceneUI loadingSceneUI = go.GetComponent<LoadingSceneUI>();

 

                BaseScene scene = CurrentScene;

                if(null != scene){

                    scene.CurrentSceneId = ChangeSceneId;

                }

 

                //检测是否注册该场景

                if(!SceneManager.Instance.isRegisterScene(ChangeSceneId)){

                    Debug.LogError(立钻哥哥:没有注册此场景: + ChangeSceneId.ToString());

                }

 

                LoadingSceneUI.Load(ChangeSceneId);

                LoadingSceneUI.LoadCompleted += SceneLoadCompleted;

            }    

        }

 

        void SceneLoadCompleted(object sender, EventArgs e){

            Debug.Log(立钻哥哥:切换场景完成 +  + sender as String);

            //场景切换完成

            //MessageCenter.Instance.SendMessage(MessageType.GAMESCENE_CHANGECOMPLETE, this, null, false);

 

             //有要打开的UI

            if(sceneOpenUIType != EnumUIType.None){

                UIManager.Instance.OpenUI(false, sceneOpenUIType, sceneOpenUIParams);

                sceneOpenUIType = EnumUIType.None;

            }

        }

 

        //立钻哥哥:加载场景

        private IEnumerator AsyncLoadedNextScene(){

            string fileName = SceneManager.Instance.GetSceneName(ChangeSceneId);

            AsyncOperation oper = Application.LoadLevelAsync(fileName);

            yield return oper;

 

            if(oper.isDone){

                if(LoadCompleted != null){

                    LoadCompleted(changeSceneId, null);

                }

            }

        }

 

    }

}




###2.29MailUI

###2.29MailUI

++2.29MailUI

++++MailUI:邮件界面。

++++Scripts/GameLogic/UI/Mail/MailUI.cs

++2.29.1MailUI.cs(邮件界面)

//立钻哥哥:邮件界面:(Scripts/GameLogic/UI/Mail/MailUI.cs

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

using YanlzFramework;

using UnityEngine.UI;

 

public class MailUI : BaseUI{

    private Dictionary<EnumMailType, UIButton> dicTitleButton = null;

 

    public Button button_Close;

    public Button button_MailSystem;

    public Button button_MailBattleReport;

    public Button button_MailAll;

    public Button button_GetRewardAll;

    public Button button _DeleteAll;

 

    public UIScrollView scrollView;

    public UIGrid grid_Cell;

    private Dictionary<int, GameObject> obj_Items = new Dictionary<int, GameObject>();

 

    private MailModule mailModule = null;

    private EnumMailType currMailType = EnumMailType.mail_system;

 

    #region implemeted abstract members of BaseUI

    public override EnumUIType GetUIType(){

        return EnumUIType.MailUI;

    }

    #endregion

 

    protected override void OnLoad(){

        base.SetDepthToTop();

 

        mailModule = ModuleManager.Instance.Get<MailModule>();

        obj_Items = new Dictionary<int, GameObject>();

        for(int i = 0;  i < 4;  i++){

            int cellId = i + 1;

            GameObject objCell = ResourceManager.Instance.ResourceLoad(UIResourcePath.UI_CONTROLS_PREFAB + (mail_Item + cellId)) as GameObject;

            obj_Items.Add(cellId, objCell);

        }

 

        EventTriggerListener.SetEventHandle(button_Close.gameObject, EnumTouchEventType.OnClick, ButtonOnClick_Close, null, null);

 

        EventTriggerListener.SetEventHandle(button_MailSystem.gameObject, EnumTouchEventType.OnClick, ButtonOnClick_MailType, EnumMailType.mail_system, null);

        EventTriggerListener.SetEventHandle(button_mailBattleReport.gameObject, EnumTouchEventType.OnClick, ButtonOnClick_MailType, EnumMailType.mail_battleReport, null);

        EventTriggerListener.SetEventHandle(button_MailAll.gameObject, EnumTouchEventType.OnClick, ButtonOnClick_MailType, EnumMailType.mail_all, null);

 

        EventTriggerListener.SetEventHandle(button_GetRewardAll.gameObject, EnumTouchEventType.OnClick, ButtonOnClick_GetRewardAll, null, null);

        EventTriggerListener.SetEventHandle(button_DeleteAll.gameObject, EnumTouchEventType.OnClick, ButtonOnClick_DeleteAll, null, null);

 

        dicTitleButton = new Dictionary<EnumMailType, UIButton>();

        dicTitleButton.Add(EnumMailType.mail_system, button_MailSystem);

        dicTitleButton.Add(EnumMailType.mail_battleReport, button_MailBattleReport);

        dicTitleButton.Add(EnumMailType.mail_all, button_MailAll);

 

        MessageCenter.Instance.AddListener(ResponseRefreshMailItemData, ResponseRefreshMailItemData);

        this.SetMailPageType(EnumMailType.mail_system, true);

 

        base.OnLoad();

    }

 

    protected override void SetUI(params object[] uiParams){

        base.SetUI(uiParams);

    }

 

    protected override void OnLoadData(){

        UIManager.Instance.SetUIToMessageBlock(this.gameObject);

        base.OnLoadData();

    }

 

    protected override void OnRelease(){

        MessageCenter.Instance.RemoeListener(ResponseRefreshMailItemData, ResponseRefreshMailItemData);

 

        base.OnRelease();

    }

 

    private void ButtonOnClick_Close(GameObject obj, object args, object param1, object param2){

        UIManager.Instance.CloseUI(GetUIType());

    }

 

    private void ButtonOnClick_MailType(GameObject obj, object args, object param1, object param2){

        EnumMailType type = (EnumMailType)param1;

        if(currMailType == type){

            return;

        }

 

        currMailType = type;

        this.SetMailPageType(currMailType, true);

    }

 

    private void SetMailPageType(EnumMailType type, bool isReset){

        this.SetTitleButtonState(type);

        StartCoroutine(this.RefreshMailItemList(mailModule.GetAllMailDataList(type), isReset));

    }

 

    private void ButtonOnClick_GetRewardAll(GameObject obj, object args, object param1, object param2){

        mailModule.sendGetMailRewardDataMessage(2, currMailType, 0);

    }

 

    private void ButtonOnClick_DeleteAll(GameObject obj, object args, object param1, object param2){

        UIManager.Instance.OpenDoubleMessageBox(删除所有邮件, ButtonOnClick_DeleteAllConfire, null);

    }

 

    private void ButtonOnClick_DeleteAllConfire(GameObject obj, object args, object param1, object param2){

        mailModule.sendGetMailRewardDataMessage(2, currMailType, 0);

    }

 

    private void ResponseRefreshMailItemData(Message message){

        this.SetMailPageType(currMailType, false);

    }

 

    public IEnumerator RefreshMailItemList(List<MailInfoData> filterList, bool isReset){

        //先销毁元素

        foreach(Transform tf in grid_Cell.GetChildList()){

            DestroyObject(tf.gameObject);

        }

 

        if(isReset){

            scrollView.SetDragAmount(0, 0, false);

        }

 

        for(int i = 0;  i < filterList.Count;  i++){

            MailInfoData infoData = filterList[i];

            this.AddItemCell(infoData);

        }

 

        yield return new WaitForFixedUpdate();

 

        grid_Cell.Reposition();

    }

 

    private void AddItemCell(MailInfoData infoData){

        GameObject objCell = NGUITools.AddChild(grid_Cell.gameObject, obj_Items[infoData.mailPrototype.cellID]);

    

        switch(infoData.mailPrototype.cellID){

            case 1:{

                MailUICell_1 mailUICell_1 = objCell.GetComponent<MailUICell_1>();

                mailUICell_1.Show(infoData);

                break;

            }

            ....

        }

    }

 

}




###2.30MailRewardUI

###2.30MailRewardUI

++2.30MailRewardUI

++++MailRewardUI:邮件奖励界面。

++++Scripts/GameLogic/UI/Mail/MailRewardUI.cs

++2.30.1MailRewardUI.cs(邮件奖励界面)

//立钻哥哥:邮件奖励界面:(Scripts/GameLogic/UI/Mail/MailRewardUI.cs

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

using YanlzFramework;

using UnityEngine.UI;

 

public class MailRewardUI : BaseUI{

    public UIButton button_Close;

    public UIButton button_Confire;;

    public UIScrollView scrollView;

    public UIGrid grid_Cell;

    private GameObject objCell;

 

    private MailInfoData mailInfoData = null;    //立钻哥哥:奖励

 

    #region implemented abstract members of BaseUI

    public override EnumUIType GetUIType(){

        return EnumUIType.MailRewadUI;

    }

    #endregion

 

    protected override void OnLoad(){

        base.SetDepthToTop();

   

        objCell = ResourceManager.Instance.ResourceLoad(UIResourcePath.UI_CONTROLS_PREFAB + mail_reward, ....);

        EventTriggerListener.SetEventHandle(button_Confire.gameObject, EnumTouchEventType.OnClick, ButtonOnClick....);

        EventTriggerListener.SetEventHandle(button_Close.gameObject, EnumTouchEventType.OnClick, ButtonOnClick....);

 

            base.OnLoad();

    }

 

    protected override void SetUI(params object[] uiParams){

        if(uiParmas != null && uiParams.Length > 0){

            mailInfoData = (MailInfoData)uiParams[0];

        }

 

        base.SetUI(uiParams);

    }

 

    protected override void OnLoadData(){

        UIManager.Instance.SetUIToMessageBlock(this.gameObject);

        this.Show();

 

        base.OnLoadData();

    }

 

    protected override void OnRelease(){

        base.OnRelease();

    }

 

    private void ButtonOnClick_Confire(GameObject obj, object args, object[] _params){

        UIManager.Instance.CloaseUI(GetUIType());

        MailModule mailModule = ModuleManager.Instance.Get<MailModule>();

        mailModule.sendGetMailRewardDataMessage(1, EnumMailType.mail_none, mailInfoData.OnlyId);

    }

 

    private void ButtonOnClick_Close(GameObject obj, object args, object[] _params){

        UIManager.Instance.CloseUI(GetUIType());

    }

 

    public void Show(){

        StartCoroutine(this.RefreshItemList());

    }

 

    public IEnumerator RefreshItemList(){

        //立钻哥哥:先销毁元素

        foreach(Transform tf in grid_Cell.GetChildList()){

            DestroyObject(tf.gameObject);

        }

 

        scrollView.SetDragAmount(0, 0, false);

 

        for(int i = 0;  i < mailInfoData.rewardController.rewardInfoList.Count;  i++){

            ItemBaseDataInfo itemDataInfo = mailInfoData.rewardController.rewardInfoList[i];

            GameObject obj = NGUITools.AddChild(grid_Cell.gameObject, objCell);

            MailRewardUICell itemCell = obj.GetComponent<MailRewardUICell>();

            itemCell.Show(itemDataInfo);

        }

 

        yield return new WaitForFixedUpdate();

        gird_Cell.Reposition();

    }

 

}




###2.31MailModule

###2.31MailModule

++2.31MailModule

++++MailModule:邮件模块。

++++Scripts/GameLogic/Module/Mail/MailMoudle.cs

++2.31.1MailModule(邮件模块)

//立钻哥哥:邮件模块(Scripts/GameLogic/Module/Mail/MailModule.cs

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

using YanlzFramework;

 

public class MailModule : BaseModule{

    private List<MailInfoData> allMailDataList = null;    //立钻哥哥:邮件列表

    private List<long> allUnReadMailList = null;    //未读列表

 

    public MailMoudle(){

        AutoRegister = true;

        allMailDataList = new List<MailInfoData>();

        allUnReadMailList = new List<long>();

    }

 

    protected override void OnLoad(){

        MessageCenter.Instance.AddListener(getAllMailData, ResponseGetAllMailData);

        MessageCenter.Instance.AddListener(getMailReward, ResponseGetMailRewardData);

        MessageCenter.Instance.AddListener(deleteMailData, ResponseDeleteMailData);

 

        base.OnLoad();

    }

 

    protected override void OnRelease(){

        MessageCenter.Instance.RemoveListener(getAllMailData, ResponseGetAllMailData);

        MessageCenter.Instance.RemoveListener(getMailReward, ResponseGetMailRewardData);

        MessageCenter.Instance.RemoveListener(deleteMailData, ResponseDeleteMailData);

 

        base.OnRelease();

    }

 

    private void LoadAllMailData(Dictionary<string, object> jsonData){

        //立钻哥哥:数据

        if(jsonData.ContainsKey(mails)){

            allMailDataList.Clear();

 

            List<object> allItem = jsonData[mails] as List<object>;

            for(int i = 0;  i < allItem.Count;  i++){

                Dictionary<string, object> dicData = allItem[i] as Dictionary<string, object>;

                MailInfoData infoData = MailInfoData.GetMailInfoData(dicData);

                allMailDataList.Add(infoData);

            }

        }

 

        //未读数据

        if(jsonData.ContainsKey(unReadMailId)){

            allUnReadMailList.Clear();

 

            List<object> unReadList = jsonData[unReadMailId] as List<object>;

            for(int i = 0;  i < unReadList.Count;  i++){

                long id = long.Parse(unReadList[i].ToString());

                allUnReadMailList.Add(id);

            }

        }

    }

 

    //立钻哥哥:获取全局列表

    public List<MailInfoData> GetAllMailDataList(){

        return this.allMailDataList;

    }

 

    public List<MailInfoData> GetAllMailDataList(EnumMailType type){

        List<MailInfoData> tempList = new List<MailInfoData>();

        if(type == EnumMailType.mail_all){

            tempList.AddRange(this.allMailDataList);

        }else{

            for(int i = 0;  i < this.allMailDataList.Count;  i++){

                MailInfoData infoData = this.allMailDataList[i];

                if(infoData.MailType == (int)type){

                    tempList.Add(infoData);

                }

            }

        }

 

        tempList.Sort((x,y)=>{

            return x.CreateTime.CompareTo(y.CreateTime);

        });

 

        return tempList;

    }

 

    public bool IsReadMailState(long onlyId){

        if(this.allUnReadMailList.Contains(onlyId)){

            return false;

        }

 

        return true;

    }

 

    //立钻哥哥:获取所有邮件数据

    public void SendGetAllMailDataMessage(){

        Message message = new Message(getAllMailData, this, null);

        message[NOTIFICATION_CONNECT_UI] = true;

        message.Send(true, true, null);

    }

 

    private void ResponseGetAllMailData(Message message){

        Debug.Log(立钻哥哥:ResponseGetAllMailData);

 

        Dictionary<string, object> dicData = message.Content as Dictionary<string, object>;

        this.LoadAllMailData(dicData);

        UIManager.Instance.OpenUI(false, EnumUIType.MailUI);

    }

 

    public void SendGetMailRewardDataMessage(int operType, EnumMailType mailType, long onlyId){

        Message message = new Message(getMailReward, this, null);

        message[NOTIFICATION_CONNECT_UI] = true;

        message[operType] = operType;

 

        if(operType == 1){

            message[onlyId] = (int)onlyId;    //立钻哥哥:获取单个

        }else if(operType == 2){

            message[mailType] = (int)mailType;    //获取全部

        }

 

        message.Send(true, true, null);

    }

 

    private void ResponseGetMailRewardData(Message message){

        Debug.Log(立钻哥哥:ResponseGetMailRewardData);

  

        Dictionary<string, object> dicData = message.Content as Dictionary<string, object>;

        this.LoadAllMailData(dicData);

        MessageCenter.Instance.SendMessage(ResponseRefreshMailItemData, this, null, false);

    }

}




###2.32MailData

###2.32MailData

++2.32MailData

++++MailData:邮件数据结构。

++++Scripts/GameLogic/Module/Mail/MailData.cs

++2.32.1MailData

//立钻哥哥:邮件数据结构(Scripts/GameLogic/Module/Mail/MailData.cs

using UnityEngine;

using System.Collections;

using System.Collections.Generic;

 

public enum EnumMailType{

    mail_none = 0,

    mail_system = 1,

    mail_battleReport = 2,

    mail_all = 3,

}

 

public class MailInfoData{

    public long OnlyId{  private set;    get;  }    //立钻哥哥:唯一ID

    public int MailCfgId{  private set;    get;  }    //邮件配置目标ID

    public int MailType{  private set;    get;  }    //邮件类型

    public long CreateTime{  private set;    get;  }    //创建时间,秒数

    public long RewardTime{  private set;    get;  }    //领取奖励时间

    public long OutDateTime{  private set;    get;  }    //过期时间,秒数

    public int State{  private set;    get;  }    //立钻哥哥:0:未领奖,1:已领奖励

    public List<string> paramList = new List<string>();    //邮件参数集合

    public RewardController rewardController = new RewardController();    //奖励数据

    public MailPrototype mailPrototype = null;

    public string Content{  private set;    get;  }    //邮件内容

 

    public MailInfoData(int onlyId, int cfgId, int type, long createTime, long rewardTime, long outDaeTime, int state){

        this.OnlyId = onlyId;

        this.MailCfgId = cfgId;

        this.MailType = type;

        this.CreateTime = createTime;

        this.RewardTime = rewardTime;

        this.OutDateTime = outDateTime;

        this.State = state;

 

        if(param != null){

            this.paramList = param;

        }

 

        if(reward != null){

            rewardController = reward;

        }

 

        mailPrototype = ConfigManager.Instance.mailPrototypes.Find(this.MailCfgId);

 

        //立钻哥哥:设置内容,如果参数不够

        if(this.paramList.Count < mailPrototype.paramCount){

            int subCount = mailPrototype.paramCount - this.paramList.Count;

            for(int i = 0;  i < subCount;  i++){

                this.paramList.Add(“”);

            }

        }

 

        this.Content = string.Format(mailPrototype.content, this.paramList.ToArray());

    }

 

    public static MailInfoData GetMailInfoData(Dictionary<string, object> dicData){

        int onlyId = int.Parse(dicData[onlyId].ToString());

        int cfgId = int.Parse(dicData[mailCfgId].ToString());

        int type = int.Parse(dicData[mailType].ToString());

        long createTime = long.Parse(dicData[createTime].ToString());

        long awardTime = long.Parse(dicData[awardTime].ToString());

        long outDateTime = long.Parse(dicData[outDateTime].ToString());

        int state = int.Parse(dicData[state].ToString());

 

        //参数

        List<string> paramList = new List<string>();

        if(dicData.ContainsKey(params)){

            List<object> tempParamList = dicData[parmas] as List<object>;

            for(int i = 0;  i < tempParamList.Count;  i++){

                paramList.Add(tempParamList[i].ToString());

            }

        }

 

         //奖励

        RewardController rewardController = new RewardController();

        rewardController.ParseReward(dicData);

 

        MailInfoData data = new MailInfoData(onlyId, cfgId, type, createTime, awardTime, outDateTime, state);

 

        return data;

    }

 

    public override string ToString(){

        return string.Format(MailInfoData: OnlyId={0}, MailCfgId={1}, MailType={2}, .... );

    }

 

}


======[立钻哥哥带您学框架]:

游戏框架(框架入门篇)_第8张图片


++立钻哥哥推荐的拓展学习链接(Link_Url

++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/

++++游戏框架(初探篇)https://blog.csdn.net/VRunSoftYanlz/article/details/80630325

++++设计模式简单整理https://blog.csdn.net/vrunsoftyanlz/article/details/79839641

++++U3D小项目参考https://blog.csdn.net/vrunsoftyanlz/article/details/80141811

++++UML类图https://blog.csdn.net/vrunsoftyanlz/article/details/80289461

++++Unity知识点0001https://blog.csdn.net/vrunsoftyanlz/article/details/80302012

++++U3D_Shader编程(第一篇:快速入门篇)https://blog.csdn.net/vrunsoftyanlz/article/details/80372071

++++U3D_Shader编程(第二篇:基础夯实篇)https://blog.csdn.net/vrunsoftyanlz/article/details/80372628

++++Unity引擎基础https://blog.csdn.net/vrunsoftyanlz/article/details/78881685

++++Unity面向组件开发https://blog.csdn.net/vrunsoftyanlz/article/details/78881752

++++Unity物理系统https://blog.csdn.net/vrunsoftyanlz/article/details/78881879

++++Unity2D平台开发https://blog.csdn.net/vrunsoftyanlz/article/details/78882034

++++UGUI基础https://blog.csdn.net/vrunsoftyanlz/article/details/78884693

++++UGUI进阶https://blog.csdn.net/vrunsoftyanlz/article/details/78884882

++++UGUI综合https://blog.csdn.net/vrunsoftyanlz/article/details/78885013

++++Unity动画系统基础https://blog.csdn.net/vrunsoftyanlz/article/details/78886068

++++Unity动画系统进阶https://blog.csdn.net/vrunsoftyanlz/article/details/78886198

++++Navigation导航系统https://blog.csdn.net/vrunsoftyanlz/article/details/78886281

++++Unity特效渲染https://blog.csdn.net/vrunsoftyanlz/article/details/78886403

++++Unity数据存储https://blog.csdn.net/vrunsoftyanlz/article/details/79251273

++++Unity中Sqlite数据库https://blog.csdn.net/vrunsoftyanlz/article/details/79254162

++++WWW类和协程https://blog.csdn.net/vrunsoftyanlz/article/details/79254559

++++Unity网络https://blog.csdn.net/vrunsoftyanlz/article/details/79254902

++++C#事件https://blog.csdn.net/vrunsoftyanlz/article/details/78631267

++++C#委托https://blog.csdn.net/vrunsoftyanlz/article/details/78631183

++++C#集合https://blog.csdn.net/vrunsoftyanlz/article/details/78631175

++++C#泛型https://blog.csdn.net/vrunsoftyanlz/article/details/78631141

++++C#接口https://blog.csdn.net/vrunsoftyanlz/article/details/78631122

++++C#静态类https://blog.csdn.net/vrunsoftyanlz/article/details/78630979

++++C#中System.String类https://blog.csdn.net/vrunsoftyanlz/article/details/78630945

++++C#数据类型https://blog.csdn.net/vrunsoftyanlz/article/details/78630913

++++Unity3D默认的快捷键https://blog.csdn.net/vrunsoftyanlz/article/details/78630838

++++游戏相关缩写https://blog.csdn.net/vrunsoftyanlz/article/details/78630687

++++立钻哥哥Unity 学习空间: http://blog.csdn.net/VRunSoftYanlz/

 

#立钻哥哥Unity学习空间:http://blog.csdn.net/VRunSoftYanlz/

--_--VRunSoft : lovezuanzuan--_--

你可能感兴趣的:(unity,游戏框架,游戏架构,UI框架,MVC,框架编程)