├── .gitattributes ├── .gitignore ├── Content ├── log.md ├── 《CLR Via C#》 │ └── CLR.md ├── 《GameProject》 │ ├── BuildProtobuff │ │ ├── BuildProtobuff.md │ │ └── Media │ │ │ ├── vs_cmd.jpg │ │ │ ├── vs_cmd_1.jpg │ │ │ ├── vs_cmd_2_cmake_h.jpg │ │ │ ├── vs_cmd_2_cmake_h_0.jpg │ │ │ ├── vs_cmd_3_Release.jpg │ │ │ ├── vs_cmd_3_Release_nmake.jpg │ │ │ ├── vs_cmd_4_Debug.jpg │ │ │ ├── vs_cmd_4_Debug_nmake.jpg │ │ │ ├── vs_cmd_5_solution.jpg │ │ │ ├── vs_cmd_5_solution_build.jpg │ │ │ └── vs_cmd_6_install.png │ ├── GameProject_AssetBundle.md │ ├── GameProject_GS&BH3.md │ ├── GameProject_Menue.md │ ├── IOS平台发布相关 │ │ ├── GameProject_IOS.md │ │ └── 客户端出包流程.xlsx │ ├── Media │ │ ├── RunCSharpLuaTool.png │ │ ├── ab_0.webp │ │ ├── ab_1.webp │ │ ├── ab_2.webp │ │ ├── ab_3.webp │ │ ├── ab_4.jpg │ │ ├── tec_1.png │ │ ├── tec_2.png │ │ ├── tec_3.png │ │ ├── tec_4.png │ │ └── tec_5.png │ ├── UI │ │ ├── GameProject_UI.md │ │ ├── ILRuntime.md │ │ └── Media │ │ │ ├── CLR_Type.png │ │ │ ├── GetWayConfigIns.png │ │ │ ├── GetWayConfigIns_1.png │ │ │ ├── ILIntepreter.png │ │ │ ├── ILProcess.png │ │ │ ├── ILR_CIR_Redirection.png │ │ │ ├── IL_OpCode.png │ │ │ ├── IL_OpCode_1.png │ │ │ ├── IL_Warring.png │ │ │ ├── LayoutGroup.png │ │ │ ├── shipei1.png │ │ │ ├── shipei2.png │ │ │ ├── shipei3.png │ │ │ ├── shipei4.png │ │ │ └── stackframe.png │ ├── doc技术文档 │ │ ├── Op备忘录.docx │ │ └── 整体设计框架.docx │ └── 《GameProject》.rar ├── 《GameUnity》 │ ├── Blender.md │ ├── Cinemachine.md │ ├── GameUnity.md │ ├── MediaTimeline │ │ ├── Activation_Track_Inspactor.png │ │ ├── Aim.png │ │ ├── Aim0.png │ │ ├── BindingMode.jpg │ │ ├── CinemachineBlendListMenue.png │ │ ├── CinemachineClearShot.png │ │ ├── CinemachineCollider.png │ │ ├── CinemachineConfiner.png │ │ ├── CinemachineFreelook.png │ │ ├── CinemachineFreelookMenue.png │ │ ├── CinemachineMenue.jpg │ │ ├── CinemachineStateDrivenCamera.png │ │ ├── CinemachineTargetGroup.png │ │ ├── ComposerArea.jpg │ │ ├── ComposerMenue.png │ │ ├── Editor_Clip.png │ │ ├── FollowZoom.png │ │ ├── FramingTransposer.png │ │ ├── FramingTransposer1.jpg │ │ ├── GroupComposerArea.jpg │ │ ├── GroupComposerMenue.png │ │ ├── HardLockToTarget.png │ │ ├── ImpluseMenue.png │ │ ├── MixingCameraMenue.png │ │ ├── Noise.png │ │ ├── Noise0.png │ │ ├── Noise1.png │ │ ├── OrbitalTransposer.png │ │ ├── POV.png │ │ ├── SaveDuringPlay.png │ │ ├── StoryBoard.png │ │ ├── TrackedDolly.png │ │ ├── Transposer.png │ │ ├── anim_record.png │ │ └── timelineTrack.png │ ├── TimeLine.md │ └── 《SRP》 │ │ ├── SRP.md │ │ ├── SRPMedia │ │ ├── CIExy1931_sRGB.png │ │ ├── Camera_Gamma2.jpg │ │ ├── SRGB_gamma.png │ │ ├── cameraGamma.jpg │ │ ├── cameraGamma1.jpg │ │ └── monitor.jpg │ │ └── 色调.md ├── 《IDAPro权威指南》 │ └── IDA_PRO.md ├── 《IL翻译Lua》 │ ├── 2、ILSpy │ │ ├── .Net Compiler Platform SDK.md │ │ ├── AST.md │ │ ├── CsharpLua.md │ │ ├── ILSpay记录.md │ │ └── TestTemp.md │ └── 3、Decompiler │ │ └── ILLua.md ├── 《LearnOpenGL》 │ └── 1、Base.md ├── 《Unity Scriptable Render Pipeline》 │ ├── Inctrodution-of-Univeral-RP.md │ └── Media │ │ └── distortion.png ├── 《Unity内置Shader解析》 │ └── README.md ├── 《代码的简洁之道》 │ └── ClearCode.md ├── 《全局光照技术》 │ └── README.md ├── 《加密与解密》 │ └── README.md ├── 《大话设计模式》 │ ├── HeadFirst.md │ └── Media │ │ ├── 1.png │ │ └── 2.jpg ├── 《有用的商学课》 │ └── README.md ├── 《游戏编程模式》 │ └── README.md ├── 休闲游戏 │ ├── APP.md │ ├── CRGame.md │ ├── CRMedia │ │ └── 成长碎片 │ │ │ ├── wf_shuipian_0.png │ │ │ ├── wf_shuipian_get.png │ │ │ ├── wf_shuipian_解锁炮塔位置.png │ │ │ ├── wf_战斗主场景.png │ │ │ ├── wf_武器列表.png │ │ │ └── wf_武器属性.png │ ├── Media │ │ ├── infoImage1.png │ │ ├── infoImage2.png │ │ ├── infoImage3.jpg │ │ ├── infoImage4.jpg │ │ ├── infoImage5.jpg │ │ └── infoImage6.jpg │ └── selfGame.md ├── 各种工具 │ ├── Md文档.md │ ├── Media │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ └── 3.jpg │ ├── Tools.md │ └── vpn.rar ├── 文案 │ ├── 关于项目团队 │ ├── 关于项目团队.md │ ├── 数值 │ │ ├── 古羌传奇数值设定 - 副本.xlsx │ │ ├── 战斗过程的基本数值知识与理论--网易.doc │ │ ├── 数值.md │ │ ├── 数值.zip │ │ └── 数值框架-属性篇by张锋.pdf │ └── 自动手记人偶 │ │ └── log.md ├── 源码阅读 │ ├── OP源码阅读记录.txt │ ├── 东京食尸鬼源码阅读记录.md │ ├── 原神源码阅读记录.md │ ├── 大梦龙图 │ │ ├── DodGameLib.dll │ │ ├── DodProtoBase.dll │ │ ├── Media │ │ │ ├── AssetUpdater.cs │ │ │ ├── AssetVersionMgr.cs │ │ │ ├── DMLT │ │ │ │ ├── DodGameLib.dll │ │ │ │ ├── DodProtoBase.dll │ │ │ │ ├── GameBase.dll │ │ │ │ ├── GameLogic.dll │ │ │ │ ├── GameNative.dll │ │ │ │ ├── GameProto.dll │ │ │ │ ├── IgnorAsset.txt │ │ │ │ ├── NeverExpireDir.txt │ │ │ │ ├── PackToDirRule.txt │ │ │ │ ├── ResourceDir.txt │ │ │ │ ├── ResourcesImp.cs │ │ │ │ ├── SharedDependAsset.txt │ │ │ │ ├── UnityEngine.UI.dll │ │ │ │ ├── UnityEngine.dll │ │ │ │ ├── need_cache_list.txt │ │ │ │ ├── need_persist_assetbundle.txt │ │ │ │ ├── need_persist_list.txt │ │ │ │ └── 文件说明.txt │ │ │ ├── GameBase.png │ │ │ ├── GameNative.png │ │ │ ├── Game_1.jpg │ │ │ ├── Game_10.jpg │ │ │ ├── Game_11.jpg │ │ │ ├── Game_2.jpg │ │ │ ├── Game_3.jpg │ │ │ ├── Game_4.jpg │ │ │ ├── Game_5.jpg │ │ │ ├── Game_6.png │ │ │ ├── Game_7.jpg │ │ │ ├── Game_8.jpg │ │ │ ├── Game_9.jpg │ │ │ ├── ResourcesImp1.cs │ │ │ ├── XGameStartup.cs │ │ │ └── 资源规则 │ │ │ │ ├── IgnorAsset.txt │ │ │ │ ├── NeverExpireDir.txt │ │ │ │ ├── PackToDirRule.txt │ │ │ │ ├── ResourceDir.txt │ │ │ │ ├── SharedDependAsset.txt │ │ │ │ ├── need_cache_list.txt │ │ │ │ ├── need_persist_assetbundle.txt │ │ │ │ ├── need_persist_list.txt │ │ │ │ └── 文件说明.txt │ │ └── 大梦龙图SLG源码阅读记录.md │ ├── 崩坏3源码阅读记录.md │ ├── 死神阅读记录.md │ └── 还原神作解密.rar ├── 脱壳逆向 │ ├── Media │ │ ├── GG │ │ │ ├── gg_1.png │ │ │ ├── gg_2.png │ │ │ ├── gg_3.png │ │ │ ├── gg_4.png │ │ │ └── gg_5.png │ │ ├── a.png │ │ ├── adb.png │ │ ├── error.png │ │ ├── frida-轮回决-hook.js │ │ └── 元气骑士il2cpp-hook-源码.zip │ ├── README.md │ ├── ShellCode.md │ ├── 原神.rar │ ├── 原神 │ │ ├── Media │ │ │ ├── 0.png │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ ├── 7.png │ │ │ ├── 8.png │ │ │ └── 9.png │ │ └── 原神.md │ └── 逆向一些事.md ├── 计算科学速成 │ ├── 1. 计算机早期历史-Early Computing.ass.md │ ├── 10. 早期的编程方式-Early Programming.ass.txt │ ├── 11. 编程语言发展史-The First Programming Languages.ass.txt │ ├── 12. 编程原理-语句和函数-Programming Basics - Statements & Functions.ass.txt │ ├── 13. 算法入门 - Intro to Algorithms.ass.txt │ ├── 14. 数据结构-Data Structures.ass.txt │ ├── 15. 阿兰·图灵-Alan Turing.ass.txt │ ├── 16. 软件工程-Software Engineering.ass.txt │ ├── 17. 集成电路&摩尔定律-Integrated Circuits & Moore’s Law.ass.txt │ ├── 18. 操作系统-Operating Systems.ass.txt │ ├── 19. 内存&储存介质-Memory & Storage.mp4.ass.txt │ ├── 2. 电子计算机-Electronic Computing.ass.md │ ├── 20. 文件系统-Files & File Systems.ass.txt │ ├── 21. 压缩-Compression.ass.txt │ ├── 22. 命令行界面-Keyboards & Command Line Interfaces.ass.txt │ ├── 23. 屏幕&2D 图形显示-Screens&2D Graphics.ass.txt │ ├── 24. 冷战和消费主义-The Cold War and Consumerism.ass.txt │ ├── 25. 个人计算机革命-The Personal Computer Revolution.ass.txt │ ├── 26. 图形用户界面-Graphical User Interfaces.ass.txt │ ├── 27. 3D 图形-3D Graphics.ass.txt │ ├── 28. 计算机网络-Computer Networks.ass.txt │ ├── 29. 互联网-The Internet.ass.txt │ ├── 3. 布尔逻辑 和 逻辑门-Boolean Logic & Logic Gates.ass.txt │ ├── 30. 万维网-The World Wide Web.ass.txt │ ├── 31. 计算机安全-Cybersecurity.ass.txt │ ├── 32. 黑客&攻击-Hackers & Cyber Attacks.ass.txt │ ├── 33. 加密-Cryptography.ass.txt │ ├── 34. 机器学习&人工智能-Machine Learning & Artificial Intelligence.ass.txt │ ├── 35. 计算机视觉-Computer Vision.ass.txt │ ├── 36. 自然语言处理-Natural Language Processing.ass.txt │ ├── 37. 机器人-Robots.ass.txt │ ├── 38. 计算机心理学 - Psychology of Computing.ass.txt │ ├── 39. 教育科技-Educational Technology.ass.txt │ ├── 4. 二进制-Representing Numbers and Letters with Binary.ass.txt │ ├── 40. 奇点,天网,计算机的未来-The Singularity, Skynet, and the Future of Computing.ass.txt │ ├── 5. 算术逻辑单元-How Computers Calculate-the ALU.ass.txt │ ├── 6. 寄存器 & 内存-Registers and RAM.ass.txt │ ├── 7. 中央处理器-The Central Processing Unit(CPU).ass.txt │ ├── 8. 指令和程序-Instructions & Programs.ass.txt │ └── 9. 高级CPU设计-Advanced CPU Designs.ass.txt └── 设计模拟板 │ ├── Media │ ├── BusinessProcessDiagram.png │ ├── DomainModel.png │ ├── PushSequenceDiagram.png │ ├── SystemArchitecture.png │ ├── model.png │ └── 晋升答辩.pptx │ └── README.md ├── ContentCW.code-workspace ├── Media ├── cover.jpg └── cover2.jpg ├── Other └── 结果导向.md └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk -------------------------------------------------------------------------------- /Content/log.md: -------------------------------------------------------------------------------- 1 | Connected to server 2 | [2020-02-04 09:02:35,105] Artifact test:Web exploded: Artifact is being deployed, please wait... 3 | 二月 04, 2020 9:02:35 下午 org.apache.catalina.deploy.WebXml setVersion 4 | 警告: Unknown version string [3.1]. Default version will be used. 5 | 二月 04, 2020 9:02:35 下午 org.apache.catalina.core.ContainerBase addChildInternal 6 | 严重: ContainerBase.addChild: start: 7 | org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test_Web_exploded]] 8 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162) 9 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018) 10 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) 11 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) 12 | at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1899) 13 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 14 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 15 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16 | at java.lang.reflect.Method.invoke(Method.java:606) 17 | at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) 18 | at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 19 | at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 20 | at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:619) 21 | at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:566) 22 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 23 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 24 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 25 | at java.lang.reflect.Method.invoke(Method.java:606) 26 | at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) 27 | at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 28 | at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 29 | at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) 30 | at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487) 31 | at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97) 32 | at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328) 33 | at java.security.AccessController.doPrivileged(Native Method) 34 | at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1427) 35 | at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848) 36 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 37 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 38 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 39 | at java.lang.reflect.Method.invoke(Method.java:606) 40 | at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322) 41 | at sun.rmi.transport.Transport$2.run(Transport.java:202) 42 | at sun.rmi.transport.Transport$2.run(Transport.java:199) 43 | at java.security.AccessController.doPrivileged(Native Method) 44 | at sun.rmi.transport.Transport.serviceCall(Transport.java:198) 45 | at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567) 46 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828) 47 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619) 48 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684) 49 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681) 50 | at java.security.AccessController.doPrivileged(Native Method) 51 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681) 52 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 53 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 54 | at java.lang.Thread.run(Thread.java:745) 55 | Caused by: java.lang.UnsupportedClassVersionError: org/springframework/web/SpringServletContainerInitializer : Unsupported major.minor version 52.0 (unable to load class org.springframework.web.SpringServletContainerInitializer) 56 | at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3255) 57 | at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1420) 58 | at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1924) 59 | at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1798) 60 | at java.lang.Class.forName0(Native Method) 61 | at java.lang.Class.forName(Class.java:274) 62 | at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:197) 63 | at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:158) 64 | at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1579) 65 | at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1273) 66 | at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881) 67 | at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388) 68 | at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) 69 | at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 70 | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5606) 71 | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) 72 | ... 46 more 73 | 74 | 二月 04, 2020 9:02:35 下午 org.apache.tomcat.util.modeler.BaseModelMBean invoke 75 | 严重: Exception invoking method manageApp 76 | java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test_Web_exploded]] 77 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1022) 78 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) 79 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) 80 | at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1899) 81 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 82 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 83 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 84 | at java.lang.reflect.Method.invoke(Method.java:606) 85 | at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) 86 | at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 87 | at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 88 | at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:619) 89 | at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:566) 90 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 91 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 92 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 93 | at java.lang.reflect.Method.invoke(Method.java:606) 94 | at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) 95 | at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 96 | at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 97 | at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) 98 | at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487) 99 | at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97) 100 | at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328) 101 | at java.security.AccessController.doPrivileged(Native Method) 102 | at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1427) 103 | at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848) 104 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 105 | [2020-02-04 09:02:35,439] Artifact test:Web exploded: Error during artifact deployment. See server log for details. 106 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 107 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 108 | at java.lang.reflect.Method.invoke(Method.java:606) 109 | at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322) 110 | at sun.rmi.transport.Transport$2.run(Transport.java:202) 111 | at sun.rmi.transport.Transport$2.run(Transport.java:199) 112 | at java.security.AccessController.doPrivileged(Native Method) 113 | at sun.rmi.transport.Transport.serviceCall(Transport.java:198) 114 | at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567) 115 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828) 116 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619) 117 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684) 118 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681) 119 | at java.security.AccessController.doPrivileged(Native Method) 120 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681) 121 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 122 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 123 | at java.lang.Thread.run(Thread.java:745) 124 | 125 | 二月 04, 2020 9:02:35 下午 org.apache.tomcat.util.modeler.BaseModelMBean invoke 126 | 严重: Exception invoking method createStandardContext 127 | javax.management.RuntimeOperationsException: Exception invoking method manageApp 128 | at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:309) 129 | at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 130 | at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 131 | at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:619) 132 | at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:566) 133 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 134 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 135 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 136 | at java.lang.reflect.Method.invoke(Method.java:606) 137 | at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) 138 | at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) 139 | at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) 140 | at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468) 141 | at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487) 142 | at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97) 143 | at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328) 144 | at java.security.AccessController.doPrivileged(Native Method) 145 | at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1427) 146 | at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848) 147 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 148 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 149 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 150 | at java.lang.reflect.Method.invoke(Method.java:606) 151 | at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322) 152 | at sun.rmi.transport.Transport$2.run(Transport.java:202) 153 | at sun.rmi.transport.Transport$2.run(Transport.java:199) 154 | at java.security.AccessController.doPrivileged(Native Method) 155 | at sun.rmi.transport.Transport.serviceCall(Transport.java:198) 156 | at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567) 157 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828) 158 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619) 159 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684) 160 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681) 161 | at java.security.AccessController.doPrivileged(Native Method) 162 | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681) 163 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 164 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 165 | at java.lang.Thread.run(Thread.java:745) 166 | Caused by: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test_Web_exploded]] 167 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1022) 168 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) 169 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) 170 | at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1899) 171 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 172 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 173 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 174 | at java.lang.reflect.Method.invoke(Method.java:606) 175 | at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) 176 | ... 37 more -------------------------------------------------------------------------------- /Content/《CLR Via C#》/CLR.md: -------------------------------------------------------------------------------- 1 | [1、基础类型](#001) 2 | [12、泛型](#012) 3 | [2、.NET Framework 工具](#101) 4 |

1、类型基础

5 | 6 |

12、泛型

7 | 泛型基础结构,为了加入泛型,CLR必须完成以下工作 8 | 9 | * 创建新的IL指令, 10 | 11 | 12 |

.NET Framework 工具

13 | 14 | - [.NET Framework 工具](https://docs.microsoft.com/zh-cn/dotnet/framework/tools/index) 15 | 路径:【C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools】 16 | 17 | 18 |

12、泛型

19 | 20 | 好处:(p253) 21 | 22 | * 源代码 保护 23 | * 类型安全 24 | * 更清晰的代码 25 | * 更佳的性能 26 | 27 | -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/BuildProtobuff.md: -------------------------------------------------------------------------------- 1 | [Cmake 一些基本语法的学习](#000) 2 | [编译Protobuff 源码](#001) 3 | 4 |

一、 Cmake 一些基本语法的学习

5 | 6 | 7 | 8 | 9 |

二、 编译Protobuff 源码

10 | 由于适配ILR protobuff 需要做些更改。涉及到protobuff的编译,和相关protoc 工具的编译。 11 | 12 | 需要准备的原材料[Protobuff]() 13 | [ILRuntime]() 14 | 15 | 一、打开vs的编译工具 16 | ![](Media/vs_cmd.jpg) 17 | 18 | 1)、下载Protobuff源码创建目录 install : mkdir install。 19 | 进入到cmake 目录下,创建编译输出的目录build: mkdir build & cd build 20 | ![](Media/vs_cmd_1.jpg) 21 | 22 | 2)、 查看cmake 命令行参数 cmake -h Usage , 不同vs版本有不同的一些生成命令 23 | ![](Media/vs_cmd_2_cmake_h.jpg) 24 | ![](Media/vs_cmd_2_cmake_h_0.jpg) 25 | 26 | 3)、Relase版本编译:cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../../install ../.. 27 | 28 | ![](Media/vs_cmd_3_Release.jpg) 29 | nmake编译结果: 30 | ![](Media/vs_cmd_3_Release_nmake.jpg) 31 | 3)、Debug版本编译:cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../../install ../.. 32 | ![](Media/vs_cmd_4_Debug.jpg) 33 | nmake 编译结果: 34 | ![](Media/vs_cmd_4_Debug_nmake.jpg) 35 | 36 | 4)、Solution编译: cmake -G "Visual Studio 16 2019" -DprotoBuf_Build_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../../install ../../ 37 | ![](Media/vs_cmd_5_solution.jpg) 38 | ![](Media/vs_cmd_5_solution_build.jpg) 39 | ![](Media/vs_cmd_6_install.jpg) 40 | 41 | [# 参考文档](https://blog.csdn.net/zxng_work/article/details/78936444#%E4%B8%8B%E8%BD%BD%E4%BB%A3%E7%A0%81) 42 | 43 | cmake -G "Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=./ConvertProject ./ -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_1.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_2_cmake_h.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_2_cmake_h.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_2_cmake_h_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_2_cmake_h_0.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_3_Release.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_3_Release.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_3_Release_nmake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_3_Release_nmake.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_4_Debug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_4_Debug.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_4_Debug_nmake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_4_Debug_nmake.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_5_solution.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_5_solution.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_5_solution_build.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_5_solution_build.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/BuildProtobuff/Media/vs_cmd_6_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/BuildProtobuff/Media/vs_cmd_6_install.png -------------------------------------------------------------------------------- /Content/《GameProject》/GameProject_AssetBundle.md: -------------------------------------------------------------------------------- 1 | * [unity中的资源关系](#-1) 2 | * [unity中的资源接口](#0) 3 | * [unity中的ab细节](#1) 4 | * [ab的运行时管理思路](#2) 5 | 6 |

unity中的资源关系

7 | 8 | [unity内存管理](https://www.jianshu.com/p/cf3ab3bac1ab)
9 | [资源管理](https://blog.uwa4d.com/archives/USparkle_Addressable1.html)
10 | [资源加载而](https://mp.weixin.qq.com/s/0XFQt8LmqoTxxst_kKDMjw?)
11 | [unity数据格式](https://blog.uwa4d.com/archives/USparkle_inf_UnityEngine.html)
12 | 13 | 14 |

unity中的资源接口

15 | 16 | [unityAssetBundle运行时](http://blog.sina.com.cn/s/blog_c3e21e750102yfng.html) 17 | 18 | 19 | unity的资源加载接口有: 20 | Resource.Load 21 | AssetBundle.Load: 22 | Instacse:实例化,从asset 实例化出来的对象有的是 conle 有的是引用,属于引用类型资源的有 23 | 卸载接口: 24 | GameObject.Destroy(gameObject),销毁该物体; 25 | AssetBundle.Unload(false),释放AssetBundle文件内存镜像,不销毁Load创建的Assets对象; 26 | AssetBundle.Unload(true),释放AssetBundle文件内存镜像同时销毁所有已经Load的Assets内存镜像; 27 | Resources.UnloadAsset(Object),释放已加载的Asset对象; 28 | Resources.UnloadUnusedAssets,释放所有没有引用的Asset对象。 29 | 30 | 动态加载,res.load 和 ab.load . 静态加载 Instantiate 实例化 31 | 32 | AB的运行时加载: 33 | 来自文件用CreateFromeFile 创建一个assetbundle,创建完后等于把硬盘或者网络的一个文件读到内存区域,这个时候ab只是内存镜像数据块,还没有asset。 34 | ab打包方式的不同,又导致内存加载这块有所差别。 35 | Lz4 加载ab 只把ab的数据头加载进内存。 lzma会将整个ab加载进内存。 36 | ab使用lz4的方式加载ab的时候只加载ab头速度比较快。 unity5.6的源码中,加载ab内部实现加载ab的实现,也是在主线程加载的,因为加载ab的时候需要创建texture ,gameobject这些的guid, 37 | 不同ab间的这个guid是要保持一致性的,用异步的话就需要对这些guid加锁。所以unity在创建的时候再主线程分时间片,加载,没帧分固定时间加载,没有加载完的话就到下次加载。所以ab的asyn和synunity内部都是同步实现的。同时业务上用异步的话需要遍历活开携程,总是会慢一帧 38 | 39 | 40 | Asset的加载: 41 | Ab.Load 从ab的内存镜像读取创建一个asset对象。创建asset也会分配内存存放。 42 | 43 | AB的释放: 44 | ab.unload(false) 释放ab文件内存镜像,不包含load创建的asset内存对象 45 | ab.unload(true) 释放ab内存镜像和销毁所有load创建的asset内存对象 46 | 47 | 资源创建的过程: 48 | 资源创建分两步,一个是Load Asset, 一个是 Instantiate。 49 | Load 出来的资源类型有GameObject,Transform ,Mesh ,Textrue , Material ,Shader ,Script等。Res.load 出来asset ,在第一次Instantiate前没有创建Asset。而 50 | ab.load 的时候就创建了asset。 51 | Instantiate 的过程是对Asset Clone(复制)和引用结合的过程。 Clone 需要申请内存存放自己数据,引用只是一个简单的指针指向已经Load的asset。例如Transform是通过Clone出来的,Texture和TerrainData是通过引用复制的,而Mesh,Material,PhysicalMaterial和Script是Clone和引用同时存在的。以Script为例,Script分为代码段和数据段,所有需要使用该Script的GameObject使用的代码是一样的,而大家的数据有所区别,因此对数据段需要使用Clone的方式,而对代码段需要使用引用的方式来复制。因此Load操作其实Load一些数据源出来,用于创建新对象时被Clone或者被引用。 52 | 53 | 资源销毁的过程: 54 | Object.Desctroy 只会销毁clone的asset,不会释放引用的asset。场景中没有任何引用asset的时候,会被标记为UnusedAsset 可以通过res.unloadUnsedAssets释放。Ab.unload(false) 只会释放ab内存镜像不会释放asset,ab.unload(true) 会把所有的ab和asset全部删除。 55 | 56 | 场景加载:所有内存对象都会被自动销毁,包括instantiate 和 load的asset,但是ab本身不会被销毁,要手动同过ab.unload 销毁。 57 | 58 |

ab的运行时管理思路

59 | 基于以上: 60 | ab运行时的管理方式就有多种了,都和ab的打包方式相关联。 61 | 方案一: 62 | 卸载ab通过ab.unload(true) 的方式。 63 | 这种方式需要对资源本身进行引用计数,然后关联的对ab进行引用计数。 直到逻辑层确保没有任何资源对ab引用了就强制卸载所有 64 | 这种方式和ab打包的方式有关。适合按英雄模块等打包方式。例如一个英雄的特效打包到一个ab,对于特效中有公共用到的资源 需要单独放到一个ab中。 65 | 这种方式资源使用期间ab是不卸载的。lz4方式ab的内存镜像加载并不大,是可以接受的。 66 | 这种方式就不好对asset 进行引用缓存,因为asset引用归零后,ab也可能立马归零,这时候直接卸载ab ,那缓存的池也要立马卸载。不然就会出现引用丢失情况。 67 | 除非可以对ab做缓存的卸载延时。 这样可以控制从ab加载出来的asset的资源的池控制。 68 | 如果一个asset引用为0 ,他的ab不一定就会马上卸载,因为其他资源可能还有对这个ab的引用。 69 | 70 | 所以这种方式想要对asset做可控的缓存池的话。 需要先对asset做缓存控制,然后为了不让asset立马被ab引用为0的时候立马被卸载掉,还要对ab做缓存延时管理。也就是说,需要一个管理器,记录asset的引用,同时还有他的ab的引用当要卸载的时候 是不是立即卸载还是一直保持在内存,还是等一小段时间再做卸载都可以可控。 71 | 72 | 这种方式还是需要做这种控制的,比如一些资源是常驻内存的,需要将这部分功能进行可控只,比如海贼中的shader 是一直在内存不卸载ab的。 73 | 74 | 所以true的方式资源管理下有以下需求: 75 | 76 | 77 | 1、需要有常驻内存的资源管理系统,比如shader是可以常驻内存的。 78 | 2、需要做对资源和ab的池管理缓存。使得ab和asset 不会立马进行卸载。 而是拥有可控的卸载时间段管理。 79 | ----由于计数管理是assetmgr 内部的,他有asset的计数和ab的计数,ab的计数卸载是在asset的计数卸载之下执行的,所以,如果 要做延时管理的话,只需要对asset 的引用计数进行缓存的延时管理就行,ab的实际卸载在asset本身的卸载后自动进行。 80 | ----方便对经常用的资源进行控制配置处理。 这里做的比较麻烦,asset的引用和ab的引用是基于 assetmgr 的。再次做一套缓存的话,管理器,需要对asset 和 ab的引用进行监听,如果是需要做缓存管理的资源,那么是需要监听assetmgr 本身的状态, 要么对assetmgr进行显示调用保持一个增加的计数。 81 | 82 | 需要 ResCacheMgr系统,加载资源先看Cache系统里是不是已经有了,同时他还承担对资源的常驻内存资源的管理和缓存资源的管理。 83 | 需要一个go池,他是给Cache系统用的。有需要的Asset要池的处理,和对应asset的引用管理。 84 | 需要一个BResources 加载器,决定资源的时候是从池里面加载 还是 从ab或其他加载器里面加载。这个主要是一个中转层。 85 | 86 | 实现细节: 87 | 实现Cache系统,Cahce系统主要保存一个AssetMgr中Asset的状态。,在AssetMgr要卸载Asset的时候需要在看下Cahce系统中是否可以直接卸载这个Asset,可以就直接卸载,不可以就等Cache系统要卸载的时候再次去调用AsssetMgr真正的卸载。 88 | 难点在于如何判断Cache系统是真的可以卸载,然后调用assetMgr: 89 | 卸载是手动调用assetmgr接口,对assetmgr中的引用计数更新卸载。从assetmgr中加载的资源是正确的计数,如果是从cache系统缓存池里加载如何计算呢。 90 | 91 | ----从上层BRes获取一个资源,不需要cache系统,加载卸载都是直接走正常的assetmgr 接口周期 92 | ----如果需要cache系统cache ,没有加到cache的话那么同时对assetmgr 和 cache系统的引用计数增加;cache中已经有了的话,那么不增加assetMgr的引用,只增加cache系统引用 ; 93 | ----移除一个资源的时候,调用assetmgr卸载移除接口,在接口中做处理判断是立即卸载还是等待cache系统做处理。 如果资源不需要cahche系统就直接卸载 ,需要cache系统,计数为0后还需要判断 ,如果需要cache系统的,看cache的状态是否可以清除这个资源,可以就直接清除,不可以就等cache系统自己判断可以清除了在清除。 这样就可以保证又池的情况下还能严格保证计数正确。 94 | ----cache系统可以直接调用assetmgr立即清除接口清除一个资源,而外部系统只能调用assetmgr普通卸载接口,卸载的时候要判断cahce系统,是否可以直接清除。 95 | ----底层池系统的设计,加载出资源的时候对go的hash做记录,并且添加路径的类型引用。 每从资源接口加载出来数据对象,是要缓存的类型,就讲这个对象信息加入池,他的类型引用计数也加1。 当对go回收的时候,因为已经有要维护存的次对象的go数据,可以看是不是放入次中,放入的话,那计数等不变放入池中。直接将go放入池节点。 如果不是或者不池满了等,就要销毁当前go,减少池对象数量。 96 | 池对象的添加: 从res接口中药缓存的对象加载出实例后产生的。 当即添加此对象的属性信息,真假引用计数。还是需要上层手动回收调用。 97 | 池对象的回收: 从业务层调用回收对象的接口。 回收只有等销毁的时候,需要减少引用计数。 98 | 池对象的引用计数: 用于是否可以销毁 cache系统的asset cache。没有引用的时候可以清楚相关的池。 99 | 100 | 对于GameObject类型对象是有池的处理,其他对象没有。 101 | 上层调用res接口的时候,还是要先依次对于调用卸载接口。 然后如果是GameObject类型还要调用 安全的Destry 进行回收处理 102 | 103 | 获取的AssetIns 如果是需要缓存池类型的,当回收的时候需要做两件事情,调用AssetMgr的资源卸载 ,和对AssetIns的资源缓存接口进行缓存。 卸载可以封装到和缓存一个接口么? 104 | 105 | 有一个难点: 对于卸载的细节实现:通常上层只调用assetmgr的卸载接口,所以对于cache的引用也是要用基于上层调用的卸载而不是,基于加载res时候添加记基于GameObject 实例添加引用,然后卸载GameObject 调用销毁接口进行引用减。 106 | 107 | 但是如果能把使用的Obj的销毁的时候 做成自动调用的回收的话,那就不用通过上层的assetmgr卸载调用来减少引用了。 108 | 109 | 反思: 资源底层的接口,是没有办法完全做到单项加载的。 比如池管理,就必须要要结合上层管理器去做处理。 那么同理,资源的卸载接口也是如此。 资源主要关注三个,英雄,特效,模型。 每个资源都有他的生命周期,资源管理器需要在架构的周期内进行资源的加载卸载周期处理。 110 | 111 | 现在从资源管理器中加载一个资源,那么卸载的时候一定要调用卸载资源,如果是GameObject的类型,那还要周期内调用池的卸载接口。 112 | 113 | 114 | 115 | 方案二: 116 | 卸载ab通过ab.unload(false) 的方式。 117 | 这种方式需每次加载完asset 就直接对ab进行卸载。 对于lzma方式比较合适,lzma 每次把文件的镜像都加载进内存了,及时卸载ab能减少内存占中。 118 | 但是这种方式ab的打包颗粒度需要更加细化。 不然容易出现内存的泄露,例如上面所得 英雄特效 ,ab1【eff1,eff2,tex1】eff1,2都引用了tex1,加载了 119 | eff1 ,tex1 也创建了asset,卸载ab后再次加载eff2的话,就丢失了对已经存在的tex1的引用,又从新创建了一份tex1的asset。除非加载逻辑层吧每个资源 120 | 的依赖asset也做记录,然后对asset 做一套换成记录系统,自己保持对asset的引用,但是这样一是让系统更加复杂,二是,还不如细分ab,将这种有多重依赖的 121 | 资源打成单个的ab。 但这样细读更细了,势必会导致加载过程比第一种更慢,有更多的io了。 122 | 123 | 这种方式通过对asset对引用计数缓存。 没有用引用了也可以暂时不马上标记没引用,而是等一段时间没有在标记卸载。 124 | 125 | 具体取舍和项目有关。 126 | 127 |
128 | 129 | ![](Media/ab_4.webp) 130 | 131 |
132 | 133 | 134 |

unity中的ab细节

135 | 136 | Bundle的size 有header信息和block数据块和额外的一些数据data组成。 137 | Blocks根据不同的压缩方式会有不同的组织形式,譬如下图LZ4,它会产生三个压缩的Blocks,所以在读取资源的时候会先找到资源被压缩在哪个Blocks上,然后把Blocks解压并且Seek到对应位置去读对应的数据。而LZMA只有一个Block,需要把整个Blocks都解压后在读取对应的数据。 138 | 139 | ab加载的时候 lz4 也只是加载信息头到内存,读取数据的时候根据数据偏移去寻找加载数据块 140 |
141 | 142 | ![](Media/ab_1.webp) 143 | 144 |
145 | 146 | WebExtract解开的文件都是二进制文件,并不是明文,通过使用Binary2Text的工具可以把这些二进制文件直接反序列化成明文。 147 | -detailed这个参数可以让序列化出来的文本带上更多详细的信息,包括这个资源占用了大小是多少,哪些大哪些小。 148 | -hexfloat这个参数是把浮点数都以16进制的格式来输出,这样能够保证浮点精度的输出。我们曾经遇到过两次构建有差异的问题,通过WebExtract跟Binary2Text解开后发现文件还是一致的,但后面细查发现是因为float的输出的问题。所以加入了这个参数。 149 | 150 |
151 | 152 | ![](Media/ab_0.webp) 153 | 154 |
155 | 156 | 解开的文本文件大家可以一目了然的清楚知道里面的结构是如何,会包含哪些东西。 157 | 解开后文本内不同资源需要关注的一些点: 158 | Assetbundle块:记录着当前AB的Assets,而Asset又会有PreloadIndex以及PreloadSzie来定义如何能把Asset给组织起来。 159 | PreloadData块:当前AB的Assets的依赖的Asset资源。 160 | External References块:引用外部的Assetbundle的列表,m_FileID & m_PathID: m_FileID为0表示资源在当前包内,不为0所以引用这外部的资源。其ID值对应着External Referecnes的列表。m_PathID为当前包内的唯一ID。 161 | Material:可以确认其ShaderKeyword的数量是否是符合预期的,还可以看到ShaderProperty数值是否是正确的。 162 | Texture:可以检查是否被重复打包了,其大小占用了多少。 163 | Shader:可以检查是否含有了默认的Standard 或者额外的变体,通过SubProgram的数量来大致判断一下是否符合变体组合的数量。另外还可以有编译后的二进制大小。这些都直接影响到项目中ShaderLab的内存占用。 164 | MonoScript: 我们脚本的关联,另外还会存有一些该脚本的一些数据。 165 | 166 |
167 | 168 | ![](Media/ab_2.webp) 169 | 170 |
171 | 172 | SerializedFile 173 | 其实SerializedFile记录着重建资源所需的信息。而其大体的组成是有2 x 7KB的文件读取Buffer,较大的TypeTree占用,如果存有外部引用,会有一个最少72KB的External References的Buffer,剩下的就是我们资源的数据了,我们会在后续版本把External References的内存占用降到4KB+。 海贼中由于resources目录中资源太多,占用的TypeTree 很大,有几十m,为了较少吧很多东西打ab了。 174 | 175 |
176 | 177 | ![](Media/ab_3.webp) 178 | 179 |
-------------------------------------------------------------------------------- /Content/《GameProject》/GameProject_GS&BH3.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/GameProject_GS&BH3.md -------------------------------------------------------------------------------- /Content/《GameProject》/GameProject_Menue.md: -------------------------------------------------------------------------------- 1 | 《GameProject》 主要是集中lib 运行时库 2 | 3 | 《GameUnity》 主要集中Unity中和引擎直接相关的库: 4 | 比如 BakeAnimator ,ShaderMap ,阴影,和lib库对应的unity编辑器的库。 5 | 6 | ### [基于UGUI的UI库]() 7 | 8 | * [1、UGUI的动画库解决方案](#01) 9 | * [2、ScrollRect滑动裁切算法](#02) 10 | * [3、任意曲线的循环滑动条](#03) 11 | * [4、UI适配](#04) 12 | * [5、对页面管理器的思考](#05) 13 | * [UI系统生命周期的封装,mvc和通用设计,如何在框架和效率上做出取舍]() 14 | * [系统层面的池的封装]() 15 | 16 | * * * 17 | 18 | ### [mmo-业务lib]() 19 | 20 | * [资源加载管理系统](#06) 21 | * [具体需求分析]() 22 | * [设计缘由(为什么这么设计)]() 23 | * [详细设计和架构]() 24 | * [容易出现的问题]() 25 | 26 | * * * 27 | 28 | * [资源更新,增量更新的思考]() 29 | * [对资源的类型细分]() 30 | * [从分类打包到运行时设计,(简化开发流程)]() 31 | * [抽象的设计,好的代码流程和好的可维护性]() 32 | 33 | * * * 34 | 35 | * [网络系统](#07) 36 | * [Ipv4|Ipv6]() 37 | * [网络层方案TCP、UDP、KCP概略]() 38 | * [网络层的逻辑和表现抽象]() 39 | * [帧同步]() 40 | 41 | * * * 42 | 43 | * [寻路系统](#08) 44 | * [系统背景和需求分析(有什么需求,要做什么,外挂、同步)]() 45 | * [系统设计缘由(为什么这么做?)开发的技术基础(A*star、服务器同同步预测)]() 46 | * [设计细节(怎么做)]() 47 | 1. [A*start的详细原理]() 48 | 2. [编辑器工具设计]() 49 | 3. [运行时代码抽象设计]() 50 | 4. [和服务器同步的协议设计]() 51 | 5. [预测机制,防止服务器拉拽]() 52 | 6. [可能出现的问题,比如卡死情况]() 53 | * [改进与思考(改进和不足)]() 54 | 1. [分层寻路]() 55 | 2. [动态壁障]() 56 | 57 | * * * 58 | 59 | * [关卡系统](#09) 60 | * [系统背景、需求分析(what? 什么效果) 大概怎么做 做出什么样]() 61 | * [why,这套系统为什么这么设计,从用户体验的角度,简化工作痛点的角度]() 62 | * 设计决策(参考[字节码模式](https://gpp.tkchu.me/bytecode.html#栈式机器)分析) 63 | * 访问堆栈(虚拟机,内存访问) 64 | * 指令类型 65 | * 数值的表示 66 | * 字节码生成 67 | * [详细设计(怎么设计?)]() 68 | 1. [运行时设计,文件配置,任何系统使用的可拓展性,比如管卡活动,剧情,任务等]() 69 | 2. [编辑器设计]() 70 | * [引申和思考(存在过哪些问题,还有哪些问题没有解决,该如何去优化这些工作流程,给用户最大的效率和便捷性)]() 71 | 72 | * * * 73 | 74 | * [剧情系统](#10) 75 | * [剧情对话Dialog]() 76 | 77 | * [任务系统](#11) 78 | 79 | * * * 80 | 81 | * [引导系统]() 82 | * [系统背景、业务需求分析(需求what?达到什么效果)]() 83 | * [系统设计理由(为什要这么设计)]() 84 | * [详细设计(怎么做?)]() 85 | 1. [配置设计,和服务器通讯设计]() 86 | 2. [编辑器设计、和运行时设计]() 87 | * * * 88 | 89 | * [关于系统架构(场景、实体、AI、战场逻辑框架的深度思考)](#12) 90 | * [关于场景逻辑流程该如何组织代码、布局(关卡、公会战、自走棋、SLG)]() 91 | * [和服务器同步的几种方式(关卡、公会战、自走棋、SLG)]() 92 | 93 | * * * 94 | * [关于语音社交](#13) 95 | * * * 96 | * [自动化Jenkiens](#14) 97 | 98 | * * * 99 | * [关于机型适配](#15) 100 | * * * 101 | * [关于优化](#16) 102 | 103 | * * * 104 | * [GC、语言](#17) 105 | GC,数据结构,字典,List. 什么情况使用什么数据结构。 一个操作有什么消耗。 106 | [垃圾回收](https://connect.unity.com/doc/Manual/UnderstandingAutomaticMemoryManagement) 107 | 108 | 109 |

事件系统

110 | 111 | 一个事件系统的编写很简单核心是对id和delegate集合的维护。但是如何让事件系统在各个模块中好用,使得代码简洁,可维护,却是需要仔细思考的问题。 事件系统最主要的作用在于减少各个块间的耦合。 就是实体系统来说,实体运行的过程中技能,动作,模型等各个时间不用组件功能间的调用,在actor本身进行定封装的话,可以有效的减少实体模块的复杂度,让代码更加的简洁明了易于维护。 全局的GameEvent事件,最好不要将所有的事件写在一起,能按模块划分,根据不用的业务进行处理是比较可行的。 ,比如一种做法是,每个模块的事件消息定义一个接口,然后GameEvent将接口注册到这个接口实例上。 112 | 113 | 114 | 115 |

UI模块

116 | 首先MVC好还是一把梭好。MVC稍微复杂,但是可以如何去简化代码 117 | 118 |

资源管理系统

119 | 1. 期望的目标系统 120 | 期望对资源管理系统的最终 121 | 122 |

关于包流程上的一些东西

123 | IOS出包的时候经常会卡流程,搞到晚上很伤。 124 | 要出包前确定 1、功能的完整性, 125 | 126 |

关卡系统

127 | 128 | * 关卡中需要添加人物创建销毁的相关的逻辑。不然关卡剧情比较复杂,一次性创建,有点伤 129 | * 支持运行时编辑,在调试和设计的时候更加便捷 130 | * 关于场景模型的效果和逻辑的事件,可以分开处理。 场景的一些表现触发标识,比如桥的断裂和逻辑上的处理 分别配置 131 | * 目前的这些配置和设计还是属于黑盒,不够灵活,和方便的进行逻辑的变更。需要提供更加灵活的设计方式。 就命令上而言。 132 | * 需要提供更加方便的排错方式。从产品的体验方式上看 133 | * 最新的Unity版本中的Timeline 和 cameramecine 可以合成到里面 134 | 135 |

136 | 137 | * * * 138 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 139 | * * * 140 |

141 | 142 |

架构-之实体组织逻辑

143 | ## 基于MVC的代码 144 | 基于状态的代码总是比较难以令人理解。逻辑体(Unit)、行为体(UnitBehaviour)、状态体(FSM)、显示实体(Entity)是常见的mvc形式的代码组织方式。 145 | 逻辑体是最直接的控制体,一般是服务器操控和本地的实体管理对象,m层;行为体是作为衔接Enity(V层)和unit的中间控制层,也就是ctr层。 状态体则是unit的状态管理,主要是对状态的维护,其逻辑表现还是通过对behaviour的调用。 146 | 147 | ## 关于代码的可维护性 148 | 代码的简洁性,可视性,逻辑是否清晰,直接影响代码的维护。像OP的PageManager就十分难以理解。而SLG的代码结构就十分清晰。 149 | 每行代码的编写都应该仔细思考 150 | 151 | ##针对于自走棋架构的重构 152 | 用了什么设计模式,每种模式的细节优缺点,能够像书那样给人讲明白前因后果。 如何封装简化代码。 如何抽离输入和逻辑。 153 | 自走棋里面重连的问题出现在 重连,重新登录是没问题的。是重连和从新登陆的流程问题。 另外如果是战斗状态的时候,服务器直接把消息发过来这时候客户端会来不及接收。这时候服务器是判断客户端已经在线状态了,但是客户端还没有处理。就有问题了。 154 | 流程性的通行,应该和服务器有来回握手确认,进入游戏,客户端加载完资源,进入流程,然后告诉服务器我已经准备完毕,在让服务器吧相关的数据同步过来。 然后客户端进行创建处理。 155 | 不然服务器一次性把数据发过来 156 | 157 | * OP中最令人诟病的就是极度糟糕的实体实现,完全的继承拓展的添加新的功能,既没有使用组件模式的方式分离耦合开放拓展,也没有通过委托类(状态模式、类型对象、行为树等)的方式去定义新的行为。 158 | * 优先使用组合而非继承是面向对象设计中的共识,如何组织策划简洁优雅且灵活的代码,是代码简洁之道的终极目标。 159 | * 通常实体的组织分 数据(数值数据,状态数据,world数据等),渲染(模型加载,状态切换),物理(移动,冲击等等),行为(定义实体的逻辑行为),这些可以通过组件模式将逻辑组件化,行为可以使用委托类* 进行拆分,比如使用状态设计和行为树将代码进行解耦和开放拓展。 160 | * 行为模式: 定义好world实体后,如果组织实体上层的行为逻辑。 类型对象(定义行为的类别)、子类沙盒(定义行为的安全原语)、字节码(将行为从代码分离,放入数据文件) 161 | * 关卡驱动系统就是一个很具特征性的行为模式。相当于在游戏系统中创建了一个小系统(或者说是脚本语言) 162 | 163 | * 关于字节码模式 164 | * 其核心是将行为编码成独立于游戏核心的沙盒环境中,将其行为抽象到数据当中表示。 与之实现的方式有多种,解释器模式,事件驱动的行为设计方式等。 而通常来说抽象出一个高层的行为系统时,还需要做编辑器去定义行为的。从抽象行为的系统,到定义行为的编辑,到行为数据的解析,再到运行时的处理,这是一套完整的设计。[关于字节码](https://gpp.tkchu.me/bytecode.html#栈式机器) 165 | 166 | * 关于子类沙箱模式 167 | * 在基类中定义原子操作,从而减少子类的间的耦合的代码。 168 | * 定义的原子操作,如果使得子类越来越大的话,就需要对基类进行拆分,构造辅助类或组件模式。 169 | * 子类对基类状态的访问,是封装沙盒方法,还是直接对外部调用,如何构造简洁的代码需要按状斟酌。 170 | * 状态的初始化,通常是建造,装配的过程。 171 | * 这个模式也可以说是拓展的外观者模式。 172 | 173 | * 关于类型对象 174 | 175 | 176 | * 简单说下小小的事件系统,以及,如何对事件系统组织代码和设计。以达到最好的架构和简洁代码。 例如在实体系统中嵌入只属于实体的事件分发系统。 177 | 178 | 各个系统的逻辑划分都可以分为几个大块: 输入模块、执行模块、执行操作的原子模块 179 | 对于关卡事件系统来说: 输入模块是每个Story驱动,Story定义了触发条件和执行,触发条件就是整体的输入驱动, cell 定义的各个原子操作就是底层架构执行,包含了场景实体的逻辑操作, 定义各种行为的操作。 180 | 181 | 对于自走棋来说:整体的输入驱动来源于,服务器的数据操作,和玩家自己的输入操作,驱动逻辑的运行。 原子操作就是每个英雄实体。 对英雄实体组织逻辑操作的是玩家的输入交互系统, 和整个游戏的流程控制系统。 控制系统一般需要单独拆分出来作为单独的管理。 流程控制系统可以使用单例管理器或者其他代码组织方式合理的进行代码组织 182 | 183 | 对于战斗系统来说: 回合制的战斗主要是分战斗回合的流程控制, 流程控制用来控制英雄实体的行为释放, 行为释放等技能系统是封装在实体里面的。 -------------------------------------------------------------------------------- /Content/《GameProject》/IOS平台发布相关/GameProject_IOS.md: -------------------------------------------------------------------------------- 1 | * [出版本] 2 | 每次出版本前要确定和检查资源问题。 3 | 4 | 1. 关于资源检测问题 5 | * 光照贴图是否正确。 由于美术规范,有时候就是会有错误和疏漏。 [光照贴图格式](#2001)并不正确,需要每次出包前写工具进行修正。 6 | 7 | * 检查shader引用,是否使用了standershader。 standershader的变体巨大,一般自己写shader。standershader本身在内存的占用也很大。 虽然有美术规范,使用自己的shader,但是美术还是会有使用standershader的时候,比如FBX导入的时候 还是去掉生成材质,如果引用的贴图什么是中文名,会导致生成中文名的mat,虽然美术可能这个时候手动修改了,并且svn上也是正确的。但是当重新导入FBX的时候,那就有问题了(分支的新工程,或者ReImport了)。 8 | 9 | * Model 带了Unity默认材质,Material 带有Unity内置shader,Prefab带有UNity默认材质, Material冗余属性 ,shader默认贴图 10 | 11 | 12 | 2. 关于合并时候的资源冲突问题 13 | 资源冲突分修改冲突和 树冲突。 树冲突并没有使用mine和there的操作。 只有Mark Resolved 操作。 14 | 15 | 造成树冲突是对文件夹或文件做了移除之类的操作,。比如本地删了文件,svn删了文件。 16 | 17 | * truck的树冲突的情况 18 | 19 | * Merge 分支时候的树冲突的情况 20 | 21 | Merge Mark Resolved做了什么操作呢。 就是直接使用svn上的,吧本地的和其他的全部忽略。 22 | 23 |

unity贴图格式

24 | 25 | * [包、更新、运维]() 26 | 27 | * * * 28 | 29 | * [出包的思考]() 30 | 31 | 1. 安卓和IOS的分支在版本封包前,需要提前进行处理,导工程,打bundle都需要时间。 32 | 2. 新建的分支bundle需要把旧的bundle删除,然后重新打bundle。 33 | 3. 改外链直接在SVN上先改了,然后再dump 34 | 35 | 36 | * [经常会忘记的Xcode折腾的东西]() 37 | 38 | * [创建开发者账号证书](#01) 39 | * 首先要出IOS的包作为发布版本需要发布证书签名。 40 | * [开发者平台](https://developer.apple.com/devcenter/ios/index.action) 41 | * [打包过程中的那些事情](#02) 42 | * 分支还是得提前一周打,需要导资源,做平台切换,IOS下工程平台。 新的分支Bundle需要重新打,删掉以前的bundle,都需要时间。 43 | * 44 | * [从流程和技术上简化打包流程](#03) 45 | * [IOS提审需要注意的事项](#04) 46 | 提审只能把核心的需要提审的功能开放。直接在trunk上添加提审模式由服务器对相关功能屏蔽开发放。评审服也需要单独配置,服务器需要对服务器列表做处理只能出现评审服。减少苹果对功能的问题 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Content/《GameProject》/IOS平台发布相关/客户端出包流程.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/IOS平台发布相关/客户端出包流程.xlsx -------------------------------------------------------------------------------- /Content/《GameProject》/Media/RunCSharpLuaTool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/RunCSharpLuaTool.png -------------------------------------------------------------------------------- /Content/《GameProject》/Media/ab_0.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/ab_0.webp -------------------------------------------------------------------------------- /Content/《GameProject》/Media/ab_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/ab_1.webp -------------------------------------------------------------------------------- /Content/《GameProject》/Media/ab_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/ab_2.webp -------------------------------------------------------------------------------- /Content/《GameProject》/Media/ab_3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/ab_3.webp -------------------------------------------------------------------------------- /Content/《GameProject》/Media/ab_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/ab_4.jpg -------------------------------------------------------------------------------- /Content/《GameProject》/Media/tec_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/tec_1.png -------------------------------------------------------------------------------- /Content/《GameProject》/Media/tec_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/tec_2.png -------------------------------------------------------------------------------- /Content/《GameProject》/Media/tec_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/tec_3.png -------------------------------------------------------------------------------- /Content/《GameProject》/Media/tec_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/tec_4.png -------------------------------------------------------------------------------- /Content/《GameProject》/Media/tec_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/Media/tec_5.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/GameProject_UI.md: -------------------------------------------------------------------------------- 1 | 2 | * [UI相关的内容]() 3 | 4 | * [UGUI的页面管理器](#000) 5 | * [UGUI之布局UI](#001) 6 | * [UGUI的循环滚动](#001) 7 | * [UGUI的曲线滚动](#) 8 | * [UGUI的一套动画解决方案]() 9 | * [UGUI的特效模型层级问题](#00) 10 | * [UGUI的常用输入操作,点击,滑动,拖拽等,自走棋,战旗等的输入解决方案] 11 | 12 |

零、UGUI的页面系统

13 | 框架写的越好,业务便越方便展开。开发起来成本也更低。 14 | 15 |

1、 Layout Group

16 | 17 | [定制UGUI减少消耗](https://www.jianshu.com/p/3edce67cb473) 18 | 19 | 使用UGUI的布局组建,结合ScrollView能拓展出一些常用的功能组件。 20 | 先了解基本组件: 21 | ![](Media/LayoutGroup.png) 22 | - 1、Content Size Fitter: 23 | Horizontal/Vertical Fit: 24 | 在水平或垂直方向上更具子元素的大小来裁剪父元素大小 25 | - 2、Layout Group 26 | * 有,无Layout Element, Child Force Expand :强制将子元素等比分配父元素的区域,但是子元素大小不变,保持原样。 27 | * 选了Child Force Expand,子元素的Layout Element 设置了Felxible Width/Height ,会按照设置的比例将父元素区域分配,勾选Control Child Size,则,子元素大小由Layout Elemnt 控制。 28 | * Min Height/Width、Preferred Height/Width 和Control Child Size(勾选了 Min 和 Preferred 才会生效). 29 | 如果要子元素大小不一的话,就勾选Control Child Size,然后Layout Element 控制元素的具体大小,配合ControlAutoSize 可以达到Content 自动扩充大效果。 然后通过让子元素自动向四周拓展,可以做让背景随子元素移动扩充的效果。 如果是让元素自动布局的话,就选Force Expand 让元素自己布局扩充。 30 | - 3、简单的布局适配。 31 | 适配只要运用好锚点,可以很容易的做到。 32 | 33 | 列举一种适配方案,通过,设置包UGUI的锚点布局,通过变更适配节点的Rect来适配。 这种方式的优点是在Unity提供了安全区域的前提下,可以不用原生代码进行适配,缺点是需要计算rect区域大小。 34 | ![](Media/shipei1.png) 35 | ![](Media/shipei2.png) 36 | ![](Media/shipei3.png) 37 | ![](Media/shipei4.png) -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/CLR_Type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/CLR_Type.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/GetWayConfigIns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/GetWayConfigIns.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/GetWayConfigIns_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/GetWayConfigIns_1.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/ILIntepreter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/ILIntepreter.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/ILProcess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/ILProcess.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/ILR_CIR_Redirection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/ILR_CIR_Redirection.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/IL_OpCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/IL_OpCode.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/IL_OpCode_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/IL_OpCode_1.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/IL_Warring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/IL_Warring.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/LayoutGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/LayoutGroup.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/shipei1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/shipei1.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/shipei2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/shipei2.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/shipei3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/shipei3.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/shipei4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/shipei4.png -------------------------------------------------------------------------------- /Content/《GameProject》/UI/Media/stackframe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/UI/Media/stackframe.png -------------------------------------------------------------------------------- /Content/《GameProject》/doc技术文档/Op备忘录.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/doc技术文档/Op备忘录.docx -------------------------------------------------------------------------------- /Content/《GameProject》/doc技术文档/整体设计框架.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/doc技术文档/整体设计框架.docx -------------------------------------------------------------------------------- /Content/《GameProject》/《GameProject》.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameProject》/《GameProject》.rar -------------------------------------------------------------------------------- /Content/《GameUnity》/Blender.md: -------------------------------------------------------------------------------- 1 | 2 | * [Cinemachine](#01) 3 | 4 |

Cinemachine

5 | 6 | 快捷键: 7 | 相机更随场景视角:F3 ,输入camera ,选择 Align Camera to View 8 | 9 | -------------------------------------------------------------------------------- /Content/《GameUnity》/GameUnity.md: -------------------------------------------------------------------------------- 1 | 2 | * 引擎渲染 3 | * [场景](#02) 4 | * [模型渲染](#03) 5 | * [关于水](#01) 6 | * [光照](#04) 7 | * [特效](#05) 8 | * [Unity场景烘培](#6) -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Activation_Track_Inspactor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Activation_Track_Inspactor.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Aim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Aim.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Aim0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Aim0.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/BindingMode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/BindingMode.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineBlendListMenue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineBlendListMenue.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineClearShot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineClearShot.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineCollider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineCollider.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineConfiner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineConfiner.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineFreelook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineFreelook.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineFreelookMenue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineFreelookMenue.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineMenue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineMenue.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineStateDrivenCamera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineStateDrivenCamera.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/CinemachineTargetGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/CinemachineTargetGroup.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/ComposerArea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/ComposerArea.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/ComposerMenue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/ComposerMenue.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Editor_Clip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Editor_Clip.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/FollowZoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/FollowZoom.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/FramingTransposer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/FramingTransposer.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/FramingTransposer1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/FramingTransposer1.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/GroupComposerArea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/GroupComposerArea.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/GroupComposerMenue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/GroupComposerMenue.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/HardLockToTarget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/HardLockToTarget.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/ImpluseMenue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/ImpluseMenue.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/MixingCameraMenue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/MixingCameraMenue.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Noise.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Noise0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Noise0.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Noise1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Noise1.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/OrbitalTransposer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/OrbitalTransposer.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/POV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/POV.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/SaveDuringPlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/SaveDuringPlay.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/StoryBoard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/StoryBoard.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/TrackedDolly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/TrackedDolly.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/Transposer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/Transposer.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/anim_record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/anim_record.png -------------------------------------------------------------------------------- /Content/《GameUnity》/MediaTimeline/timelineTrack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/MediaTimeline/timelineTrack.png -------------------------------------------------------------------------------- /Content/《GameUnity》/TimeLine.md: -------------------------------------------------------------------------------- 1 | 2 | * [Timeline](#01) 3 | 4 |

5 | 6 |
7 | 8 | Timeline 是寄托于PlayableDirector 组件,通过编辑Timeline序列将数据存于 【.playable】 中,通过寄托于PlayableDirector组件进行播放。可以通过PlayableDirector控制Timeline的暂定开始等。 9 |
10 |
11 | Timeline 支持嵌套实例 12 | 13 | Track: timeline 的构成基础轨道原子。 14 | 15 |
16 |

17 |
---------- Target Group Track----------
18 | Track Group: 管理Track分组 19 | 20 | 21 | 22 | 23 |

24 |
---------- Activation Track----------
25 | 26 | 1、使用Activation 控制流程 27 | Activation Track: 是一种在Timeline动画中可内嵌动画片段的Track。可以使用它在一些动画特定的地方添加一些额外完整的动画到Timeline中。例如背景上爆炸效果,屏幕上风吹过时的烟尘。主要用于对多个动画进行组合的时候在特定的时间进行显示和隐藏。 28 | Active:Timeline播放完毕后选择的GO显示。 29 | Inactive:TimelineAsset播放完毕后隐藏选择绑定的GO. 30 | Revert: TimelineAsset 开始播放前重置为初始状态。例如播放结束的时候是inactive ,初始状态是active ,重新播放时重置 31 | Leave As Is: 保持状态为TImelineAsset 结束的的状态 32 | 主要是控制GO的显隐。 33 | 34 | (实际看了下,这几个选项没什么用。 激活的物体不管怎么设置都是开始播前会隐藏,播完了,然后隐藏。) 35 | ![](MediaTimeline/Activation_Track_Inspactor.png) 36 | 37 | 38 |

39 |
---------- Animation Track----------
40 | 2、在Timelime控制和编辑动画和组件。 41 | timeline asset:选中或创建一个GO作为想要表现的剧情动画的节点,作为创建Assetline aasset的容器。然后就可以对timelineAsset进行编辑。 42 | 43 | Animation Track: 这是一个动画组件,有两种方式可以表现动画,一种是直接通过录制,然后操作GO的动作旋转等,会在时间轴上记录帧信息这种叫 Infinite Clip ,它包含了通过编辑器操作时记录下来帧数据,位置大小旋转等,记录当前选择帧的相关数据,然后插值到下个帧的数据。 形成动画片段。 第二种是直接通过一个现有的clip创建一个timeline上的动画clip。 44 | 45 | 可以直接控制Animator,在当前track上 进行多个动画进行播放融合等。可以录制动画和录制循环动画录制的动画一旦录制成功,就不能修改了,要再编辑需要转换成track clip ,然后通过animator编辑器进行编辑。 46 | ![](MediaTimeline/anim_record.png) 47 | 48 | 对于时间轴上的clip 选中可以进行复制,粘贴,删除,锁定等各种操作。 49 | 选中一个Clip,Inspactor面板上会有相应的属性显示,可以进行时间轴上的帧编辑,timeline上 会显示clip的长度,鼠标到clip两边也可以直接进行拖拽控制长度。两个clip重叠后面的会覆盖前面的。 对于动画clip,两者相连的部分会进行动画融合。 50 | 51 | ![](MediaTimeline/Editor_Clip.png) 52 | 53 | 54 | 55 | 56 |

57 |
---------- Audio Track----------
58 | 3、使用Audio Track。 59 | Audio Track: 两种方式创建AudioTrack,直接拖拽一个Audio到timeline 或者手动创建一个。 60 | 属性: 61 | Volume: 音量 62 | StereoPan: 立体声 63 | SpatialBlend: 空间混合 64 | 属性分三大部分:Clip Timing 控制音频在Timeline 中的位置和时间,速度等。s秒表示f帧所在的时间。BlendCurves:表示开始结束的淡入淡出曲线。 AudioPlayableAsset:控制音量和是否循环。 65 | 66 | 67 | 68 |

69 |
---------- Control Track----------
70 | 用来支持嵌套的Timeline,一个timeline中可以用此Track支持多个Timeline。例如有个过场动画是角色走进场景的过程中,游戏里有一个板子移动到指定位置。可以创建一个主的Timeline,上面控制角色动画和背景音乐。 然后嵌入一个子的timeline用来控制板子的动画。 71 | 72 |
73 |

74 |
---------- Signal Track----------
75 | Timeline中的帧事件Track。 在场景创建一个带有Signal Receiver的GO,在Timeline上添加相应的帧事件。 76 | 77 | 78 |

79 |
---------- Playable Track----------
80 | 首先一个Track由三个重要部分组成: 81 | PlayableBehaviour: 82 | Clip : PlayableAsset, ITimelineClipAsset 83 | Track : TrackAsset 84 | 85 | 86 |

87 |
---------- Ciemachine Track----------
88 | Ciemachine Track: 89 | 90 | 91 |

92 |
---------- DefaultPlayables Track----------
93 | 94 | DefaultPlayables Track: 官方自带的做好的一些Track 95 | 96 | Sub Track: 一般叫覆盖轨道(Override Tracks),用于覆盖或者遮蔽原本的动画。SubTrack会晚安覆盖主track的animtion,可以使用Avatar Mask进行两个anim 的合并。 97 | 98 | ![](MediaTimeline/TimelineTrackMenue_Defult.png) 99 | 100 | 101 | Light Control Track
102 | 103 | Nav Mesh Agent Control Track
104 | 105 | Screen Fader Track
106 | 107 | Text Switcher Track
108 | 109 | Time Dilation Track
110 | 111 | Transform Tween Track
112 | 113 | TMP Text Switcher Track
114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |

123 |
---------- Custem Track----------
124 | 125 | 126 | AI Command Track
127 | 128 | Dialogue Track
129 | 130 | Light Track
131 | 132 | Time Machine Track
133 | 134 | 135 | 136 | 137 | 138 | Unity Recorder: 139 | 140 | 这个是Unity的插件:允许直接在UnityEditor上进行aniClip,Videos,和图片的clip录制。 141 | RecordMode: 142 | Manual: 手动点击开始录制结束录制 143 | Single Frame: 基于设置的帧率,按单帧录制。 例如2秒的工程,要录制地24帧, 144 | Frame Interval: 指定起始帧结束帧 录制 145 | Time Interval: 制定开始时间结束时间开始录制。 146 | cap: 只有 播放帧率是固定值时,才可以使用Cap。Cap开启时, 工程运行的帧率受限于你设置的目标帧率。 关闭时,允许你的工程录制的更快比正常时间,没有录制回放速度的影响。 这可以在不依赖于用户实时输入的情景下节约时间。例如游戏预告片的用户交互和工程教程的回放录像。或者是视频动态图片或者录制教标题录像等等。 147 | 148 | 可以录制4种类型的东西:GIF Animation , Animation Clip ,Movie ,Image Sequence . 每种类型的配置可以导出,导入,多个工程通用。 149 | 150 | Animation Clip:会记录录制的位置动作,位移,融合成一个单独的anim。 151 | Movie: 152 | Image Sequence: 153 | 154 | 155 | TImeline思考: 156 | 157 | 整体上是个线性编辑器,从开始播放,到播放结束,每帧可以设置多个Clip。 Timeline本身带有时间轴的回溯。 158 | 159 | 适合制作线性的逻辑集合。 例如剧情Cutscence,一个角色的技能动作特效播放,关卡的节点指令配置。 160 | 可以将Timeline这部分线性的Editor编辑器部分提取出来作为通过编辑器。 -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/SRP.md: -------------------------------------------------------------------------------- 1 | 2 | * Catlike Srp 3 | * [Create](#01) 4 | 5 |

Create

6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/SRPMedia/CIExy1931_sRGB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/《SRP》/SRPMedia/CIExy1931_sRGB.png -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/SRPMedia/Camera_Gamma2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/《SRP》/SRPMedia/Camera_Gamma2.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/SRPMedia/SRGB_gamma.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/《SRP》/SRPMedia/SRGB_gamma.png -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/SRPMedia/cameraGamma.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/《SRP》/SRPMedia/cameraGamma.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/SRPMedia/cameraGamma1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/《SRP》/SRPMedia/cameraGamma1.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/SRPMedia/monitor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《GameUnity》/《SRP》/SRPMedia/monitor.jpg -------------------------------------------------------------------------------- /Content/《GameUnity》/《SRP》/色调.md: -------------------------------------------------------------------------------- 1 | 对于显示器而言,本身的输入的电压和显示的亮度不是线性关系 2 | 3 |
4 | 5 | gamma源至CRL显示器的图像亮度和输入的电信号电压的非线性关系的一个参数。 由于将图片信息输入后CRL显示发现都偏暗,这是显示器本身的物理特性决定的。于是只好将图片都手动变亮,以适应CRL显示。因此制定了一套颜色空间的标准,叫sRGB,用来统一处理图片变亮的方式。 如果图片本身是sRGB空间下制作的,在CRT显示器上看起来就是正常的。 为了量化和衡量这种非线性关系引入了Gamma,抽象化为数学表达式 output= input ^ gamma . 6 | 7 |
8 | CIE 1931 xy色彩图表示的sRGB色彩空间的色域以及原色的位置。白点D65显示在中间 9 |
10 | 红色曲线是相对横轴sRGB压缩值的sRGB强度的函数,蓝色曲线是这个函数在对数-对数空间中斜率,它是每个点上的有效gamma。在压缩值0.04045或线性强度0.00313之下,曲线是线性的所以gamma为1。在红色曲线之后的黑色虚线曲线展示了完全gamma = 2.2幂次定律时的曲线。 11 |
12 | LCD没有CRT的问题,但是由于现有图片很多是sRGB,为了兼容在显示器内加入一次处理,对sRGB变暗处理,LCD内也gamma相应曲线。 13 | 14 | [浅析](https://wenku.baidu.com/view/527777583b3567ec102d8a47.html) 15 | 16 | gamma源至显示器对信号输入失真的度量,但是凡是设置到图像输入输出的对比差异都可以引入gamma参数。 17 | * 显示器Gamma 18 | * 文件Gamma 19 | * 系统Gamma 20 | 21 | 显示器Gamma:是硬件决定的一个固定值,无法人为改变,(实际图像设备由多个非线性的系统组件组成,整个系统的传递函数是一个幂函数,它的指数gamma等于所有单个部件的Gamma的乘积)。例如普通的CRT的gamma约为2.5 ,为了使得图像信息尽量还原真实场景,需要将结果的Gamma趋近1,就需要通过Gamma校正来抵消这个2.5。 22 | 23 | 文件Gamma: 24 | 这种图形文件的gamma 可以理解为是相关标准规范给定的一个参数,为了描述图像文件表达信息制定的色调标准,或者是为了方便图像传输而定的图像传输协议,都会给定一个相应的Gamma值,确定图像信号的输入和输出关系 ,对于sRGB标准的输出图片给出的gamma变换就是为了抵消CRT的Gamma,可以称之为校正。 如果是处于特殊需要,需要改变数码相片文件的gamma值, 典型的是相机的自动gamma校正是为了输出人眼的感官图像,再例如对照片的gamma调解以对照片艺术化处理这种最终应用到图片上的效果直接体验在图像上都不属于校正过程。这种改变不能称作是像对显示器要做的那种 “校正”,而是换调解,属于曲线优化调整,是对亮度和对比度的辅助功能,强力的Gamma优化模式可以对画面进行细微的阴暗层次调整,控制整个画面的对比度表现。 25 | 26 | 27 | 系统Gamma:是对图计算机硬件系统读取图片数字信息后,输出到显示器前,做变换的衡量参数,可以通过软件等认为去调节。这种显示前的变换操作,里目的是为了抵消显示器的Gamma。这种调解尽量使得不可调解的显示器Gamma ,文件Gamma 和 系统Gamma叠加为1,使得显示器显示的图片和原始图片一样,降低或者消除失真。 这里好比密码通讯,文件Gamma是加密过程,系统Gamma和显示器Gamma 用来对文件Gamma(是指原始图片进过sRGBk空间输出映射的图片)解密,最终得到和原始信息一样的值。 28 | 29 | 30 | 什么地方做校正: 31 | 从获取图像、存储成图像文件、读出图像文件,直到在某种类型的显示屏幕上显示图像,至少有5个地方可以利用非线性转换函数引入Gamma值。 32 | 33 | 文件级: 34 | 1、camera_Gamma:摄像机图像传感器的Gamma ,这种一般直接作用于输出图像,不算到需要校正的里面。原始raw文件是未经任何处理的原始传感数据。 35 | 2、encoding_gamma:编码器编码图像文件时引入的Gamma,例如将相机输出图片转成了sRGB 36 | 某些图像处理软件可以调整文件的Gamma,这种调整的结果将写入文件(即对图像进行某种处理)比如,当你的PC未进行Gamma校正(你的系统Gamma=显示器的Gamma约2.2),这时你可以把文件的Gamma调为2.2保存,你以及其它未校正系统Gamma的PC用户看到的这个图片应是正好的。(注意,这里有一个前提即原始图片在Gamma=1的系统上看是“正好”的。 37 | 另一种方式则是将Gamma校正的系数写入文件内,而不改变文件内容,而浏览/处理软件在解码这一图像时会依据这一参数对它单独进行Gamma校正。(这被称作“文件Gamma”。PNG格式支持) 38 |   总之,不管Gamma校正发生在哪一环节,它们是等效的(在理想情况下/或近似地看)。明白在哪些环节Gamma发生了怎样的变化,然后做一些乘除法就可以了。 39 | 40 | 应用程序级: 41 | 3、decoding_gamma: 解码器读图像文件时引入的Gamma。 例如对Unity图片导入设置勾选sRGB时候, 进行采样的时候需要将sRGB图片逆转取原图片。否则就采样图片本身的像素。 42 | 前提到的,某些播放软件有Gamma校正功能,ACDSEE也有。这时,它们不是修改系统的Gamma校正表,而是在解码时对当前帧/图像作了实时的Gamma变换。 43 | 44 | 系统级: 45 | 4、LUT_gamma:图像帧缓存查找表中引入Gamma。 46 | 系统级别(硬件和操作系统)。 显示器一般没有补偿,即使有也对外呈现一定的gamma值 47 | 主要的补偿发生在显卡及驱动程序内。 如果硬件显卡不支持,由驱动软件完成。winsows中,上层通过调用驱动程序的一个借口函数(DrvIcmSetDeviceGammaRamp)向其传递Gamma校正表(LUT),这个表的大小是3*256项(每项16字节),对应于RGB三个通道,每个通道256级。 48 | 描述这一细节,可以对有些事情更有把握: 49 |   * 这种校正实际上可以是任意函数,而不限于gamma为幂的指数函数。 50 |   * 也是因为此,不能通过驱动程序得到系统的gamma值(因为最多只能得到那个表)。 51 |   * 这一设置对整个系统有效(任何程序,任意显示的图片都受它影响)。 52 | 53 | 5、CRT_LCD_gamma: CRT gamma 是尝试消除的 54 | 55 | [can](https://diy.pconline.com.cn/display/study_screen/0703/975894_all.html) 56 | 校正方法: 57 | 根据上述提出的5中 58 | 59 | 60 | 61 | [相机的log Gamma](https://blog.csdn.net/ycc541/article/details/42263577): 62 | 相机拍的照片,胶片化学成像的方式和人眼的非线性感光方式相同。而CCD,CMOS成像方式是通过像点中的“硅” 感受光线强弱。硅感光是物理成像,真实的反应光线的变化,是线性的,于是他的gamma 和人眼的冲突了。 63 |
左边是人眼看到,右边是CCD成像
64 | CCD可能更接近真实的世界,因为当时亮度也许就不高,但是人眼有自动补偿。因此,相机要输出一张人眼看到的画面,需要调整对光线的反应,也就是Gamma曲线。 65 |
左边是人眼看到,右边是CCD成像
66 | 一般的相机Gamma的调整是自动的。 但是高级相机一般留有参数摄像者进行微调。 67 |
68 |
69 | 相机的log Gamma曲线是对数曲线。一般相机里可以选JPEG的色彩空间,比如可以选sRGB 和 Adobe RGB。 这些空间都有自己规定的亮度映射(sRGB就是分段函数)。所以相机在完成相片成像后还要再把线性线性RGB的数据映射成颜色空间规定的亮度。所以相机里拍摄的jpeg 在电脑上看的时候流程是:
70 | 71 | * 相机中: 72 | raw原始数据-> (tone mapping :适应人眼的gamma校正) -> 线性的RGB数据 -> ("gamma "映射) -> sRGB 数据 73 | * 显示器: 74 | sRGB 数据 -(逆 gamma 映射) -> 显示 75 | 76 | [公式总结](https://www.zhihu.com/question/55444719/answer/144972733) 77 | 78 | 这种Gamma曲线和Log曲线都可以归类于OECF/OETF(Opto-Electronic Conversion/Transfer Function 光-电转换函数)之中。在将视频显示在屏幕上时,会由对应的EOCF/EOTF (Electro-Optical Conversion/Transfer Function 电-光转换函数)来完成映射。 79 | 80 | 【文件数值】=【场景相对物理亮度】^ Encode Gamma 81 | 【屏幕相对物理亮度】= 【文件数值】^ Display Gamma 82 | 83 | 84 | RAW格式:RAW图像是CMOS或CCD图像感应器扑捉道德光源信息转化为数字信号的原始数据。 85 | 86 | 87 | LUT: 88 | 89 | Gamma校正:由于显示器Gamma和文件Gamma是固定不变的,Gamma校正过程是校正计算机的系统Gamma,使得显示器Gamma、系统Gamma、文件Gamma三个变换的叠加为1.0 90 | 91 | gamma space: 对图片采样时先进行一次gamma校正,然后采样。 92 | linear color space: 直接对图片采样。 -------------------------------------------------------------------------------- /Content/《IDAPro权威指南》/IDA_PRO.md: -------------------------------------------------------------------------------- 1 |

ida快捷键

2 | IDA: 3 | 4 | view ---> openSubviews 打开子页面 5 | 6 | 地址跳转快捷键: 7 | 按 G ,输入地址: 8 | IDA快捷键 9 | 10 | 空格键    反汇编窗口切换文本跟图形 11 | 12 | ESC退到上一个操作地址 13 | 14 | G搜索地址或者符号 15 | 16 | N重命名 17 | 18 | 分号键   注释 19 | 20 | ALT+M  添加标签 21 | 22 | CTRL+M 列出所有标签 23 | 24 | CTRL +S  二进制段的开始地址结束地址 25 | 26 | C code   光标地址出内容解析成代码 27 | 28 | P       在函数开始处使用P,从当前地址处解析成函数 29 | 30 | D  data解析成数据 31 | 32 | A   ASCII解析成ASCII 33 | 34 | U   unDefined解析成未定义的内容 35 | 36 | X  交叉引用 37 | 38 | F5  C伪代码 39 | 40 | 菜单栏中的搜索功能中 41 | 42 | 有ALT+T 搜索文本 43 | 44 | ALT+B 搜索16进制 搜索opcode 如ELF文件头 45 | 46 | 打开断点列表 CTRL+ALT+B 47 | 48 | 单步步入 F7 49 | 50 | 单步不过 F8 51 | 52 | 运行到函数返回地址 CTRL+F7 53 | 54 | 运行到光标处 F4 55 | 56 | IDC脚本 57 | 58 | NOP指令 59 | 60 | movs r0,r0 对应的16进制是00 00 B0 E1 61 | 62 | 在IDA中被识别成NOP指令 63 | 64 | 函数首部直接让函数返回 65 | 66 | 将函数头部的汇编指令修改成  mov pc,lr  对应的16进制0E F0 A0 E1 67 | 68 | 在IDA中被识别成RET指令 69 | 70 | * 补码 -------------------------------------------------------------------------------- /Content/《IL翻译Lua》/2、ILSpy/.Net Compiler Platform SDK.md: -------------------------------------------------------------------------------- 1 | * [1、.Net Compiler Platform SDK](#001) 2 | * [2、.Net 编译器Roslyn](#002) 3 | * [3、使用NuGet 给项目安装 StyleCop.Analyzers分析器](#003) 4 | * [4、自定义分析器](#004) 5 | * [5、语法分析](#005) 6 | * [6、vs测试用例用法](#006) 7 | 8 |





9 |

1、.Net Compiler Platform SDK

10 | .Net Compiler Platform SDK 是编译器在验证代码语法和语义时生成应用代码的详细模型。他提供和编译器管线中间的对模型的访问接口。 11 | 使用 .NET Compiler Platform SDK,可以生成分析器和代码修补程序,从而发现和更正编码错误。 12 | 13 | [.Net Compiler Platform SDK 介绍](https://docs.microsoft.com/zh-cn/dotnet/csharp/roslyn-sdk/#enforce-team-coding-standards) 14 | 15 | 16 | 17 | 18 |





19 |

1、.Net 编译器Roslyn

20 | 21 | [.Compiler Pipeline Functonal Areas](https://www.oschina.net/translate/roslyn-intro?cmp&p=1) 22 | 23 | 编译器管道功能: 24 | .NET编译器平台(“Roslyn”)通过提供一个API层,是一个传统编译器管道镜像,向你这样的消费者揭示了C#和Visual Basic编译器的代码分析。 25 | 。。。。 26 | 27 | 28 |




29 |

2、使用NuGet 给项目安装 StyleCop.Analyzers分析器

30 | 31 | [使用StyleCop.Analyzers](https://www.cnblogs.com/selimsong/p/9209254.html) 32 | 33 | 对于 .NetFramework 可以直接在 引用->分析器 下右键添加分析器dll引用。 34 | 对于 通用项目 .NetCore.NetStandard 右键项目属性,管理程序Nuget 程序包 给单个项目安装程序包StyleCop.Analyzers 35 | 36 | Microsoft.CodeAnalysis.FxCopAnalyzers: 37 |    FxCop.Net Framework 中用来分析托管代码的应用程序,它主要关注的代码的设计、国际化、可维护性、性能和安全性等方面,并按照这些类别定义了一个规则集:  https://docs.microsoft.com/en-us/visualstudio/code-quality/code-analysis-for-managed-code-warnings 38 |    FxCopAnalyzers安装: https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers 39 | 40 | StyleCop.Analyzers 41 |    StyleCop本身就是一个用于规范代码格式的工具,所以它的规则也是面向代码格式的,如注释、布局、命名、排序、可维护性、可读性等,StyleCop 的规则集参考:https://github.com/DotNetAnalyzers/StyleCopAnalyzers/tree/master/documentation 42 |   StyleCop.Analyzers 的项目主页:https://github.com/DotNetAnalyzers/StyleCopAnalyzers 43 | 44 | Codecracker.CSharp : 45 |    Codecracker.CSharp也是以个开源的代码分析器,它的规则主要是设计、命名、性能、代码风格、代码使用以及重构,具体参见:http://code-cracker.github.io/diagnostics.html 46 | 项目主页:https://github.com/code-cracker/code-cracker 47 | 48 | 注: Codecracker.CSharp 可以通过安装VS拓展工具的方式实现代码分析:https://marketplace.visualstudio.com/items?itemName=GiovanniBassi-MVP.CodeCrackerforC,其它大部分Roslyn分析器需要安装Nuget包。 49 | 50 | SonarAnalyzer.CSharp: 51 |    SonarAnalyzer.CSharp是一个非常强大的代码分析器,它现阶段一共有343条规范并且主要是面向了代码的使用,包含了缺陷检测、性能、约定、错误处理、事件、异步、测试等等多类规则,规则参见:https://rules.sonarsource.com/csharp 52 |   另外SonarAnalyzer 还有针对其它语言的分析器,并且还保持持续更新,项目主页:https://www.sonarsource.com/products/codeanalyzers/sonarcsharp.html 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |




61 |

4、自定义分析器

62 | 63 | 64 | 65 | 66 |




67 |

5、语法分析

68 | 69 | 70 | 71 | 72 | 73 |




74 |

6、VS测试用法

75 | 76 | 拿ILSpy举例: -------------------------------------------------------------------------------- /Content/《IL翻译Lua》/2、ILSpy/AST.md: -------------------------------------------------------------------------------- 1 | * [1、抽象语法树](#001) 2 | 3 | * [2、.Net Compiler Platform SDK](#001) 4 | 5 |

.Net Compiler Platform SDK

6 | 7 | [.Net Compiler Platform SDK](https://docs.microsoft.com/zh-cn/dotnet/csharp/roslyn-sdk/#enforce-team-coding-standards) 8 | [.Compiler Pipeline Functonal Areas](https://www.oschina.net/translate/roslyn-intro?cmp&p=1) 9 | 10 | 编译器管道功能: 11 | -------------------------------------------------------------------------------- /Content/《IL翻译Lua》/2、ILSpy/CsharpLua.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《IL翻译Lua》/2、ILSpy/CsharpLua.md -------------------------------------------------------------------------------- /Content/《IL翻译Lua》/2、ILSpy/TestTemp.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 进行LoopDetection前 4 | /* 进过内联简化后的AST 5 | {BlockContainer { 6 | Block IL_0000 (incoming: 1) { 7 | stloc a(ldc.i4 10) 8 | br IL_001c 9 | } 10 | 11 | Block IL_001c (incoming: 3) { 12 | if (ldloc condition) br IL_0006 13 | leave IL_0000 (nop) 14 | } 15 | 16 | Block IL_0006 (incoming: 1) { 17 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 18 | if (comp.i4(comp.i4.signed(ldloc a > ldc.i4 100) == ldc.i4 0)) br IL_001c 19 | br IL_0018 20 | } 21 | 22 | Block IL_0018 (incoming: 1) { 23 | stloc condition(ldc.i4 0) 24 | br IL_001c 25 | } 26 | 27 | } at IL_0000} 28 | 29 | 30 | 31 | LoopDetection 完成 32 | {ILFunction Test { 33 | local a : System.Int32(Index=0, LoadCount=2, AddressCount=0, StoreCount=2) 34 | param condition : System.Boolean(Index=0, LoadCount=1, AddressCount=0, StoreCount=2) 35 | 36 | BlockContainer { 37 | Block IL_0000 (incoming: 1) { 38 | stloc a(ldc.i4 10) 39 | br IL_001c 40 | } 41 | 42 | Block IL_001c (incoming: 1) { 43 | BlockContainer (while-true) { 44 | Block IL_001c (incoming: 3) { 45 | if (ldloc condition) br IL_0006 46 | leave IL_0000 (nop) 47 | } 48 | 49 | Block IL_0006 (incoming: 1) { 50 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 51 | if (comp.i4(comp.i4.signed(ldloc a > ldc.i4 100) == ldc.i4 0)) br IL_001c 52 | br IL_0018 53 | } 54 | 55 | Block IL_0018 (incoming: 1) { 56 | stloc condition(ldc.i4 0) 57 | br IL_001c 58 | } 59 | 60 | } 61 | } 62 | 63 | } 64 | } 65 | } 66 | 67 | Condition Detection前 68 | 69 | {BlockContainer { 70 | Block IL_0000 (incoming: 1) { 71 | stloc a(ldc.i4 10) 72 | br IL_001c 73 | } 74 | 75 | Block IL_001c (incoming: 1) { 76 | BlockContainer (while-true) { 77 | Block IL_001c (incoming: 3) { 78 | if (ldloc condition) br IL_0006 79 | leave IL_001c (nop) 80 | } 81 | 82 | Block IL_0006 (incoming: 1) { 83 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 84 | if (comp.i4(comp.i4.signed(ldloc a > ldc.i4 100) == ldc.i4 0)) br IL_001c 85 | br IL_0018 86 | } 87 | 88 | Block IL_0018 (incoming: 1) { 89 | stloc condition(ldc.i4 0) 90 | br IL_001c 91 | } 92 | 93 | } 94 | leave IL_0000 (nop) 95 | } 96 | 97 | } at IL_0000} 98 | 99 | 100 | 之后: 101 | {BlockContainer { 102 | Block IL_0000 (incoming: 1) { 103 | stloc a(ldc.i4 10) 104 | br IL_001c 105 | } 106 | 107 | Block IL_001c (incoming: 1) { 108 | BlockContainer (while-true) { 109 | Block IL_001c (incoming: 3) { 110 | if (ldloc condition) br IL_0006 111 | leave IL_001c (nop) 112 | } 113 | 114 | Block IL_0006 (incoming: 1) { 115 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 116 | if (comp.i4(comp.i4.signed(ldloc a > ldc.i4 100) == ldc.i4 0)) br IL_001c 117 | br IL_0018 118 | } 119 | 120 | Block IL_0018 (incoming: 1) { 121 | stloc condition(ldc.i4 0) 122 | br IL_001c 123 | } 124 | 125 | } 126 | leave IL_0000 (nop) 127 | } 128 | 129 | } at IL_0000} 130 | 131 | 132 | 133 | 134 | {ILFunction Test { 135 | local a : System.Int32(Index=0, LoadCount=2, AddressCount=0, StoreCount=2) 136 | param condition : System.Boolean(Index=0, LoadCount=1, AddressCount=0, StoreCount=2) 137 | 138 | BlockContainer { 139 | Block IL_0000 (incoming: 1) { 140 | stloc a(ldc.i4 10) 141 | BlockContainer (while-true) { 142 | Block IL_001c (incoming: 2) { 143 | if (comp.i4(ldloc condition == ldc.i4 0)) leave IL_001c (nop) 144 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 145 | if (comp.i4.signed(ldloc a > ldc.i4 100)) Block IL_0019 { 146 | stloc condition(ldc.i4 0) 147 | } 148 | br IL_001c 149 | } 150 | 151 | } 152 | leave IL_0000 (nop) 153 | } 154 | 155 | } 156 | } 157 | } 158 | 159 | 160 | 161 | =================================================== 162 | 构建表达式 163 | 164 | {BlockContainer { 165 | Block IL_0000 (incoming: 1) { 166 | call WriteLine(if (ldc.i4 1) ldstr "true" else ldstr "false") 167 | leave IL_0000 (ldc.i4 0) 168 | } 169 | 170 | } at IL_0000} 171 | 172 | {{ 173 | Console.WriteLine (true ? "true" : "false"); 174 | return 0; 175 | } 176 | } 177 | 178 | 179 | {BlockContainer { 180 | Block IL_0000 (incoming: 1) { 181 | stloc a(ldc.i4 10) 182 | BlockContainer (while) { 183 | Block IL_001c (incoming: 2) { 184 | if (ldloc condition) br IL_000b else leave IL_001c (nop) 185 | } 186 | 187 | Block IL_000b (incoming: 1) { 188 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 189 | if (comp.i4.signed(ldloc a > ldc.i4 100)) Block IL_0019 { 190 | stloc condition(ldc.i4 0) 191 | } 192 | br IL_001c 193 | } 194 | 195 | } 196 | leave IL_0000 (nop) 197 | } 198 | 199 | } at IL_0000} 200 | 201 | 202 | 203 | 204 | {Block IL_000b (incoming: 1) { 205 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 206 | if (comp.i4.signed(ldloc a > ldc.i4 100)) Block IL_0019 { 207 | stloc condition(ldc.i4 0) 208 | } 209 | br IL_001c 210 | } at IL_000b} 211 | 212 | 213 | 214 | {BlockContainer { 215 | Block IL_0000 (incoming: 1) { 216 | stloc a(ldc.i4 10) 217 | BlockContainer (while) { 218 | Block IL_001c (incoming: 2) { 219 | if (ldloc condition) br IL_000b else leave IL_001c (nop) 220 | } 221 | 222 | Block IL_000b (incoming: 1) { 223 | stloc a(binary.add.i4(ldloc a, ldc.i4 10)) 224 | if (comp.i4.signed(ldloc a > ldc.i4 100)) Block IL_0019 { 225 | stloc condition(ldc.i4 0) 226 | } 227 | br IL_001c 228 | } 229 | 230 | } 231 | leave IL_0000 (nop) 232 | } 233 | 234 | } at IL_0000} 235 | 236 | 237 | {{ 238 | a = 10; 239 | while (condition) { 240 | a = a + 10; 241 | if (a > 100) { 242 | condition = false; 243 | } 244 | } 245 | } 246 | } 247 | 248 | {BlockContainer { 249 | Block IL_0000 (incoming: 1) { 250 | call Object..ctor(ldloc this) 251 | leave IL_0000 (nop) 252 | } 253 | 254 | } at IL_0000} -------------------------------------------------------------------------------- /Content/《IL翻译Lua》/3、Decompiler/ILLua.md: -------------------------------------------------------------------------------- 1 | 现有的翻译方案 2 | 3 | C# 源码 ,民间高手版 ---> Lua 4 | 缺点: 工作量大。受语言语法的限制不够稳定。代码复杂度高,不好把控。 5 | 优点:有开源代码 6 | 7 | Dll反编译,腾讯网易内部版 ---> Lua 8 | 缺点: 没有开源代码。需要自己实现。 9 | 优点: 翻译难度比C#源码形式小, 可以享受dll的相关便利,编译优化,dll混淆。 编译向其他语言进行翻译发展. 10 | 11 | 12 | 13 | C# 源码形式: 14 | ```C# 15 | 16 | 借助Roslyn获取C#AST,将C#AST转换成LuaAST. 17 | 主要解决的问题是通过Roslyn得到的AST是完整C#源码表达式的AST, 而C#表达式很多形式Lua表达式无法表达。 18 | 需要做一系列的对表达式的Transform,涵盖C#版本各种语法表达式 19 | 20 | ``` 21 | 22 | 23 | Dll反编译形式: 24 | 借助成熟的ILSpy相关工具进行逆向AST构建。 25 | 反编译形式相对于C#源码形式,是一个逆过程,通过il指令一步步逆向得到原始的ILAst ,然后对ILAst进行转换得到LuaAst。 只关注Function的翻译。 26 | 借助ILSpy,分析dll字节码,得到最原始的带有元数据信息的il指令流,构建AST: 去栈化 --> 以跳转划分block ---> inling分析 、控制流程分析......... ---> ILAst 27 | 28 | 需要做的工作主要有两个难点: 29 | 1、基于ILSpy逆向构建C#Ast的Transform 很多lua不需要,需要屏蔽,有些需要适合lua语法需要修改。 30 | 2、基于ILSpy得出的 IL语法形式的C#Ast 在转换成C#的表达式的翻译过程 需要修改成 翻译成 Lua表达式的过程。 31 | 32 | ```C# 33 | 基于IlSpy进行翻译魔改主要有三个工作。 34 | 35 | 一、 对ILTransform 的转换需要基于针对Lua语言进行,有些Transform的变换需要适合Lua语法。剔除或者魔改。 36 | 例如 lua语法中不支持连续赋值 a=b=c=10 。 这种语法需要进行消除。 就可以在IL的transform中进行修改。 37 | 这一步是重点和难点:从最原始的il栈语言到适合LuaAst的过程的Transform实现可以参考C#的,但是Lua的表达式结构比C#要简单。很多C#形式的逻辑lua也无法表达。 38 | 需要对各个ILTransform有所了解的同时,移除不必要的Transform,和修改某些Transform,从零开始的话, 难点在于理解Transform的逻辑,然后取舍修改,也是工作量的问题。 39 | 40 | 41 | 二、将经过ILTransform 转换的适合lua的得到的基于il元数据节点信息的lua语法树。 进行lua表达式翻译。修改翻译IlAst的相关 42 | StatementBuilder.cs 43 | ExpressionBuilder.cs 44 | 45 | 这部分是对经过Transform后生成的luaAst 的il指令元数据进行翻译成lua表达式的过程, 从零开始的话也是工作量问题。 46 | 47 | 三、lua的输出节点 CSharpOutputVisitor.cs 最终得到的ILAST 对其进行适配lua语法的输出。 48 | 需要实现一个类似的Visitor. 49 | 这一步是对生成的带有IL元数据LuaAst的语法输出的工具,例如: C#中{}作为函数域,而lua没有。 50 | 51 | ``` 52 | 53 | 54 | 翻译优化,如果有 . 点调用的话,是对函数进行缓存。 -------------------------------------------------------------------------------- /Content/《LearnOpenGL》/1、Base.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《LearnOpenGL》/1、Base.md -------------------------------------------------------------------------------- /Content/《Unity Scriptable Render Pipeline》/Inctrodution-of-Univeral-RP.md: -------------------------------------------------------------------------------- 1 | 摘记阿蓝的分析:https://connect.unity.com/p/zou-jin-lwrp-universal-rp-de-shi-jie 2 | 3 | * [Universal RP 的优势](#1) 4 | * [关于前向渲染 和 延迟渲染](#2) 5 | 6 |

Universal RP 的优势

7 | URP是Unity 2019.3中替换LWRP的新名字,即通用渲染管线。将是以后Unity兼容所有平台的通用渲染管线。 8 | 9 | * URP在性能上的优势体现在哪里? 10 | 首先要知道URP和内置管线在渲染上有什么区别 11 | 12 | 1、渲染路径的差别 13 | URP是单Pass前向渲染管线,而内置管线是多Pass前向渲染管线 和 延迟管线。 URP没有延迟渲染,因此我们只对比前向渲染这一项.而延迟渲染的G-Buffer所需要的带宽带来的开销太大,目前的手机并不适用。 14 | 15 | 前向渲染:在渲染物体受点光光照的时候,分别对每个点光 对 该物体产生的影响进行计算,最后将所有的光的渲染结果相加得到最终物体的颜色。 16 | 17 | - 内置渲染管线是如何实现前向渲染的呢 :用多个pass来渲染光照,第一个pass只渲染主光源,然后多出来的光,每个光用一个pass单独渲染。这也是平时做手游的时候很少会用到点光源的原因。对于内置管线来说,每多一盏光,整个场景的drawcall就会翻倍,这个性能开销是无法接受的。 18 | 19 | - URP 的实现方法是 : 在一个pass当中,对这个物体受到的所有光源通过一个for循环一次性计算。 20 | 21 | 好处: 22 | - 1)、一个物体的光照可以一次DrawCall中计算完毕。 23 | - 2)、 省去了多个Pass的上下文切换以及光栅化等开销。 24 | 25 | 坏处: 26 | - 1)、只支持1盏直光 27 | - 2)、单个物体最多支持4盏点光 28 | - 3)、单个相机最多支持16栈灯光 29 | 30 | 因此使用URP,只要控制好电光的范围,我们在手游里面也可以做多点光照明了,例如释放一个火球照亮周围物件,这在内置管线里是基本放弃不适用的。 31 | 32 | 2、GrabPass 33 | GrabPass通常用来制作空气扰动或者刀光等特效带来的折射效果。内置管线中如果使用这个功能,则会在每个用到这个Shader的地方对屏幕缓冲区进行一次抓取操作,这个操作会大幅消耗GPU的带宽。在移动设备上贷款是非常有限的资源。另外GrabPass移动机型上很多设备并不能使用。 34 | 35 | 在URP中,可以在渲染管线的配置文件中,开启Opaque Texture ,这张图是管线在完成不透明物体渲染后,将屏幕缓冲区中(也可能是i相机的ColorRT)的颜色保持到一张单独的RT中,然后在特效中就可以直接拿这张图去进行扭曲和扰动计算。 36 | 37 | 这样做的好处是可以将抓取操作的次数恒定下来,不会因为同屏有多少个需要扰动的对象而额外增加开销。 坏处是,没有办法对不透明物体进行扰动操作了,也就是说只能对场景物件而没法对特效进行扰动。 38 | 39 |
40 | 41 | ![](Media/distortion.png) 42 | 43 | 不过Unity在URP的例子特效Shader当中直接内置了扰动的效果,通过勾选框就能开启。 44 | 45 | 3、 SRP Batcher 46 | 47 | 在所有的SRP管线中(URP和HDRP或者自定义管线),都可以受益于SRP Batcher ,这个功能可以将没有进行静态合并,也没有通过Instancing 渲染的 使用相同shader的物体, 通过CBuffer 去保存每个物体材质球的参数,进而在不进行SetPassCall的情况下完成绘制。这个功能的效果是,可以大幅降低相同DrawCall情况下单个DrawCall的开销,这个功能开启的时候,也许场景中有500个DrawCall ,单实际上SetPassCall只有不到100,在相同情况下的渲染性能是要高于内置管线不少的。 不过Shader要支持SRP Batcher 还是有些条件的。 48 | 49 | * URP在扩展性上的优势 : 50 | 51 | URP 具备了非常强大的可拓展性,其大多数功能都是完全模块化的,可以自由搭配组合,而且对她进行拓展大多数情况下不需要要修改URP本身源码。 52 | 53 | 1、RenderFeature/RenderObject 54 | 55 | 这个功能是LWRP6.x之后加入的功能,RenderObject是RenderFeature的一个默认实现,可以让大家在不写一行代码情况下对渲染管线进行渲染。 56 | 57 | 为了使用RenderObject 我们首先需要建立一个新的前向渲染器的配置文件.然后是在创建的前向渲染器配置中添加新的RenderObject. 可以指定一个Layer然后对这一层的物件使用指定的材质球 58 | 59 |

关于前向渲染 和 延迟渲染

-------------------------------------------------------------------------------- /Content/《Unity Scriptable Render Pipeline》/Media/distortion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《Unity Scriptable Render Pipeline》/Media/distortion.png -------------------------------------------------------------------------------- /Content/《Unity内置Shader解析》/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《Unity内置Shader解析》/README.md -------------------------------------------------------------------------------- /Content/《代码的简洁之道》/ClearCode.md: -------------------------------------------------------------------------------- 1 | 目录 2 | 3 | * [零、开始](#0) 4 | 5 | * [一、原则](#1) 6 | * [1、有意义的命名](#01) 7 | 8 | * [2、函数](#02) 9 | 10 | * [3、注释](#03) 11 | 12 | * [4、格式](#04) 13 | 14 | * [5、对象和数据结构](#05) 15 | 16 | * [6、错误处理](#06) 17 | 18 | * [7、边界](#07) 19 | 20 | * [8、单元测试](#08) 21 | 22 | * [9、类](#09) 23 | 24 | * [10、系统](#10) 25 | 26 | * [11、迭进](#11) 27 | 28 | * [12、并发编程](#12) 29 | 30 | * [13、逐步改进](#13) 31 | 32 | * [二、运用和总结](#2) 33 | 34 | * [14、Junit内幕](#14) 35 | 36 | * [15、重构SerialDate](#15) 37 | 38 | * [16、味道与启发](#16) 39 | 40 |

有意义命名

41 | 给变量,函数,参数,类,封包等命名需要遵循的几个规则。下手之前仔细思考命名是很有必要的。 42 | 43 | * 名副其实,命名应该直指其意。 44 | * 变量,局部变量,参数,要做有意义的区分,这样阅读代码的时候能够一目了然。 45 | * 不要使用废话和废话命名。Variable永远不要出现在变量命中。 46 | * 不要用自造句,命名要具有可读性,便于搜索。 47 | * 函数类名要明确,一个概念对应一个词。函数行为尽量使用动词。便于理解和搜索。 48 | 49 |

函数

50 | 51 | * 函数长度要保持短小。 52 | * 符合单一职责原则,和开放封闭原则。确保没有副作用,偷偷的会干别的事情。 53 | * 使用描述性的函数命名,比如动词。 54 | * 函数参数尽量减少。最理想的是零参数。参数应符合输入,然后转化输出的形式。 避免标示参数,一个标识参数就意味着破坏了的那一职责原则。 55 | * 当阐述对象操作三个或以上,就意味着其中一些参数应该封装为类了。 56 | * 将指令和询问分离,不要既有操作输入,又包含对状态的询问,会造成函数本身的混杂性,出现if之类的代码。 57 | * 函数的书写要具有结构性,清晰简洁。 避免各种错误码。 58 | 59 |

注释

60 | 61 | * 首先不要废话注释,类、函数、代码命令,参数命令就是注释。 62 | * 区分好的注释和坏的注释。像一些算法可以提供注释 63 | 64 |

格式

65 | 66 | * 一个类是否清晰、简洁、可观、可维护,取决于几个因素:结构布局,结构流程,变量函数命名,类函数是否符合单一职责。 67 | 68 | * 保持自顶向下贯穿代码的信息流 : 利用间隔分行,进行垂直布局,区分结构概念。函数布局应该概念相关,相关性越强,彼此之间越近。 不管是函数还是变量,彼此相关性建立在直接依赖的基础上。 69 | 70 | * 整洁的横布局,控制长度,保持缩进。 71 | 72 |

对象和数据结构

73 | -------------------------------------------------------------------------------- /Content/《全局光照技术》/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《全局光照技术》/README.md -------------------------------------------------------------------------------- /Content/《加密与解密》/README.md: -------------------------------------------------------------------------------- 1 | * [ida快捷键](#001) 2 | * [ida快捷键](#00) 3 |

加密解密算法

4 | 5 | -------------------------------------------------------------------------------- /Content/《大话设计模式》/HeadFirst.md: -------------------------------------------------------------------------------- 1 | # 《大话设计模式》全书概览 2 | 3 | ![](Media/1.png) 4 |
5 |
6 | 7 | # 目录与说明 8 | 9 | * [零、模式构成](#00) 10 | * [一、创建型模式](#01) 11 | * [1、单例模式](#1) 12 | * [2、工厂方法](#2) 13 | * [3、抽象工厂方法](#3) 14 | * [4、建造者模式](#4) 15 | * [5、原型模式](#5) 16 | * [二、结构型模式](#02) 17 | * [6、适配器模式](#6) 18 | * [7、装饰模式](#7) 19 | * [8、桥接模式](#8) 20 | * [9、组合模式](#9) 21 | * [10、享元模式](#10) 22 | * [11、代理模式](#11) 23 | * [12、外观模式](#12) 24 | * [三、行为型模式(Part1)](#03) 25 | * [13、观察者模式](#13) 26 | * [14、模版方法模式](#14) 27 | * [15、命令模式](#15) 28 | * [16、状态模式](#16) 29 | * [17、职责链模式](#17) 30 | * [四、行为型模式(Part2)](#04) 31 | * [18、解释器模式](#18) 32 | * [19、中介者模式](#19) 33 | * [20、访问者模式](#20) 34 | * [21、策略模式](#21) 35 | * [22、备忘录模式](#22) 36 | * [23、迭代器模式](#23) 37 | 38 | * [五、] 39 | * [接口和抽象类](#24) 40 | 41 | 全书概览: 42 | 43 | ![](Media/2.jpg) 44 | 45 |

零、模式构成

46 | 47 | 通过从三方面进行介绍: 48 | 49 | - 要点 50 | - 使用场合 51 | - 引申与参考 52 | 53 | - 抽象、封装、继承、多态,是设计模式实现的基本思想和工具。 54 | 55 | - 单一职责、开放封闭原则、依赖倒置原则、里氏代换原则、合成聚合复用原则、迪米特法则,是设计模式要达到的最终目的。 56 | 57 | 58 | [C#练习工程-Gitee仓库地址](https://gitee.com/bambom/shejimoshi) 59 |
60 | 61 | 正文: 62 |
63 |
64 | 65 |

一、创建型模式

66 | 67 | - 内聚性:描述的是一个例程内部组成部分之间相互联系的紧密程度。 耦合性:描述的是一个例程与其他例程之间联系的紧密程度。 软件开发的目标应该是创建这样的例程: 内部完整(高内聚),与其他例程之间联系是小巧、直接、可见、灵活的(松耦合)。 68 | 69 | - 创建型模式隐藏了这些类的实例是如何被创建和放在一起的,整个系统关于这些对象所知道的是有抽象类所定义的接口。这样,创建型模式在创建了什么、谁创建的类、类是怎么被创建的,以及何时创建这些方面提供了很大的灵活性。 70 | 71 | - 创建型模式抽象了实例化的过程。他们帮助一个系统独立于如何创建、组合和表示它的那些对象。创建性模式都会将关于该系统使用哪些具体的类的信息封装起来。允许客户用结构和功能差别很大的‘产品’对象配置一个系统。配置可以是静态的,即在编译时指定,也可以是动态的在运行时指定。 72 | 73 | - 当一个系统应该独立于他的产品创建、构成、和表示时,应该考虑用创建型模式。 74 | 75 |

1、单例模式

76 | 77 | 保证一个类仅有一个实例,并提供一个访问它的全局访问点 78 | 79 | ### 要点 80 | 81 | - 让类自身负责保持它的唯一实例。这个类可以保证没有其他实例可以被创建,并且提供访问该实例的方法。对唯一的实例可以严格控制客户如何以及怎样访问。 82 | 83 | - 多线程单例需要保证线程安全,需要对实例添加锁。 84 | 85 | - 直接加锁每次都有lock判定,所以有了双重锁定(Double-Check Locking)。 86 | 87 |

2、工厂方法模式

88 | 89 | 定义一个用于创建对象的接口,让子类决定实例化哪一个类,工厂模式使一个类的实例化延迟到其子类。 90 | 91 | ### 要点 92 | 93 | - 相对于简单工厂,将对象创建定义出抽象接口,便于抽象实例的扩展的变化,保持了简单工厂的优势???,在我们增加新的产品时,不需要去更改原有的产品体系和工厂类,只需要拓展新的类就可以了。对于厂来说符合开放封闭原则。 94 | 95 | - 但是由于将工厂的选择判断转移到了客户端,和客户端的耦合性又大大增加了。 96 | 97 | - 工厂模式的优势在于,通常设计应该从工厂方法开始,当设计者需要更多灵活性时,便会想其他创建型模式演化。当设计者在设计标准间进行权衡的时候,了解多个创建型模式可以给设计者更多的选择余地。 98 | 99 |

3、抽象工厂模式

100 | 101 | 提供一个创建一系列或线管依赖对象的接口,而无需指定他们具体的类。 102 | 103 | ### 要点 104 | 105 | - 它让具体的创建实例过程与客户端分离,客户端是他用过他们的抽象接口操纵实例,产品的具体类名也被具体工厂的实现分离,不会出现在代码中。 106 | 107 | - 抽象工厂在变更的时候虽然修改只用改变工厂类,但是工厂类多了也麻烦,和客户端的耦合大,使用简单工厂将接口统一能让代码更好的解耦内聚。可以结合简单工厂,通过依赖注入,克服简单工厂和抽象工厂的坏处,结合使用 108 | 109 | ### 使用场合 110 | 111 |

4、建造者模式

112 | 113 | 将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。 114 | 115 | ### 要点 116 | 117 | - 将一个复杂对象的构建与它的表示分离,这样就可以很容易的改变一个产品的内部表示,并且使得构造代码和表示代码分开。这样对于客户来说,它无需关系产品的创建过程,只要告诉我们需要什么,就能用。实际的建造过程由指挥者(Director)封装建造过程,它隔离用户与建造过程的关联。 118 | 119 | - 当需要改变一个产品的内部表示时,由于建造代码和表示代码是分离的,只需要再定义一个具体的建造者就可以了。 120 | 121 | - 用户只用指定需要见着的类型(业务结果),而具体的建造过程和细节(业务逻辑)就不需要知道了 122 | 123 | ### 使用场合 124 | 125 | - 建造者模式是当创建复杂对象的算法,应该独立于该对象的组成部分,和他们的装配方式的时候的一种模式 126 | 127 |

5、原型模式

128 | 129 | 用原型实例指定创建对象的种类,并通过拷贝这些原型创建新的对象。 130 | 131 | ### 要点 132 | 133 | - 从一个对象再创建另一个可定制的对象,而且不需要知道任何创建的细节。 134 | 135 | - 一般在初始化的信息不发生变化的时候,克隆是最好的解决办法,不需要知道对象创建的细节,对性能有大大的提高了。 136 | 137 | - 建立相应数目的原型并克隆他们通常比每次使用合适状态手工实例化该类更方便些。 138 | 139 |
140 | 141 |

一、结构型型模式

142 | 143 | 对象的继承关系在编译时就定义好了,无法在运行时改变从父类继承的实现。 子类的实现与父类有非常紧密的依赖关系,以至于父类的实现中的任何变化必然会导致子类发生变化。 当要服用子类时候,如果继承的实现不适合解决问题,就要变更父类,使得可拓展性变差,最终这种依赖关系破坏了复用性。所以,在类的设计中,优先使用合成/聚合复用原则,而不是类继承。 144 | 145 | 合成/聚合复用原则:聚合表示一种弱的拥有关系,体现的是A对象可以包含B对象,但B对象不是A对象的一部分; 146 | 合成则是一种强 ‘拥有’ 关系,体现了严格的部分和整体的关系,部分和整体的生命周期一样。 147 | 148 | 149 |

6、适配器模式

150 | 151 | 将一个类的接口转化为客户希望的另一个接口。适配器模式使得原本由于接口不兼容而不能在一起工作的那些类可以一起工作。 152 | 153 | ### 要点 154 | 155 | - 通过包装一个原始对象,把源接口转换成目标接口。 156 | 157 | ### 使用场合 158 | 159 | - 在系统的数据和行为都正确,但是接口不符时,应该使用适配器。使用一个已经存在的类,而他的接口不符合要求,或者希望创建一个可以复用的类,该类可以与其他不相关的类或不可预见的类协同工作。适配器模式这时候就合适使用,可以让这些接口不同的类通过适配后,协同工作。 160 | 161 | ### 思考 162 | 163 | - 适配器主要解决两个已有接口之间不匹配的问题,不需要考虑这些接口是怎样实现的,也不用考虑他们各自可能会如何演化。它不需要对两个独立的设计中任何一个进行重新设计。但是当接口不同时,首先更应该考虑重构统一接口,只有在双方都不太容易修改的时候再使用适配器模式适配 164 | 165 |

7、装饰模式

166 | 167 | 动态的给一个对象添加一些额外的职责。就增加功能来说,装饰模式相比生成子类更加灵活。 168 | 169 | ### 要点 170 | 171 | - 装饰模式通过对对象进行一层封装,利用SetComponent对对象进行包装。这样每个具体的装饰对象的实现就和如何使用这个对象分开了。每个装饰对象只关心自己的供能。而如何被添加到对象链中就让客户去调用。 172 | - 装饰者模式,可以更加灵活、以动态、透明的方式给单个对象添加职责,并在不需要时,撤销相应的职责。 173 | - 把类中的装饰功能从类中搬移去除,简化原有的类。 同时有效的把核心职能和装饰工能区分开了。还可以去除相关类中重复的装饰逻辑。 174 | 175 | ### 使用场合 176 | 177 | - 当给系统添加一些新功能的时候,这些新的代码通常是对原有类的核心职责或主要行为的装饰。但是在主类中添加新的字段、方法、和逻辑增加了主类的复杂度,这些新的东西仅仅是为了满足一些只在某种特定情况下才会执行的特殊行为的需要。 这种情况下,可以使用装饰者模式,把每个装饰的功能放在单独的类中,让这个类包装它所要装饰的对象,添加新的逻辑。然后客户端运行的时候需要使用到这个新的逻辑的时候就有选择的按序使用装饰。 178 | 179 | 180 | ### 引申和思考 181 | 182 | - 装饰者模式,主要是针对一个类的结构,进行简化和拆分。简化类的职责,便于拓展。将装饰的实现和如何使用隔离,让客户选择如何搭配使用装饰。 183 | 184 | - 装饰者更多的是在处理一件事情前的一些操作处理进行装饰划分。 比如创建角色的宠物,是不是可以套用为一个装饰? 185 | 186 | - 要注意的是,装饰者模式具有顺序性。 比如加密数据 和 过滤词汇都可以是数据持久化前的装饰功能,但是如果客户先加密数据再使用过滤功能就会出现问题。 最好是保持装饰类间彼此独立。 187 | 188 |

8、桥接模式

189 | 190 | 将抽象部分与他们的实现部分分离,使得他们可以独立的变化。 191 | 192 | ### 要点 193 | 194 | - 找出变化并封装。 将抽象中的具有变化的实现,进行分离出来,然后组合到抽象类中。这样将变化独立了出来,便于变化的拓展,同时不需要通过在继承去实现这些角度的变化。 195 | - 196 | - 在设计之初就需要考虑到这一点。 197 | 198 | ### 使用场合 199 | 200 | - 如果实现系统的继承体系中,有多角度的分类,有两个甚至多个方向的变化,那么就需要解耦这些不同方向的变化,通过对象组合的方式,把两个角色之间的继承关系改为组合的关系,从而使得可以应对各自独立的变化。 这样可以避免庞大耦合的类继承形成的结构。 201 | 202 | ### 引申和思考 203 | 204 | - 桥接也是给另一个对象提供一定程度的间接性。但是桥接是在设计之初,就对抽象接口与它的实现部分进行桥接,让抽象与实现两者可以独立演化。 205 | 206 | - 最主要的就是,优先使用对象的 合成/聚合,有助于帮你保持每个类被封装起来,并集中在单个任务上。这样类的继承能保持比较小的规模,更具有拓展性。 207 | 208 |

9、组合模式

209 | 210 | 将对象组合成树形结构以表示‘部分整体’的层次结构,组合模式使得用户对单个对象和组合对象的使用具有一致性。 211 | 212 | ### 要点 213 | 214 | - 用户使用组合类接口与组合结构中的对象进行交互,如果接受者是一个叶节点,者直接处理请求,如果接受者是组合对象,通常将请求发送给他的子部件,并在转发请求之前或之后可能执行一些辅助操作。 215 | 216 | - 可以让用户一致的使用组合结构和单个对象。 任何用到基本对象的地方都可以使用组合对象。 217 | 218 | ### 使用场合 219 | 220 | - 当需求中是体现部分与整体层次的结构时,你希望用户可以忽略组合对象与单个对象的不用,统一的使用组合结构中的所有对象时,可以考虑使用组合模式。 221 | 222 | ### 引申和思考 223 | 224 |

10、享元模式

225 | 226 | 为运用共享技术有效的支持大量细粒度的对象。通过服用内存中已经存在的对象,降低系统创建对象实例的性能消耗。 227 | 228 | ### 要点 229 | 230 | - 享元模式有两种状态 231 | - 内部状态:在享元对象内部,并且不会随环境改变而改变的共享部分,是享元对象的内部状态。对任何一个享元对象而言,内部状态的值是完全相同的。 232 | - 外部状态:会根据环境改变而改变的,是外部状态。是需分离出来的不可共享的,对于不同的享元对象而言,他的值可能是不同的。 233 | - 享元模式通过共享内部状态,区分外部状态,有效隔离系统中变化部分和不变部分。 234 | 235 | ### 使用场合 236 | 以下情况都可以使用享元模式: 237 | - 如果一个应用程序使用了大量的对象,而大量的这些对象造成了很大的存储开销时。 238 | - 对象的大多数状态可以外部状态。 239 | - 系统中某个对象类型的实例较多的时候。 240 | - 在系统设计中,对象实例进行分类后,发现真正有区别的类很少的时候 241 | 242 | ### 引申与参考 243 | 244 | - 为了返回一个已经创建的享元,要和已经实例化的对象建立联系,可以使用对象池来操作。 245 | - 当使用状态模式时可以配合享元模式,在不同的状态机上使用相同的对象实例。 246 | 247 |

11、代理模式

248 | 249 | 为其他对象提供一种代理以控制这个对象的访问。 250 | 251 | ### 要点 252 | 253 | - 代理与外观的主要区别在于,代理对象代表一个单一对象,而外观对象代表一个子系统。 254 | 255 | - 代理的客户对象无法直接访问目标的对象,由代理提供单独的目标对象的访问控制。 而外观的客户对象可以直接访问子系统中的各个对象,但通常外观对象提供对子系统各元件工能的简化的共同层次的调用接口。 256 | 257 | - 代理是一种原来对象的代表,其他需要与这个对象打交道的操作都是和这个代表交涉。而适配器不需要虚构出一个代表者,只要为应付特定使用目的,将原来的类进行一些组合。 258 | 259 | ### 使用场合 260 | 261 |

12、外观模式

262 | 263 | 为子系统中的一组接口提供一个一致的界面,外观模式定义了一个高层接口,这个接口使得这一子系统更加容易使用。 264 | 265 | ### 要点 266 | 267 | - 设计初期阶段,应该有意思的将不同的两个层分离,经典的三层架构,就需要考虑在 数据访问层 和 业务逻辑层 和 表现层 的层与层之间建立外观,这样可以为复杂的子系统提供一个简单的接口,降低耦合。 268 | 269 | - 开发阶段:子系统往往因为不断的重构演化而变的复杂,大多数的模式使用的时候也会产生很多很小的类,给调用者带来了使用上的困难,增加外观Facade 可以提供一个简单的接口,减少他们之间的依赖。 270 | 271 | - 维护遗留大型系统:在基于庞大复杂的旧系统上开发新系统的时候,通过为新系统开发一个外观Facade类,来提供设计粗糙或或高度复杂的遗留代码比较清晰简单的接口,让新系统与Facade对象交互,Facade与遗留代码交互所有复杂的工作。 272 | 273 | - 如果两个类不必彼此直接通信,那么就不要让这两个类发生直接的相互作用。如果实在需要可以通过第三者来转发调用。 274 | 275 | - 让一个子系统间的通信和相互依赖关系达到最小,而具体办法就是引入一个外观对象,它为子系统提供了一个单一而简单的屏障。 276 | 277 | ### 思考 278 | 279 | - 通常企业软件的三层或N层架构,层与层之间的分离其实就是外观模式的体现。 280 | - 适配器模式:当需要使用一个现有的类,但是接口并不符合要求,考虑使用适配器模式。将一个对象包装起来改变接口。 281 | - 外观模式:当需要简化并统一一个/一群很大的接口的时候,考虑使用外观模式。依托与子系统执行。 282 | - 装饰模式:将一个对象包装起来,增加行为和责任。 283 | 284 |
285 |
286 |

三、行为型模式(Part1)

287 | 288 |
289 | 290 |

13、观察者模式

291 | 292 | 定义对象间的一种一对多的依赖关系,当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并且被自动更新。 293 | 294 | ### 要点 295 | 296 | - 将系统分割成一系列相互协作的类不好的地方是需要维护相关对象间的一致性,而这样会导致各种类的紧密耦合,对维护、拓展和重用都带来不便。 297 | 298 | - 观察者模式的工作就是将两个对象间的联系进行解耦,让耦合的双方都依赖于抽象,而不是具体。 299 | 300 | ### 使用场合 301 | 302 | - 当一个抽象模型有两个方便,其中一个方面依赖于另一方面. 303 | 304 | ### 思考引申 305 | 306 | - 就C#而言有更好的实现方式,通过委托能写出更简洁方便,低耦合的观察者模式。 307 | 308 |

14、模板方法模式

309 | 310 | 定义一个操作的算法骨架,将一些步骤延迟到子类中,模板方法使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤。 311 | 312 | ### 要点 313 | 314 | - 模板方法模式由一个抽象类组成,这个抽象类定义了需要覆盖的可能有不同实现的模板,每个从这个抽象类派生的具体类将为此模板实现新的方法。这昂所有可重复的代码都提炼到抽象类中,这也是继承的最大的好处,可以从基类免费获取一些东西。 315 | 316 | ### 使用场合 317 | 318 | - 当看到一个以上相同的程序结构,那么就应该设法将她们统一。 319 | - 完全相同的代码时 320 | - 微妙的重复出现在 表面不同,但是本质相同的 结构 或 处理步骤中,折合时候也需要将重复统一。 321 | 322 |

15、命令模式

323 | 324 | 将一个请求封装为一个对象,从而使你可以用不用的请求对客户进行参数化;可以对请求排队或记录请求日志,以及支持可撤销的操作。 325 | 326 | ### 要点 327 | 328 | - 将一组行为抽象为对象,这个对象和其他对象一样可以被存储和传递,从而实现行为请求者与行为实现者之间的松耦合,这就是命令模式。 329 | 330 | - 命令模式是回调机制的面向对象版本。 331 | 332 | - 命令模式的本质是对命令的封装,将发出的命令的责任和执行命令的责任分开。 333 | 334 | - 命令模式的优点是:对类间的解耦、可拓展性抢、易于命令的组合维护、易于其他模式结合,而缺点是会导致类的膨胀。 335 | 336 | - 命令模式有不少的细分种类, 实际使用时应根据当前所需来找到合适的设计方式。 337 | 338 | ### 使用场合 339 | 340 | - 命令模式很适合实现诸如撤销,重做,回放,时间倒流之类的功能。 341 | 342 | - 基于命令模式实现录像与回放等功能,也就是执行并解析一系列经过预录制的序列化后的个玩家操作的有序命令集合。 343 | 344 | ### 思考和引申 345 | 346 | - 将调用操作的对象与知道如何实现该操作的对象解耦。 在两者之间可以处理很多其他的事情。 具体怎么做可以是不用时刻指定、排列和执行亲求。实施操作 前存储状态,一边支持取消/重做的操作。 347 | 348 | - 最终可能得到很多不同的命令类。为了更容易实现这些类,定义一个具体的基类,包含一些能定义行为的高层方法,往往会有帮助 349 | 350 |

16、状态模式

351 | 352 | 允许一个对象在其内部状态改变时改变他的行为,让对象看起来似乎修改了它的类。 353 | 354 | ### 要点 355 | 356 | - 状态模式用来解决当控制一个对象状态转换的条件表达式过于复杂的情况,它把状态的判断逻辑转移到表示不同的一系列类当中,可以把复杂的逻辑判断简单化。 357 | 358 | - 状态模式的实现三个要点: 359 | - 为状态定义一个接口。 360 | - 为每个状态定义一个类。 361 | - 恰当地进行状态委托。 362 | 363 | - 通常来说,状态模式中状态对象的存放有两种实现存放的思路“ 364 | - 静态状态。初始化时把所有可能的状态都New好,状态切换时通过赋值改变当前的状态。 365 | - 实例化状态。每次切换状态时动态new出新的状态。 366 | 367 | ### 使用场合 368 | 369 | 业务逻辑中,如果涉及到复杂的状态切换时,可以运用状态模式以及状态机来高效的完成任务。 370 | 有限状态机的实现方式,有两种: 371 | 372 | - 用枚举配合Switch case 语句 373 | - 用多态与虚函数(即状态模式)。 374 | 375 | 有限状态机在以下情况成立时可以使用: 376 | 377 | - 有一个行为基于一些内在状态的实体。 378 | - 状态可以被严格的分割为相对较少的不相干的项目。 379 | - 实体可以响应一系列输入或事件。 380 | 381 | ### 引申思考 382 | 383 | - Hierarchical State Machines 分层状态机: 384 | 385 | - Pushdown Automata下推自动机: 386 | 387 | - 本节内容相关的英文原文: 388 | 389 | - 本节内容相关的中文翻译: 390 | 391 |
392 | 393 |

17、责任链模式

394 | 395 | 使多个对象都有机会处理请求,从而避免请求的发送者和接受者之间的耦合关系。将这些对象连成一条链,并沿着这条链传递该请求,知道有一个对象处理它为止。 396 | 397 | ### 要点 398 | 399 | - 有多个对象可以处理一个请求,哪个对象处理该请求事先并不知道,要在运行时刻自动确定,此时,最好的方法就是让请求发送者与具体处理者分离,让客户在不明确指定接收者的情况下,提交一个请求,然后由所有能处理这请求的对象连成一条链,并沿着这条链传递该请求,直到有一个对象处理它为止。 400 | 401 | 402 |

四、行为模式(Part2)

403 | 404 |

18、解释器模式

405 | 406 | 给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器使用该表示来解释语言中的句子。 407 | 408 |

19、中介者模式

409 | 410 | 用一个中介对象来封装一系列的对象交互。中介者使各对象不需要显式的相互引用,从而使其耦合松散,而且可以独立的改变他们之间的交互。 411 | 412 |

20、访问者者模式

413 | 414 | 表示一个作用于某对象结构中的各元素的操作。它使你可以在不改变各元素的类的前提下定义作用于这些元素的新操作。 415 | 416 |

21、策略模式

417 | 418 | 定义一系列的算法,把他们一个个封装起来,并且使他们可相互替换。本模式可以是的算法可独立于使用它的客户而变化 419 | 420 |

22、备忘录模式

421 | 422 | 在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可以将该对象恢复到原先保存的状态 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 |

接口和抽象类

434 | https://www.cnblogs.com/xcsn/p/9304406.html 435 | 436 | 接口隔离原则:不要把多个功能全集中在一个接口。接口实现的功能要相对单一 437 | 以来倒置原则:针对接口编程而不是针对实现编程。 438 | 439 | 接口抽象行为,抽象类抽象对象 440 | 用抽象类实现接口。 子类在继承基类 441 | 抽象类和接口本质上都是系统的最高抽象 442 | 443 | 思想层面上:抽象是类,是对本体的抽象。 表示一种IS-A关系的抽象。 抽象类的使用动机是在不允许实例化的限制下复用代码 444 | 接口是行为的抽象,表示能CAN-DO的抽象。接口的使用动机 ,松散耦合;同时它是一组规则的集合,是对调用者的保证,对被调用者的约束,另一个动机就是实现多态 -------------------------------------------------------------------------------- /Content/《大话设计模式》/Media/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《大话设计模式》/Media/1.png -------------------------------------------------------------------------------- /Content/《大话设计模式》/Media/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《大话设计模式》/Media/2.jpg -------------------------------------------------------------------------------- /Content/《有用的商学课》/README.md: -------------------------------------------------------------------------------- 1 | [1、机会成本](#001) 2 | 3 |

1、机会成本

4 | 5 | 机会成本指当把一定的经济资源用于生产某种商品时,放弃的另一些产品生产商最大的收益。 6 | 简单来说就是你选择做一件事情的时候,需要放弃的其它事情所产生的最大收益。它为正确合理的选择提供了逻辑严谨、论据有利的答案。在进行选择的时候,尽量选择机会成本小的 -------------------------------------------------------------------------------- /Content/《游戏编程模式》/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/《游戏编程模式》/README.md -------------------------------------------------------------------------------- /Content/休闲游戏/APP.md: -------------------------------------------------------------------------------- 1 | # app 2 | 3 | [opencv for unity](https://github.com/EnoxSoftware/OpenCVForUnity) 4 | 5 | [FFmpeg Unity Bind](https://assetstore.unity.com/packages/tools/video/ffmpeg-unity-bind-93622) -------------------------------------------------------------------------------- /Content/休闲游戏/CRGame.md: -------------------------------------------------------------------------------- 1 | # app 2 | 3 | [opencv for unity](https://github.com/EnoxSoftware/OpenCVForUnity) 4 | 5 | [FFmpeg Unity Bind](https://assetstore.unity.com/packages/tools/video/ffmpeg-unity-bind-93622) -------------------------------------------------------------------------------- /Content/休闲游戏/CRMedia/成长碎片/wf_shuipian_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/CRMedia/成长碎片/wf_shuipian_0.png -------------------------------------------------------------------------------- /Content/休闲游戏/CRMedia/成长碎片/wf_shuipian_get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/CRMedia/成长碎片/wf_shuipian_get.png -------------------------------------------------------------------------------- /Content/休闲游戏/CRMedia/成长碎片/wf_shuipian_解锁炮塔位置.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/CRMedia/成长碎片/wf_shuipian_解锁炮塔位置.png -------------------------------------------------------------------------------- /Content/休闲游戏/CRMedia/成长碎片/wf_战斗主场景.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/CRMedia/成长碎片/wf_战斗主场景.png -------------------------------------------------------------------------------- /Content/休闲游戏/CRMedia/成长碎片/wf_武器列表.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/CRMedia/成长碎片/wf_武器列表.png -------------------------------------------------------------------------------- /Content/休闲游戏/CRMedia/成长碎片/wf_武器属性.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/CRMedia/成长碎片/wf_武器属性.png -------------------------------------------------------------------------------- /Content/休闲游戏/Media/infoImage1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/Media/infoImage1.png -------------------------------------------------------------------------------- /Content/休闲游戏/Media/infoImage2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/Media/infoImage2.png -------------------------------------------------------------------------------- /Content/休闲游戏/Media/infoImage3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/Media/infoImage3.jpg -------------------------------------------------------------------------------- /Content/休闲游戏/Media/infoImage4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/Media/infoImage4.jpg -------------------------------------------------------------------------------- /Content/休闲游戏/Media/infoImage5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/Media/infoImage5.jpg -------------------------------------------------------------------------------- /Content/休闲游戏/Media/infoImage6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/休闲游戏/Media/infoImage6.jpg -------------------------------------------------------------------------------- /Content/休闲游戏/selfGame.md: -------------------------------------------------------------------------------- 1 | 玩法: 关卡,兵,建造等级,和可升级的的等级要有一个对应得梯度。 2 | 3 | 建筑等级1 ,对应武器等级1-5,对应关卡1-10, 对应相应的升级的数量是有一个公式等级梯度的 4 | 5 | 6 | 关卡:无尽模式,不同地图,关卡越高解锁建筑放逐位越多 7 | 建筑: 建筑物可提升等级 8 | 建造: 建造等级越高,生成的合成建筑基础等级越高 9 | 购买: -------------------------------------------------------------------------------- /Content/各种工具/Media/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/各种工具/Media/1.jpg -------------------------------------------------------------------------------- /Content/各种工具/Media/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/各种工具/Media/2.jpg -------------------------------------------------------------------------------- /Content/各种工具/Media/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/各种工具/Media/3.jpg -------------------------------------------------------------------------------- /Content/各种工具/Tools.md: -------------------------------------------------------------------------------- 1 | 整理各种用的,用过的工具,插件等。以便快速查找. 2 | 同时摘录一些平时了解到的资源想法工具 3 | 4 | * * * 5 | 6 | ## 开发工具 7 | 8 | - [Visual Studio Code](https://code.visualstudio.com) 9 | - [JetBrains Rider]() 10 | - [JetBrains Resharper]() 11 | - [Sublime Text]() 12 | - [Notepad++]() 13 | - [Beyond Compare 4]() --- 文件比较工具 14 | 15 | - [SwitchyOmega]() --- vpn 工具 浏览器安装 SwitchyOmega工具 ,导入.bak工具。 pc导入jason 配置。 16 | 17 | - [Criware: 1、有自己专有音频编码器,不是用的mpc vorbis这些公共编码,压缩比高,音质好,0延迟 2、有视频组件,可以在UI上用半透视屏](https://www.criware.com/cn/products/adx2.html) 18 | * * * 19 | 20 | ## 逆向工具 21 | 22 | - [IDA Pro 7 -- 找破解版] 23 | - [IL2CPPDumper]() 24 | - [AssetStudio]() 25 | - [UtinyRipper](https://github.com/mafaca/UtinyRipper) 26 | - [EasyHook](http://easyhook.github.io) --- Windows上C# Hook的插件工程 27 | - [AndroidKiller]() --- apk的逆向分析拆包工具 28 | - [stud_pe]() --- 查看PE文件和识别常用加壳的工具 29 | 30 | - [NVIDIA Nsight Graphics]() -- Dx11,12以上的抓帧逆向分析工具 31 | - [Snapdragon Profiler]() --- 晓龙处理器抓帧逆向工具 32 | - [VADebug](http://www.vadebug.cn) -- 33 | - [GameGuardian](https://gameguardian.net/download) --- dump dll tool 34 | - [Renderdoc]()--- 一款shader修改和导出工具 35 | 36 | - [关于 windows dll forward, 直接hook手机打印出shader]() ![](Media/1.jpg) ![](media/2.jpg) 37 | - [MonoHooker,运行时修改C#函数](https://github.com/easy66/MonoHooker) 38 | 39 | * * * 40 | 41 | ## Plugins 42 | 43 | - [IceKori]() --- 一款抽象的可视化脚本设计工程,对于设计关卡等逻辑接口可参考 44 | 45 | * * * 46 | * [这辈子最讨厌的 Mac]() 47 | 48 | * * * 49 | ## 一些网站 很有用的资源 - 学会以产品的角度去看待 50 | 51 | - [.NET CORE 最新的源码地址](https://github.com/dotnet/corefx) 52 | - [Unity的Dot资讯](https://unity.com/cn/dots) 53 | - [设计模式](https://www.runoob.com/design-pattern/proxy-pattern.html) 54 | - [9秒社区](http://www.appcome.com) 55 | - [看雪精华帖](https://bbs.pediy.com/user-536985.htm) 56 | - [Bilibili-Unity官方资讯](https://space.bilibili.com/386224375?share_medium=android&share_source=copy_link&bbid=E2846471-B9A6-4694-8ECB-080EE654391329838infoc&ts=1567151662103) 57 | - [像素骨骼](https://blog.csdn.net/u011771335/article/details/84144098) 58 | - [将C#转换成Lua的一个开源项目工具库](https://github.com/yanghuan/CSharpLuaForUnity) 59 | - [UWR开源库-都是一些很叼的东西](https://lab.uwa4d.com/lab/5ce85b3c72745c25a88d3ec3) 60 | 61 | - [BitUp 像素游戏](https://mp.weixin.qq.com/s?__biz=MzU5MjQ1NTEwOA==&mid=2247500664&idx=1&sn=d219b6a57807a7f0192679cc08560217&chksm=fe1df7d3c96a7ec57e3d3e535bff3c29b7cc033d09c25128dd3c52b420e95f5ac60a76a92b63&mpshare=1&scene=23&srcid=0830OqmLI3LqVU3L6Mz4BYuY&sharer_sharetime=1567157796668&sharer_shareid=e261171ec7e6c6242755d4b529ecd90b#rd) 62 | 63 | - [官方使用VisualEffectGraph和HDRP制作的一个3A的第一人称视角Demo](https://github.com/Unity-Technologies/SpaceshipDemo) 64 | 65 | - [微软IL文档](https://docs.microsoft.com/zh-cn/dotnet/standard/managed-execution-process) 66 | * * * 67 | 68 | * * * 69 | ## ECS 70 | 71 | -[URL-1-一些使用示例](https://lab.uwa4d.com/folder/single/5bf79f7c6822d234aa9eca84) 72 | - [官方的示例1](https://github.com/Unity-Technologies/EntityComponentSystemSamples) 73 | - [Git的一个ECS实现-有不少项目就是用的这个实现的](https://github.com/sschmid/Entitas-CSharp#download-entitas@Eddy) 74 | - [Reactive-System 关于使用ECS时候 一些逻辑的处理 该如何组织的讨论](https://forum.unity.com/threads/reactive-system.522776/) 75 | 76 | 使用ESC的话,一些UI逻辑如何组织,一些持续连续的逻辑如何组织。比如事件驱动系统。 77 | 78 | 情景: 道具栏里使用一个道具。 79 | 逻辑组织:Reactive System. 一个Component变化了,系统能监听这个Component变化捕获他们的entity。 例如,用Entitas 的标准ecs就是定义一个物品栏的component. 变化Replace 一下这个Component,这个可以所谓所谓 单例 的全局bag,或者跟Character的 entity 关联的某个com都可以。( 该哪个System 处理以及怎么筛选Component 呢) 然后UI可以响应这个数据变化,于是就有了Reactive System. 80 | 81 | ESC麻烦的是 写“持续执行的事件” , 项目很多时候有 例如:移动3格,然后播放动画,在执行攻击 ; 关卡的事件逻辑驱动系统 。 如果用ECS ,就要组织相应的 数据--> 行为系统,还有组织一个System 串联。 也有可能把这样一个行为作为一个System 去驱动一个 Bt Tree ,或者 node. 做主要的难点还是在数据设定 和系统拆分上面 , 可拆分的细,也可以拆分的很统一。 看如何去组织的, 最后可能还不如直接几个单例接口调来调取 。 82 | 83 | unity ecs 用来写特定的表现和功能确是很不错 。 如果组织逻辑还不如直接接口类调用。 84 | 85 | 可以将功能模块分离ecs 做某个独立的系统执行,ecs简单用来定义数据, 用context 获取entity(数据) 具体页面直接操作数据就行。 86 | 87 | ECS的Arch type 。对数据的“形态” 组织非常方便 。 可以提前在某个文件定义好游戏的数据"对象" ,这样一预览就大概之道有什么数据。 88 | 89 | 吧entitas 丢到ULRuntime 效率极低,很多 要改,Replace数据的消耗极高,用ILRuntime 泛型的容器都要拷贝过来 。 吧可视化entity 功能去掉,。 在一开始没针对ILRuntime 做所谓的里外功能分离。 做到功能丢里面,热更操作接口,相当于不运行Entitas系统。 要先把战斗或者某个消耗大的功能丢进去,外面相当于设置数据一样往Unity里面的那部分功能设置数据来控制。 甚至留一些反射的操作接口,通过字符串去做一些数据的操作,写好一些规则 。外面随便搞搞GC就很高 90 | 91 | 开始都放外面热更,结果卡死,然后花了很多时间改Component数据变化不replace直接设置,把消耗的功能丢进去,例如寻路,通过外面设置数据,获取结果。 主要是多人同步,多人寻路然后走一格要判断整个事件的事件个各种限制,剧情触发,这些需要好好做里外隔离。 大头 92 | 93 | * * * 94 | -------------------------------------------------------------------------------- /Content/各种工具/vpn.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/各种工具/vpn.rar -------------------------------------------------------------------------------- /Content/文案/关于项目团队: -------------------------------------------------------------------------------- 1 | 项目是一个临时性的工程,它产生产品。 过程,包括人员 团队等等 -------------------------------------------------------------------------------- /Content/文案/关于项目团队.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/文案/关于项目团队.md -------------------------------------------------------------------------------- /Content/文案/数值/古羌传奇数值设定 - 副本.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/文案/数值/古羌传奇数值设定 - 副本.xlsx -------------------------------------------------------------------------------- /Content/文案/数值/战斗过程的基本数值知识与理论--网易.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/文案/数值/战斗过程的基本数值知识与理论--网易.doc -------------------------------------------------------------------------------- /Content/文案/数值/数值.md: -------------------------------------------------------------------------------- 1 | # 目录 2 | - [mmo的战斗和经济数值都是从产品生命周期曲线出发](https://bbs.gameres.com/thread_140453_1_1.html) 3 | - [培训公式和简单的VBA](http://www.gameres.com/485572.html) 4 | -------------------------------------------------------------------------------- /Content/文案/数值/数值.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/文案/数值/数值.zip -------------------------------------------------------------------------------- /Content/文案/数值/数值框架-属性篇by张锋.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/文案/数值/数值框架-属性篇by张锋.pdf -------------------------------------------------------------------------------- /Content/文案/自动手记人偶/log.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/文案/自动手记人偶/log.md -------------------------------------------------------------------------------- /Content/源码阅读/OP源码阅读记录.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/OP源码阅读记录.txt -------------------------------------------------------------------------------- /Content/源码阅读/东京食尸鬼源码阅读记录.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/东京食尸鬼源码阅读记录.md -------------------------------------------------------------------------------- /Content/源码阅读/原神源码阅读记录.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/原神源码阅读记录.md -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/DodGameLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/DodGameLib.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/DodProtoBase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/DodProtoBase.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/AssetUpdater.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | 6 | namespace DodGame 7 | { 8 | public class AssetUpdater : BBehaviourSingleton 9 | { 10 | private bool m_canEnterGame = false; 11 | private bool m_needRestart = false; 12 | 13 | private AssetVerInfo m_svrVerInfo = null; 14 | 15 | public AssetVerInfo svrVerInfo 16 | { 17 | get { return m_svrVerInfo; } 18 | } 19 | 20 | public string NewVersion 21 | { 22 | get { return m_svrVerInfo.m_version; } 23 | } 24 | 25 | public IEnumerator CheckUpdate(bool repairClient, StartupUI startUI) 26 | { 27 | m_svrVerInfo = null; 28 | 29 | //获取当前的版本 30 | string fullUrl = DPlatform.GetCheckVersionUrl(repairClient); 31 | BLogger.Info("version check:{0}", fullUrl); 32 | 33 | WWWEx wwwEx = WWWEx.Init(15f); 34 | yield return StartCoroutine(wwwEx.Request(fullUrl)); 35 | if (wwwEx.isTimeOut) 36 | { 37 | AssetVersionMgr.Instance.error = StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_TIMEOUT); 38 | 39 | BLogger.Warning("url reueqest timeout: {0}", fullUrl); 40 | yield break; 41 | } 42 | 43 | WWW www = wwwEx.result; 44 | if (www.error != null) 45 | { 46 | BLogger.Warning("check version update error: " + www.error); 47 | string wwwerror = www.error; 48 | www.Dispose(); 49 | AssetVersionMgr.Instance.error = StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_WWW_ERROR, wwwerror); 50 | yield break; 51 | } 52 | 53 | if (startUI != null) 54 | { 55 | startUI.ShowText(StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_GAME_ETNERING)); 56 | } 57 | 58 | Dictionary verJson = (Dictionary)MiniJSON.Json.Deserialize(www.text); 59 | if (verJson == null || verJson.Count == 0) 60 | { 61 | BLogger.Warning("parse version json data error: {0}", www.text); 62 | AssetVersionMgr.Instance.error = 63 | StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_JSON_ERROR, 1); 64 | 65 | // DBugly.ReportException("json data error", "request error url:" + fullUrl, "parse version json data error: " + www.text); 66 | www.Dispose(); 67 | yield break; 68 | } 69 | 70 | try 71 | { 72 | m_svrVerInfo = ParseVerInfo(verJson); 73 | } 74 | catch (Exception e) 75 | { 76 | BLogger.Warning("parse ver info failed:{0}", e.ToString()); 77 | DBugly.ReportException("parse ver info", "request error url:" + fullUrl, "parse ver info failed: " + e.ToString()); 78 | AssetVersionMgr.Instance.error = 79 | StartupTextConfigMgr.Instance.GetText(StartupTextDefine.ID_STARTUP_CHECK_UPDATE_JSON_ERROR, 2); 80 | m_svrVerInfo = null; 81 | } 82 | 83 | www.Dispose(); 84 | } 85 | 86 | public AssetVerInfo ParseVerInfo(Dictionary verJson) 87 | { 88 | AssetVerInfo newInfo = new AssetVerInfo(); 89 | newInfo.m_name = ReadJsonKey(verJson, "name");///verJson["name"] as string; 90 | newInfo.m_assetUrl = ReadJsonKey(verJson, "asseturl");//verJson["asseturl"] as string; 91 | newInfo.m_version = ReadJsonKey(verJson, "version"); //verJson["version"] as string; 92 | newInfo.m_updateType = (AssetUpdateType)ReadJsonKey(verJson, "update"); //(AssetUpdateType)((int)verJson["update"]); 93 | // if (verJson.ContainsKey("review")) 94 | // { 95 | // AssetVersionMgr.Instance.ReviewStatus = ReadJsonKey(verJson, "review") == 1; 96 | // } 97 | 98 | if (newInfo.m_updateType == AssetUpdateType.UPDATE_PROGRAME) 99 | { 100 | newInfo.m_err = ReadJsonKey(verJson, "err"); //标题 101 | newInfo.m_progSize = (int)ReadJsonKey(verJson, "prog_size"); //安装包大小 102 | newInfo.m_progUrl = ReadJsonKey(verJson, "prog_url"); //下载路径 103 | newInfo.m_help = ReadJsonKey(verJson, "prog_help"); //帮助页面路径 104 | } 105 | if (newInfo.m_updateType == AssetUpdateType.UPDATE_ERROR) 106 | { 107 | newInfo.m_err = ReadJsonKey(verJson, "err"); //错误信息 108 | } 109 | 110 | return newInfo; 111 | } 112 | 113 | private T ReadJsonKey(Dictionary json, string key) 114 | { 115 | return AssetBundleUtil.ReadJsonKey(json, key); 116 | } 117 | 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/DodGameLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/DodGameLib.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/DodProtoBase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/DodProtoBase.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/GameBase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/GameBase.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/GameLogic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/GameLogic.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/GameNative.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/GameNative.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/GameProto.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/GameProto.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/IgnorAsset.txt: -------------------------------------------------------------------------------- 1 | Assets/Resources/Config/AbEditorConfig -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/NeverExpireDir.txt: -------------------------------------------------------------------------------- 1 | Assets/Resources/Scenes -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/PackToDirRule.txt: -------------------------------------------------------------------------------- 1 | [ 2 | {"asset":"Assets/Resources/Luac","priority":0,"deep":0}, 3 | {"asset":"Assets/Resources/SkillDisp","priority":2,"deep":0}, 4 | {"asset":"Assets/Resources/Media/UI","priority":2,"deep":-1}, 5 | {"asset":"Assets/Textures/Background","priority":3,"deep":1}, 6 | {"asset":"Assets/Textures/Plot","priority":3,"deep":1}, 7 | {"asset":"Assets/Textures/Mask","priority":4,"deep":1}, 8 | {"asset":"Assets/Resources/Effect","priority":5,"deep":-1}, 9 | {"asset":"Assets/Prefabs/Plants","priority":4,"deep":-1}, 10 | ] -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/ResourceDir.txt: -------------------------------------------------------------------------------- 1 | Effect/Tips -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/ResourcesImp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using UnityEngine; 6 | using UnityEngine.SceneManagement; 7 | using Object = UnityEngine.Object; 8 | 9 | namespace DodGame 10 | { 11 | public class ResourceBehaviour : BBehaviourSingleton 12 | { 13 | } 14 | 15 | public class ResourcesImp : IResources 16 | { 17 | #region 资源管理 18 | public void MarkResourceHotUnload(string resPath) 19 | { 20 | XResource.MarkResourceAbHotUnload(resPath); 21 | } 22 | 23 | public void SetGoPoolEnable(bool enable) 24 | { 25 | XResource.EnableGoPoolRecycle = enable; 26 | } 27 | 28 | /// 29 | /// 设置是否需要打印内存池满的日志 30 | /// 31 | /// 32 | public void SetPoolFullLog(bool enable) 33 | { 34 | XResource.LogWhenPoolFull = enable; 35 | } 36 | 37 | public bool IsGoPoolEnable() 38 | { 39 | return XResource.EnableGoPoolRecycle; 40 | } 41 | 42 | public int GetAllAssetBundleCount() 43 | { 44 | if (GameCoreConfig.UseAssetBundle) 45 | { 46 | return AssetBundlePool.Instance.GetAllAssetBundleCount(); 47 | } 48 | 49 | return 0; 50 | } 51 | 52 | /// 53 | /// 设置允许同时异步载入的资源个数 54 | /// 55 | /// 56 | public void SetMaxResourceLoadNum(int maxLoadNum) 57 | { 58 | XResource.SetMaxResourceAsyncLoadNum(maxLoadNum); 59 | } 60 | 61 | /// 获取当前允许同时异步载入的资源个数 62 | /// 63 | /// 64 | public int GetMaxResourceLoadNum() 65 | { 66 | return GameCoreConfig.ResourceMaxAsyncLoadNum; 67 | } 68 | 69 | /// 70 | /// 卸载不使用的内存资源 71 | /// 72 | public void UnloadUnusedAssets() 73 | { 74 | Resources.UnloadUnusedAssets(); 75 | } 76 | 77 | /// 78 | /// 卸载不使用的assetbundle 79 | /// 80 | public void UnloadUnusedAb(bool unloadNeverExpireAb) 81 | { 82 | XResource.UnloadUnusedAb(unloadNeverExpireAb); 83 | } 84 | 85 | 86 | #endregion 87 | 88 | public void DestroyObject(UnityEngine.Object go) 89 | { 90 | if (go is GameObject) 91 | { 92 | XResource.FreeGameObject(go as GameObject); 93 | } 94 | else 95 | { 96 | Object.Destroy(go); 97 | } 98 | } 99 | 100 | public void DestroyObject(UnityEngine.Object go, float delayTime) 101 | { 102 | if (go is GameObject) 103 | { 104 | XResource.FreeGameObject(go as GameObject, delayTime); 105 | } 106 | else 107 | { 108 | Object.Destroy(go, delayTime); 109 | } 110 | } 111 | 112 | public Shader FindShader(string shaderName) 113 | { 114 | return XResource.FindShader(shaderName); 115 | } 116 | 117 | 118 | public GameObject AllocGameObject(string resPath, Transform parent, bool initEnable) 119 | { 120 | return XResource.AllocOrNewInstanceGo(resPath, parent, initEnable); 121 | } 122 | 123 | public GameObject AllocGameObject(string resPath, Transform parent, Vector3 localPos, 124 | Quaternion localRot, bool initEnable) 125 | { 126 | return XResource.AllocOrNewInstanceGo(resPath, parent, true, localPos, localRot, initEnable); 127 | } 128 | 129 | public void AllocGameObjectAsync(string resPath, Action onLoaded, Transform parent, bool initEnable, BAsyncOper oper) 130 | { 131 | XResource.AllocOrNewInstanceGoAsync(resPath, onLoaded, parent, oper, initEnable); 132 | } 133 | 134 | public void AllocGameObjectAsync(string resPath, Action onLoaded, Transform parent, Vector3 localPos, 135 | Quaternion localRot, bool initEnable, BAsyncOper oper) 136 | { 137 | XResource.AllocOrNewInstanceGoAsync(resPath, onLoaded, parent, true, localPos, localRot, oper, initEnable); 138 | } 139 | 140 | public byte[] LoadStreamAsset(string path) 141 | { 142 | var fullPath = Application.streamingAssetsPath + "/" + path; 143 | byte[] data = null; 144 | if (fullPath.Contains("://")) 145 | { 146 | #if UNITY_ANDROID && !UNITY_EDITOR 147 | data = DodLib.LoadStreamAssetFile(fullPath); 148 | #endif 149 | } 150 | else 151 | { 152 | data = AssetBundleUtil.ReadFile(fullPath); 153 | } 154 | 155 | return data; 156 | } 157 | 158 | public string LoadStreamTextAsset(string path) 159 | { 160 | var binData = LoadStreamAsset(path); 161 | if (binData != null && binData.Length > 0) 162 | { 163 | return StringUtility.UTF8BytesToString(binData); 164 | } 165 | 166 | return null; 167 | } 168 | 169 | public UnityEngine.Object LoadResourceAsset(string path, Type type, bool logNotFound) 170 | { 171 | if (type == null) 172 | { 173 | BLogger.Fatal("Invalid asset type"); 174 | return null; 175 | } 176 | 177 | LoadFromType loadFromType; 178 | return XResource.LoadAsset(path, type, out loadFromType, logNotFound); 179 | } 180 | 181 | public void LoadResourceAssetAsync(string resPath, Type type, Action onLoaded, BAsyncOper oper) 182 | { 183 | XResource.LoadAsync(resPath, type, onLoaded, oper); 184 | } 185 | 186 | public void PreloadResourceAssetAsync(string path, Action onLoaded, BAsyncOper oper) 187 | { 188 | LoadResourceAssetAsync(path, typeof(UnityEngine.Object), (loadedObj) => 189 | { 190 | if (onLoaded != null) 191 | { 192 | onLoaded(); 193 | } 194 | }, oper); 195 | } 196 | 197 | public void LoadScene(string sceneName, bool persist) 198 | { 199 | UnitySceneLoader.LoadScene(sceneName, persist); 200 | } 201 | 202 | public void LoadSceneAsync(string sceneName, Action sceneProgress, Action onLoaded) 203 | { 204 | ResourceInst.Instance.StartCoroutine(UnitySceneLoader.LoadSceneAsync(sceneName, sceneProgress, onLoaded)); 205 | } 206 | 207 | /// 208 | /// 单位KB 209 | /// 210 | /// 211 | public int GetLuaMemUsed() 212 | { 213 | if (LuaApp.HasInstance) 214 | { 215 | var env = LuaApp.Instance.LuaEnv; 216 | return env.Memroy; 217 | } 218 | 219 | return 0; 220 | } 221 | 222 | public bool IsLuaGcRunning() 223 | { 224 | if (LuaApp.HasInstance) 225 | { 226 | var env = LuaApp.Instance.LuaEnv; 227 | return env.IsGcRunning; 228 | } 229 | 230 | return false; 231 | } 232 | 233 | public bool IsUseAssetBundle() 234 | { 235 | return GameCoreConfig.UseAssetBundle; 236 | } 237 | 238 | /// 239 | /// 获取对象池中对象的总数 240 | /// 241 | /// 242 | public int GetGoPoolObjectCount() 243 | { 244 | return XResource.GetGoPoolObjectCount(); 245 | } 246 | 247 | public int GetDelayFreeObjectCount() 248 | { 249 | return XResource.GetDelayDestroyCount(); 250 | } 251 | 252 | public int GetFreedDelayCount() 253 | { 254 | return XResource.GetFreedDelayCount(); 255 | } 256 | 257 | public void ClearAllDelayDestroy() 258 | { 259 | XResource.ClearAllDelayDestroy(); 260 | } 261 | 262 | /// 263 | /// 获取缓存资源的个数 264 | /// 265 | /// 266 | public int GetCacheResourceCount() 267 | { 268 | return XResource.GetCacheResourceCount(); 269 | } 270 | 271 | /// 272 | /// 清除所有的缓存和对象 273 | /// 274 | public void FreeCacheAndPool() 275 | { 276 | XResource.FreeAllCacheAndGo(); 277 | } 278 | 279 | /// 280 | /// 暂停所有的缓存行为,一般是用在载入场景的过程中 281 | /// 282 | public void PauseAllCache() 283 | { 284 | XResource.PauseAllCache(); 285 | } 286 | 287 | public void StopAssetBundleAutoExpire() 288 | { 289 | XResource.StopAssetBundleAutoExpire(); 290 | } 291 | 292 | public void StartAssetBundleAutoExpire() 293 | { 294 | XResource.StartAssetBundleAutoExpire(); 295 | } 296 | 297 | /// 298 | /// 恢复所遇的缓存行为 299 | /// 300 | public void ResumeAllCache() 301 | { 302 | XResource.ResumeAllCache(); 303 | } 304 | 305 | /// 306 | /// 下载配置的资源,这个资源一般是立刻卸载的 307 | /// 308 | /// 309 | public void UnloadBinResource(string resPath) 310 | { 311 | XResource.UnloadResource(resPath); 312 | XResource.UnloadBinAssetBundle(resPath); 313 | } 314 | 315 | /// 316 | /// 初始化缓存配置 317 | /// 318 | public void InitCacheConfig() 319 | { 320 | ReadResourceCacheConfig(); 321 | } 322 | 323 | #region 缓存管理 324 | 325 | 326 | /// 327 | /// 读取资源的缓存策略 328 | /// 329 | void ReadResourceCacheConfig() 330 | { 331 | string cachePath = "Config/CacheConfig/need_cache_list"; 332 | TextAsset needCacheListAsset = XResource.LoadAsset(cachePath); 333 | TextAsset needPersistListAsset = XResource.LoadAsset("Config/CacheConfig/need_persist_list"); 334 | 335 | if (needCacheListAsset != null) 336 | { 337 | string configText = StringUtility.UTF8BytesToString(needCacheListAsset.bytes); 338 | if (!LoadCacheAndTimeConfig(configText)) 339 | { 340 | BLogger.Warning("-------------LoadCacheAndTimeConfig failed: {0}", cachePath); 341 | } 342 | } 343 | else 344 | { 345 | BLogger.Error("read need cache resource list config failed"); 346 | } 347 | 348 | if (needPersistListAsset != null) 349 | { 350 | List needPersistList = AssetBundleUtil.ReadTextStringList(needPersistListAsset.bytes); 351 | if (needPersistList != null) 352 | { 353 | XResource.RegPersistResPath(needPersistList); 354 | BLogger.Info("-------------register need persist res list: {0}", needPersistList.Count); 355 | } 356 | } 357 | else 358 | { 359 | BLogger.Error("read need persist resource list config failed"); 360 | } 361 | 362 | } 363 | 364 | bool LoadCacheAndTimeConfig(string configText) 365 | { 366 | try 367 | { 368 | var allConfigList = MiniJSON.Json.Deserialize(configText) as List; 369 | if (null == allConfigList) 370 | { 371 | BLogger.Error("parse depends json error"); 372 | return false; 373 | } 374 | 375 | for (int i = 0; i < allConfigList.Count; i++) 376 | { 377 | Dictionary dictItem = allConfigList[i] as Dictionary; 378 | string assetPath = AssetBundleUtil.ReadJsonKey(dictItem, "asset"); 379 | int cacheTime = (int)AssetBundleUtil.ReadJsonKey(dictItem, "time"); 380 | int poolCnt = (int)AssetBundleUtil.ReadJsonKey(dictItem, "poolcnt"); 381 | XResource.RegCacheResPath(assetPath, cacheTime, poolCnt); 382 | 383 | BLogger.Info("[{0}]cache resource[{1}] cache time: {2} pool max count:{3}", i, assetPath, cacheTime, poolCnt); 384 | } 385 | 386 | return true; 387 | } 388 | catch (Exception e) 389 | { 390 | BLogger.Error("LoadCacheAndTimeConfig failed: " + e.ToString()); 391 | return false; 392 | } 393 | } 394 | #endregion 395 | } 396 | } 397 | -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/SharedDependAsset.txt: -------------------------------------------------------------------------------- 1 | Assets/Resources/UIRaw 2 | Assets/Prefabs/Scene 3 | Assets/Prefabs/Plants 4 | Assets/Resources/Actor 5 | Assets/Resources/Effect -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/UnityEngine.UI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/UnityEngine.UI.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/UnityEngine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/UnityEngine.dll -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/need_cache_list.txt: -------------------------------------------------------------------------------- 1 | [ 2 | {"asset":"Effect/common","time":120, "poolcnt":30}, 3 | {"asset":"Effect/hero","time":120, "poolcnt":30}, 4 | {"asset":"Effect/guai","time":120, "poolcnt":30}, 5 | {"asset":"Media/UI", "time":0}, 6 | {"asset":"Media/Skill", "time":300}, 7 | {"asset":"Media/Voice", "time":300}, 8 | {"asset":"Actor/", "time":180, "poolcnt":30}, 9 | {"asset":"Animator/", "time":0}, 10 | {"asset":"UI/", "time":120} 11 | ] -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/need_persist_assetbundle.txt: -------------------------------------------------------------------------------- 1 | fonts 2 | xgame_shader -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/need_persist_list.txt: -------------------------------------------------------------------------------- 1 | Effect/Tips 2 | Effect/Shadow 3 | Media/AudioPlayer 4 | Texture/Decals 5 | UI/ModalSprite 6 | UI/TalkUI 7 | Actor/Bianshen/bianshen -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/DMLT/文件说明.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/DMLT/文件说明.txt -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/GameBase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/GameBase.png -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/GameNative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/GameNative.png -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_1.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_10.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_11.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_2.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_3.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_4.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_5.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_6.png -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_7.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_8.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/Game_9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/大梦龙图/Media/Game_9.jpg -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/ResourcesImp1.cs: -------------------------------------------------------------------------------- 1 | //using BGame; 2 | //using GameBase; 3 | //using System; 4 | //using System.Collections; 5 | //using System.Collections.Generic; 6 | //using System.IO; 7 | //using UnityEngine; 8 | //using UnityEngine.SceneManagement; 9 | //using Object = UnityEngine.Object; 10 | 11 | //namespace DodGame 12 | //{ 13 | // public class ResourceBehaviour : BBehaviourSingleton 14 | // { 15 | // } 16 | 17 | // public class ResourcesImp : IResources 18 | // { 19 | // #region 资源管理 20 | // public void MarkResourceHotUnload(string resPath) 21 | // { 22 | // XResource.MarkResourceAbHotUnload(resPath); 23 | // } 24 | 25 | // public void SetGoPoolEnable(bool enable) 26 | // { 27 | // XResource.EnableGoPoolRecycle = enable; 28 | // } 29 | 30 | // /// 31 | // /// 设置是否需要打印内存池满的日志 32 | // /// 33 | // /// 34 | // public void SetPoolFullLog(bool enable) 35 | // { 36 | // XResource.LogWhenPoolFull = enable; 37 | // } 38 | 39 | // public bool IsGoPoolEnable() 40 | // { 41 | // return XResource.EnableGoPoolRecycle; 42 | // } 43 | 44 | // public int GetAllAssetBundleCount() 45 | // { 46 | // if (GameCoreConfig.UseAssetBundle) 47 | // { 48 | // return AssetBundlePool.Instance.GetAllAssetBundleCount(); 49 | // } 50 | 51 | // return 0; 52 | // } 53 | 54 | // /// 55 | // /// 设置允许同时异步载入的资源个数 56 | // /// 57 | // /// 58 | // public void SetMaxResourceLoadNum(int maxLoadNum) 59 | // { 60 | // XResource.SetMaxResourceAsyncLoadNum(maxLoadNum); 61 | // } 62 | 63 | // /// 获取当前允许同时异步载入的资源个数 64 | // /// 65 | // /// 66 | // public int GetMaxResourceLoadNum() 67 | // { 68 | // return GameCoreConfig.ResourceMaxAsyncLoadNum; 69 | // } 70 | 71 | // /// 72 | // /// 卸载不使用的内存资源 73 | // /// 74 | // public void UnloadUnusedAssets() 75 | // { 76 | // Resources.UnloadUnusedAssets(); 77 | // } 78 | 79 | // /// 80 | // /// 卸载不使用的assetbundle 81 | // /// 82 | // public void UnloadUnusedAb(bool unloadNeverExpireAb) 83 | // { 84 | // XResource.UnloadUnusedAb(unloadNeverExpireAb); 85 | // } 86 | 87 | 88 | // #endregion 89 | 90 | // public void DestroyObject(UnityEngine.Object go) 91 | // { 92 | // if (go is GameObject) 93 | // { 94 | // XResource.FreeGameObject(go as GameObject); 95 | // } 96 | // else 97 | // { 98 | // Object.Destroy(go); 99 | // } 100 | // } 101 | 102 | // public void DestroyObject(UnityEngine.Object go, float delayTime) 103 | // { 104 | // if (go is GameObject) 105 | // { 106 | // XResource.FreeGameObject(go as GameObject, delayTime); 107 | // } 108 | // else 109 | // { 110 | // Object.Destroy(go, delayTime); 111 | // } 112 | // } 113 | 114 | // public Shader FindShader(string shaderName) 115 | // { 116 | // return XResource.FindShader(shaderName); 117 | // } 118 | 119 | 120 | // public GameObject AllocGameObject(string resPath, Transform parent, bool initEnable) 121 | // { 122 | // return XResource.AllocOrNewInstanceGo(resPath, parent, initEnable); 123 | // } 124 | 125 | // public GameObject AllocGameObject(string resPath, Transform parent, Vector3 localPos, 126 | // Quaternion localRot, bool initEnable) 127 | // { 128 | // return XResource.AllocOrNewInstanceGo(resPath, parent, true, localPos, localRot, initEnable); 129 | // } 130 | 131 | // public void AllocGameObjectAsync(string resPath, Action onLoaded, Transform parent, bool initEnable, BAsyncOper oper) 132 | // { 133 | // XResource.AllocOrNewInstanceGoAsync(resPath, onLoaded, parent, oper, initEnable); 134 | // } 135 | 136 | // public void AllocGameObjectAsync(string resPath, Action onLoaded, Transform parent, Vector3 localPos, 137 | // Quaternion localRot, bool initEnable, BAsyncOper oper) 138 | // { 139 | // XResource.AllocOrNewInstanceGoAsync(resPath, onLoaded, parent, true, localPos, localRot, oper, initEnable); 140 | // } 141 | 142 | // public byte[] LoadStreamAsset(string path) 143 | // { 144 | // var fullPath = Application.streamingAssetsPath + "/" + path; 145 | // byte[] data = null; 146 | // if (fullPath.Contains("://")) 147 | // { 148 | //#if UNITY_ANDROID && !UNITY_EDITOR 149 | // data = DodLib.LoadStreamAssetFile(fullPath); 150 | //#endif 151 | // } 152 | // else 153 | // { 154 | // data = AssetBundleUtil.ReadFile(fullPath); 155 | // } 156 | 157 | // return data; 158 | // } 159 | 160 | // public string LoadStreamTextAsset(string path) 161 | // { 162 | // var binData = LoadStreamAsset(path); 163 | // if (binData != null && binData.Length > 0) 164 | // { 165 | // return StringUtility.UTF8BytesToString(binData); 166 | // } 167 | 168 | // return null; 169 | // } 170 | 171 | // public UnityEngine.Object LoadResourceAsset(string path, Type type, bool logNotFound) 172 | // { 173 | // if (type == null) 174 | // { 175 | // BLogger.Fatal("Invalid asset type"); 176 | // return null; 177 | // } 178 | 179 | // LoadFromType loadFromType; 180 | // return XResource.LoadAsset(path, type, out loadFromType, logNotFound); 181 | // } 182 | 183 | // public void LoadResourceAssetAsync(string resPath, Type type, Action onLoaded, BAsyncOper oper) 184 | // { 185 | // XResource.LoadAsync(resPath, type, onLoaded, oper); 186 | // } 187 | 188 | // public void PreloadResourceAssetAsync(string path, Action onLoaded, BAsyncOper oper) 189 | // { 190 | // LoadResourceAssetAsync(path, typeof(UnityEngine.Object), (loadedObj) => 191 | // { 192 | // if (onLoaded != null) 193 | // { 194 | // onLoaded(); 195 | // } 196 | // }, oper); 197 | // } 198 | 199 | // public void LoadScene(string sceneName, bool persist) 200 | // { 201 | // UnitySceneLoader.LoadScene(sceneName, persist); 202 | // } 203 | 204 | // public void LoadSceneAsync(string sceneName, Action sceneProgress, Action onLoaded) 205 | // { 206 | // ResourceInst.Instance.StartCoroutine(UnitySceneLoader.LoadSceneAsync(sceneName, sceneProgress, onLoaded)); 207 | // } 208 | 209 | // /// 210 | // /// 单位KB 211 | // /// 212 | // /// 213 | // public int GetLuaMemUsed() 214 | // { 215 | // if (LuaApp.HasInstance) 216 | // { 217 | // var env = LuaApp.Instance.LuaEnv; 218 | // return env.Memroy; 219 | // } 220 | 221 | // return 0; 222 | // } 223 | 224 | // public bool IsLuaGcRunning() 225 | // { 226 | // if (LuaApp.HasInstance) 227 | // { 228 | // var env = LuaApp.Instance.LuaEnv; 229 | // return env.IsGcRunning; 230 | // } 231 | 232 | // return false; 233 | // } 234 | 235 | // public bool IsUseAssetBundle() 236 | // { 237 | // return GameCoreConfig.UseAssetBundle; 238 | // } 239 | 240 | // /// 241 | // /// 获取对象池中对象的总数 242 | // /// 243 | // /// 244 | // public int GetGoPoolObjectCount() 245 | // { 246 | // return XResource.GetGoPoolObjectCount(); 247 | // } 248 | 249 | // public int GetDelayFreeObjectCount() 250 | // { 251 | // return XResource.GetDelayDestroyCount(); 252 | // } 253 | 254 | // public int GetFreedDelayCount() 255 | // { 256 | // return XResource.GetFreedDelayCount(); 257 | // } 258 | 259 | // public void ClearAllDelayDestroy() 260 | // { 261 | // XResource.ClearAllDelayDestroy(); 262 | // } 263 | 264 | // /// 265 | // /// 获取缓存资源的个数 266 | // /// 267 | // /// 268 | // public int GetCacheResourceCount() 269 | // { 270 | // return XResource.GetCacheResourceCount(); 271 | // } 272 | 273 | // /// 274 | // /// 清除所有的缓存和对象 275 | // /// 276 | // public void FreeCacheAndPool() 277 | // { 278 | // XResource.FreeAllCacheAndGo(); 279 | // } 280 | 281 | // /// 282 | // /// 暂停所有的缓存行为,一般是用在载入场景的过程中 283 | // /// 284 | // public void PauseAllCache() 285 | // { 286 | // XResource.PauseAllCache(); 287 | // } 288 | 289 | // public void StopAssetBundleAutoExpire() 290 | // { 291 | // XResource.StopAssetBundleAutoExpire(); 292 | // } 293 | 294 | // public void StartAssetBundleAutoExpire() 295 | // { 296 | // XResource.StartAssetBundleAutoExpire(); 297 | // } 298 | 299 | // /// 300 | // /// 恢复所遇的缓存行为 301 | // /// 302 | // public void ResumeAllCache() 303 | // { 304 | // XResource.ResumeAllCache(); 305 | // } 306 | 307 | // /// 308 | // /// 下载配置的资源,这个资源一般是立刻卸载的 309 | // /// 310 | // /// 311 | // public void UnloadBinResource(string resPath) 312 | // { 313 | // XResource.UnloadResource(resPath); 314 | // XResource.UnloadBinAssetBundle(resPath); 315 | // } 316 | 317 | // /// 318 | // /// 初始化缓存配置 319 | // /// 320 | // public void InitCacheConfig() 321 | // { 322 | // ReadResourceCacheConfig(); 323 | // } 324 | 325 | // #region 缓存管理 326 | 327 | 328 | // /// 329 | // /// 读取资源的缓存策略 330 | // /// 331 | // void ReadResourceCacheConfig() 332 | // { 333 | // string cachePath = "Config/CacheConfig/need_cache_list"; 334 | // TextAsset needCacheListAsset = XResource.LoadAsset(cachePath); 335 | // TextAsset needPersistListAsset = XResource.LoadAsset("Config/CacheConfig/need_persist_list"); 336 | 337 | // if (needCacheListAsset != null) 338 | // { 339 | // string configText = StringUtility.UTF8BytesToString(needCacheListAsset.bytes); 340 | // if (!LoadCacheAndTimeConfig(configText)) 341 | // { 342 | // BLogger.Warning("-------------LoadCacheAndTimeConfig failed: {0}", cachePath); 343 | // } 344 | // } 345 | // else 346 | // { 347 | // BLogger.Error("read need cache resource list config failed"); 348 | // } 349 | 350 | // if (needPersistListAsset != null) 351 | // { 352 | // List needPersistList = AssetBundleUtil.ReadTextStringList(needPersistListAsset.bytes); 353 | // if (needPersistList != null) 354 | // { 355 | // XResource.RegPersistResPath(needPersistList); 356 | // BLogger.Info("-------------register need persist res list: {0}", needPersistList.Count); 357 | // } 358 | // } 359 | // else 360 | // { 361 | // BLogger.Error("read need persist resource list config failed"); 362 | // } 363 | 364 | // } 365 | 366 | // bool LoadCacheAndTimeConfig(string configText) 367 | // { 368 | // try 369 | // { 370 | // var allConfigList = MiniJSON.Json.Deserialize(configText) as List; 371 | // if (null == allConfigList) 372 | // { 373 | // BLogger.Error("parse depends json error"); 374 | // return false; 375 | // } 376 | 377 | // for (int i = 0; i < allConfigList.Count; i++) 378 | // { 379 | // Dictionary dictItem = allConfigList[i] as Dictionary; 380 | // string assetPath = AssetBundleUtil.ReadJsonKey(dictItem, "asset"); 381 | // int cacheTime = (int)AssetBundleUtil.ReadJsonKey(dictItem, "time"); 382 | // int poolCnt = (int)AssetBundleUtil.ReadJsonKey(dictItem, "poolcnt"); 383 | // XResource.RegCacheResPath(assetPath, cacheTime, poolCnt); 384 | 385 | // BLogger.Info("[{0}]cache resource[{1}] cache time: {2} pool max count:{3}", i, assetPath, cacheTime, poolCnt); 386 | // } 387 | 388 | // return true; 389 | // } 390 | // catch (Exception e) 391 | // { 392 | // BLogger.Error("LoadCacheAndTimeConfig failed: " + e.ToString()); 393 | // return false; 394 | // } 395 | // } 396 | // #endregion 397 | // } 398 | //} 399 | -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/IgnorAsset.txt: -------------------------------------------------------------------------------- 1 | Assets/Resources/Config/AbEditorConfig -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/NeverExpireDir.txt: -------------------------------------------------------------------------------- 1 | Assets/Resources/Scenes -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/PackToDirRule.txt: -------------------------------------------------------------------------------- 1 | [ 2 | {"asset":"Assets/Resources/Luac","priority":0,"deep":0}, 3 | {"asset":"Assets/Resources/SkillDisp","priority":2,"deep":0}, 4 | {"asset":"Assets/Resources/Media/UI","priority":2,"deep":-1}, 5 | {"asset":"Assets/Textures/Background","priority":3,"deep":1}, 6 | {"asset":"Assets/Textures/Plot","priority":3,"deep":1}, 7 | {"asset":"Assets/Textures/Mask","priority":4,"deep":1}, 8 | {"asset":"Assets/Resources/Effect","priority":5,"deep":-1}, 9 | {"asset":"Assets/Prefabs/Plants","priority":4,"deep":-1}, 10 | ] -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/ResourceDir.txt: -------------------------------------------------------------------------------- 1 | Effect/Tips -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/SharedDependAsset.txt: -------------------------------------------------------------------------------- 1 | Assets/Resources/UIRaw 2 | Assets/Prefabs/Scene 3 | Assets/Prefabs/Plants 4 | Assets/Resources/Actor 5 | Assets/Resources/Effect -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/need_cache_list.txt: -------------------------------------------------------------------------------- 1 | [ 2 | {"asset":"Effect/common","time":120, "poolcnt":30}, 3 | {"asset":"Effect/hero","time":120, "poolcnt":30}, 4 | {"asset":"Effect/guai","time":120, "poolcnt":30}, 5 | {"asset":"Media/UI", "time":0}, 6 | {"asset":"Media/Skill", "time":300}, 7 | {"asset":"Media/Voice", "time":300}, 8 | {"asset":"Actor/", "time":180, "poolcnt":30}, 9 | {"asset":"Animator/", "time":0}, 10 | {"asset":"UI/", "time":120} 11 | ] -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/need_persist_assetbundle.txt: -------------------------------------------------------------------------------- 1 | fonts 2 | xgame_shader -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/need_persist_list.txt: -------------------------------------------------------------------------------- 1 | Effect/Tips 2 | Effect/Shadow 3 | Media/AudioPlayer 4 | Texture/Decals 5 | UI/ModalSprite 6 | UI/TalkUI 7 | Actor/Bianshen/bianshen -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/Media/资源规则/文件说明.txt: -------------------------------------------------------------------------------- 1 | NeverExpireDir 2 | 定义了不切换场景,则不会被卸载的assetbundle资源 3 | 4 | PackToDirRule 5 | 需要按照目录规则打包成的列表 6 | 7 | 8 | PackToDirNumExt 9 | 类似PackToDirRule,单规则按照文件名最后数字前的内容来分类,比如 10 | M_guigongzi1.prefab 11 | M_guigongzi2.prefab 12 | 这会被打到一个分类里 13 | 14 | ResourceDir 15 | 需要打包成一个目录,同时要记录下这个目录里所有的文件列表,用于loaddir接口的调用 16 | 17 | SharedDependAsset 18 | 指定哪些目录的资源,所依赖的其他资源,都要显式打包,避免重复 19 | 20 | IgnorAsset.txt 21 | 需要忽略的资源路径,则不会被打包到Assetbundle里 22 | 23 | 24 | -------------------------------------------------------------------------------- /Content/源码阅读/大梦龙图/大梦龙图SLG源码阅读记录.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 网络部分: 4 | 网关层, 对服务器列表(网关的选择,心跳,网络总控的整合) 5 | 6 | Native 提供的是对网络底层的抽象封装。收,发,网络状态信息。 7 | Base 进行项目业务逻辑的封装。 心跳,消息统计,重连,等 8 | Logic,使用Base进行调用 9 | 10 | 注重对各个逻辑块的分离隔离 11 | 12 | 这部分的SLG对于实体部分的架构使用的基于组件的设计模式。 实体间的调用和组件的间的调用,通过内部封装事件分发系统进行解耦,是目前为止见到过的写的最清晰,功能划分最好的组件模式设计了。 发现这个是传统游戏面向对象设计最常用的一个设计模式。 原神的bundle系统,死神的战斗表现层等。 13 | 14 | 整体结构分: 15 | GameBase(不可热更) :封装Unity层面的接口,AssetBundle , UITween ,Physics,Voice,一些重量级的逻辑表现封装(重量级的比如人物渲染逻辑,UI一些复炸算法组件 循环滚动等等,需要封装好,供热更层调用) 等等, 这部分侧重的是引擎层面的功能组件的封装 。 16 | GameLogic(可热更) :游戏的整体热更逻辑,包括游戏驱动,UI逻辑等等一切可以放入热更的。需要划分好逻辑部分,将高耗能功能拆分出去 17 | GameNative(不可热更) :这部分是游戏不怎么依赖引擎功能的部分的功能。 包括比如配置文件系统 , 公共网络部分 ,游戏启动的代码等,热更的配置等等。 18 | GameProto(可热更) : 纯粹的热更协议部分。 19 | 20 | 划分的好处。使项目整体代码结构清晰规整。有利于减缓项目腐化。千万不要说放一起又怎么滴怎么滴的话。没有经历过一个月一个版本的开发迭代的,不知道要维护好项目代码是多难。代码越腐化,开发维护的时间越多。无形的成本是对自身的压榨。能帮自己减轻负担就减轻点吧。 21 | 22 | ![](Media/Game_1.jpg) 23 | ![](Media/Game_2.jpg) 24 | ![](Media/Game_3.jpg) 25 | ![](Media/Game_4.jpg) 26 | ![](Media/Game_5.jpg) 27 | ![](Media/Game_6.jpg) 28 | ![](Media/Game_7.jpg) 29 | ![](Media/Game_8.jpg) 30 | ![](Media/Game_9.jpg) 31 | ![](Media/Game_10.jpg) 32 | ![](Media/Game_11.jpg) 33 | ![](Media/GameBase.jpg) 34 | ![](Media/GameNative.jpg) -------------------------------------------------------------------------------- /Content/源码阅读/崩坏3源码阅读记录.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/崩坏3源码阅读记录.md -------------------------------------------------------------------------------- /Content/源码阅读/死神阅读记录.md: -------------------------------------------------------------------------------- 1 | 2 | ## 死神ILRuntime 3 | * [整体结构](#00) 4 | * [UI使用ILR](#01) 5 | * [网络使用ILR](#012) 6 | 7 |

整体结构

8 | 9 | 整体结构分为几个命名空间: 10 | 11 | 1. Battle: 12 | 战斗的逻辑部分完全放在ILRuntime,战斗相关的协议和配置也放在热更域. 13 | 14 | 2. EngineScript: 对引擎功能的一些简单封装。 比如控制Render的Alpha控制脚本 。 相机控制。网络接受相关. 对Unity一些Render 例如 LineRender 的封装。 也是体现了基本的设计封装的思想。 15 | 16 | 3. GoEngine.Core: 这部分看了下 , 一个是对Bundle 和资源管理下载系统的底层封装,属于Unity 域的功能,给热更层提供接口。 17 | 对UI常用组件功能的封装比较多。 封装成多个的便捷的使用对象,热跟域进行调用。 18 | 19 | 4. GOEngine.Scene: 包含AStar寻路,战斗表现层,网络相关的重量级的模块,放在Unity域里面的 20 | 21 | 5. 到IL里面的适配器: UILogicBaseAdapter, GOEModuleAdapter 22 | 23 | 24 | 整体启动流程和结构: 25 | 26 | 整个游戏的入口在Main.cs 直接包含了游戏开始的逻辑包括资源更新,热跟初始化。 27 | 启动游戏 -> 初始化SDK -> 检测更新 -> 启动游戏Engine -> 准备好后加载 ILR 脚本 ,初始化ILRuntime的绑定 28 | 29 | //加载脚本进去 30 | appdomain = new ILRuntime.Runtime.Enviorment.AppDomain(); 31 | StartCoroutine(InitScriptEngine("BleachBattleService", delegate 32 | { 33 | StartCoroutine(InitScriptEngine("Bleach", delegate 34 | { 35 | InitILRuntime(appdomain); //初始化ILRuntime的适配只设置 36 | UILogicFact.InitializeILRuntime(); //初始化UI逻辑脚本 37 | EngineReadyCorroutine(); //初始化游戏场景逻辑 38 | })); 39 | })); 40 | 41 | 创建modules 游戏管理器 42 | private void EngineReadyCorroutine() 43 | { 44 | IGOEGameScene scene = GOERoot.Scene; 45 | scene.OnEnterScene = (Action)Delegate.Combine(scene.OnEnterScene, new Action(SceneUtil.OnLevelWasLoaded)); 46 | InitGameMod(); 47 | GOERootCore.GOEAudioMgr.PlayAudio(); 48 | if (GameConfig.isFirstRun) 49 | { 50 | SendCustomEventLogStart("firstUpdate", "初次资源更新", "end"); 51 | } 52 | } 53 | 54 | 55 | 启动脚本逻辑 开始运行游戏 56 | 57 | private void InitGameMod() 58 | { 59 | createModules(); 60 | PlayerPrefs.SetString("123", "123"); 61 | PlayerPrefs.SetFloat("1234", 1f); 62 | PlayerPrefs.GetString("123"); 63 | PlayerPrefs.GetFloat("1234"); 64 | appdomain.Invoke("GOEGame.BleachGame", "Init", null, null); 65 | _modMgr.Start(); 66 | appdomain.Invoke("GOEGame.BleachGame", "StartGame", null, null); 67 | EngineReady = true; 68 | } 69 | 70 |

UI使用ILRuntme

71 | 72 | UI工作流程的封装: 73 | 74 | UI脚本逻辑的基类是UILogicBase. UI框架中Frame中持有一个UILogicBase 实例。 热更域继承这个。 75 | FrameMgr 是UI管理器。Frame 是窗口的Unity显示的载体,非热跟部分。 逻辑部分有UILogicBase 处理。 76 | FrameMgr中持有 当前的逻辑UILogicBase, 进行Update ,LateUpdate等。 77 | Frame 作为一个窗口。封装和持有自身资源的加载,逻辑脚本。 管理器创建一个Frame , 实体加载完成后,就可以初始化脚本逻辑了。 78 | 79 | 其中脚本的实例在框架启动的过程中将 热跟的脚本和非热跟的脚本实现创建好了,UILogicFact. 80 | 通过标签对逻辑脚本进行标注。 UI逻辑脚本还是其他脚本。 81 | 就UI来说,逻辑脚本就是逻辑脚本,有一些UI表现的,例如Sprite,ScrollRect等组件都需要封装好放到Unity层。 82 | 83 | 84 | 85 | 工程对引擎功能的隔离: 86 | 87 | 另外, 工程分了模块划分, 【Unity引擎模块】: 将资源加载,音效等功能抽离接口, 逻辑层注册引擎层实现的接口。 逻辑和引擎脱离。 88 | IGOEAudioMgr 89 | IProjectResource 90 | 通过吧引擎脱离,能达到的效果是,换个引擎不影响逻辑,吧引用到引擎的部分的接口重新实现一遍就好。 91 | 92 | 93 |

网络使用ILR

94 | 网络层的封装和脚本隔离: 95 | 网络部分的网络接收,发送放在Unity层.NetMod 。 96 | 网络协议需要热更,放到热更脚本中。 97 | 网络中关于一些逻辑响应,比如登陆失败,成功,网络链接等由热更域注册到主工程Net。 98 | 网络消息事件由热更工程调用主工程 接口注册注销。 MsgHandler 99 | 100 | 101 | 处理IL消息: 102 | 103 | MsgHandler 104 | { 105 | private static Dictionary> _dict = new Dictionary>(); 106 | 107 | private static Dictionary> ilDict = new Dictionary>(); 108 | 109 | private static IMethod parseM; 110 | 111 | private static object[] paramA = new object[2]; 112 | public static void RegIL(int msgid, Action func) 113 | public static void UnRegIL(int msgid, Action func) 114 | internal static object ParseILMesage(int msgid, byte[] buffer, int offset, int len) 115 | { 116 | if (ilDict.ContainsKey(msgid)) 117 | { 118 | ILRuntime.Runtime.Enviorment.AppDomain appDomain = Main.Inst.AppDomain; 119 | if (parseM == null) 120 | { 121 | IType type = appDomain.LoadedTypes["GOEGame.Message.MsgParser"]; 122 | parseM = type.GetMethod("Parse", 2); 123 | } 124 | paramA[0] = msgid; 125 | paramA[1] = CodedInputStream.CreateInstance(buffer, offset, len); 126 | return appDomain.Invoke(parseM, null, paramA); 127 | } 128 | return null; 129 | } 130 | 131 | public static void CallIL(int msgid, object msg) 132 | { 133 | if (Main.ShowMsgLogInTestTool) 134 | { 135 | Debug.Log((object)("---->msgid, " + msgid)); 136 | } 137 | Action value = null; 138 | if (ilDict.TryGetValue(msgid, out value)) 139 | { 140 | value?.Invoke(msg); 141 | } 142 | } 143 | } 144 | 145 | 粘包: TcpClient.ReceivePlayLoad(byte[] data, int length) - MsgHandler.ParseILMesage(msgid, array, 0, num2); 146 | 147 | internal static object ParseILMesage(int msgid, byte[] buffer, int offset, int len) 148 | { 149 | if (ilDict.ContainsKey(msgid)) 150 | { 151 | AppDomain appDomain = Main.Inst.AppDomain; 152 | if (parseM == null) 153 | { 154 | //调用热更域的协议对象映射 解析方法。 155 | IType type = appDomain.LoadedTypes["GOEGame.Message.MsgParser"]; 156 | parseM = type.GetMethod("Parse", 2); 157 | } 158 | paramA[0] = msgid; 159 | paramA[1] = CodedInputStream.CreateInstance(buffer, offset, len); 160 | return appDomain.Invoke(parseM, null, paramA); 161 | } 162 | return null; 163 | } 164 | 165 | //热更域 166 | public static class MsgParser 167 | { 168 | public static MessageBase Parse(int msgid, ICodedInputStream ci) 169 | { 170 | MessageBase messageBase; 171 | switch (msgid) 172 | { 173 | case 1304: 174 | messageBase = new SCFightHpChg(); 175 | break; 176 | default: 177 | return null; 178 | } 179 | messageBase.MergeFrom(ci);//解析过程还是在Native中调用 加快性能 180 | return messageBase; 181 | } 182 | } 183 | 184 | 回调:TcpClient.dealILMessage -MsgHandler.CallIL(t.Key, t.Value); 传入object参数,进行跨域的协议调用(native 调用热更层回调)。 185 | 186 | 发消息 直接调用Native 发送bytes 187 | -------------------------------------------------------------------------------- /Content/源码阅读/还原神作解密.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/源码阅读/还原神作解密.rar -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/GG/gg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/GG/gg_1.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/GG/gg_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/GG/gg_2.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/GG/gg_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/GG/gg_3.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/GG/gg_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/GG/gg_4.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/GG/gg_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/GG/gg_5.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/a.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/adb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/adb.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/error.png -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/frida-轮回决-hook.js: -------------------------------------------------------------------------------- 1 | // frida -U -f com.pwrd.lhj.aligames --no-pause -l C:\Users\pc\Desktop\unity_bootstrap.js 2 | // 运行环境是mumu模拟器 3 | 4 | 5 | Java.perform(function () { 6 | 7 | 8 | function get_func_by_offset(module_name,offset){ 9 | var module=Process.getModuleByName(module_name) 10 | var addr=module.base.add(offset); 11 | return new NativePointer(addr.toString()); 12 | } 13 | var is_matched = false; 14 | var so_path = null; 15 | // dllopen 0x2101 16 | 17 | var func = get_func_by_offset('linker',0x2101 ) //针对网易mumu模拟器,非mumu模拟器需要修改offset的值 18 | 19 | //console.log('[+] dlopen '+ func.toString()) 20 | Interceptor.attach(func, { 21 | onEnter: function (args) { 22 | so_path = Memory.readCString(args[0]) 23 | //console.log('[*] ' + so_path); 24 | }, 25 | onLeave: function (retval) { 26 | if(so_path == null || so_path.indexOf('libil2cpp.so') == -1 || is_matched == true){ 27 | return; 28 | } 29 | is_matched = true 30 | console.log('[*] '+so_path) 31 | hookSet() 32 | return; 33 | } 34 | }); 35 | 36 | function hookSet(){ 37 | console.log("********hookSet start*******") 38 | var get_nUnitType = get_func_by_offset("libil2cpp.so",0x3CF93C8); //[Address(RVA="0x3CF93C8", Offset="0x3CF93C8")]public EUnitType get_nUnitType() 39 | var get_PhysicsAttack = get_func_by_offset("libil2cpp.so",0x3CF9A8F); //[Address(RVA="0x3CF9A8F", Offset="0x3CF9A8F")]public int get_PhysicsAttack() 40 | var get_MagicalAttack = get_func_by_offset("libil2cpp.so",0x3CF9ABA); //[Address(RVA="0x3CF9ABA", Offset="0x3CF9ABA")]public int get_MagicalAttack() 41 | var get_MagicalDefence = get_func_by_offset("libil2cpp.so",0x3CF9B10); //[Address(RVA="0x3CF9B10", Offset="0x3CF9B10")]public int get_MagicalDefence() 42 | var get_PhysicsDefence = get_func_by_offset("libil2cpp.so",0x3CF9AE5); //[Address(RVA="0x3CF9AE5", Offset="0x3CF9AE5")] public int get_PhysicsDefence() 43 | var get_WalkSpeed = get_func_by_offset("libil2cpp.so",0x3CF96EC);//[Address(RVA="0x3CF96EC", Offset="0x3CF96EC")] public float get_WalkSpeed() 44 | hookmethod(get_nUnitType,"get_nUnitType"); 45 | hookmethod1(get_PhysicsAttack,"get_PhysicsAttack"); 46 | hookmethod1(get_MagicalAttack,"get_MagicalAttack"); 47 | hookmethod1(get_MagicalDefence,"get_MagicalDefence"); 48 | hookmethod1(get_PhysicsDefence,"get_PhysicsDefence"); 49 | hookmethod1(get_WalkSpeed,"get_WalkSpeed"); 50 | } 51 | var nUnitType; 52 | function hookmethod(addr,str) { 53 | console.log("hook the " + str + " "+"the addr is" + addr.toString()) 54 | Interceptor.attach(addr, { 55 | onEnter: function (args) { 56 | }, 57 | onLeave: function(retval){ 58 | nUnitType = retval.toInt32(); //读取nUnitType的值 59 | } 60 | }); 61 | } 62 | function hookmethod1(addr,str) { 63 | Interceptor.attach(addr, { 64 | onEnter: function (args) { 65 | }, 66 | onLeave: function(retval){ 67 | var value = retval.toInt32(); //读取返回值 68 | if (nUnitType == 1){ //如果nUnitType的值是1,即玩家,进入修改方法 69 | if (str.indexOf("get_WalkSpeed")!==-1){ //移动速度,似乎没效果,或者float数值写入错误 70 | retval.replace(value * 3); 71 | }else { 72 | retval.replace(value * 100000); //修改返回值* 100000 73 | } 74 | console.log("[+] " + str + " " + value.toString() + "->" + retval.toInt32().toString()) //打印结果 75 | } 76 | } 77 | 78 | }); 79 | } 80 | 81 | 82 | 83 | 84 | }); 85 | 86 | -------------------------------------------------------------------------------- /Content/脱壳逆向/Media/元气骑士il2cpp-hook-源码.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/Media/元气骑士il2cpp-hook-源码.zip -------------------------------------------------------------------------------- /Content/脱壳逆向/README.md: -------------------------------------------------------------------------------- 1 | 今天想分析下大梦龙图他们的游戏框架。 发现是mono发布的Unity游戏。 dll加壳了。然后网上找了一些脱壳教程。实现过程记录下 2 | 3 | 一下记录用ida链接模拟器。 4 | 5 | * 使用的是网易mumu模拟器,装了北凉悍刀行,然后通过adb 启动apk,等待 ida 附加debug进程。 6 | 7 | ![](Media/adb.png) 8 | 9 | 要注意的是,要先把mumu模拟器添加到设备列表,然后转发端口什么,具体理论以后再补上, 10 | 然后 解包apk ,找到包名和入口。 用的Android Killer v1.3.1.0 解的包。 顺利启动 11 | ![](Media/a.png) 12 | 13 | ida 选择AndroidDebuger 然后附加到进程,包错了网上说关了防火墙 关了,SELinux 还是没好,先这样吧。 14 | ![](Media/error.png) -------------------------------------------------------------------------------- /Content/脱壳逆向/ShellCode.md: -------------------------------------------------------------------------------- 1 | 一些命令行命令: 2 | http://www.cn-dos.net/newdos/dosuse.htm 3 | https://blog.csdn.net/ternence_hsu/article/details/70739002 4 | https://www.jianshu.com/p/024de46ef9c4 5 | https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/del 6 | 7 | rd 删除文件 ,同 rmdir,源自ReMakeDirectory。 rd /s 删除子文件夹 , rd /q /s ,/q取自quiet 安静模式,/s删除目录树时不要求确认。 8 | [for /f delims 和 token](https://blog.csdn.net/hutuchongaini/article/details/35290989) 9 | -------------------------------------------------------------------------------- /Content/脱壳逆向/原神.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神.rar -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/0.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/1.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/2.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/3.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/4.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/5.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/6.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/7.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/8.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/Media/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/脱壳逆向/原神/Media/9.png -------------------------------------------------------------------------------- /Content/脱壳逆向/原神/原神.md: -------------------------------------------------------------------------------- 1 | 2 | 1下载原神PC包,用il2cpp导出发现metadata 加密。 对比metadata 3 | 4 | ![](Media/0.png) 5 | ![](Media/1.png) ![](Media/2.png) 6 | 7 | 2.将dll放入ida,看il2cpp 的代码unity安装包(Editor\data\il2cpp\libil2cpp\vm),找到加载metadata相关代码,在ida中搜索global-metadata.dat查找代码位置。 8 | 9 | ![](Media/3.png) 10 | 11 | 3、找到加载matedata加载代码 F5反编译 对比源代码分析 12 | 13 | ![](Media/4.png) 14 | 15 | 4、通过与源代码对比发现原函数没有变化,加密函数应该在 MetaDataLoader::LoadMetadataFile() 里面,直接进入函数查看代码,发现这部分代码和源代码不一致。 对比发现加载完文件后没有直接返回,有后续操作,判断了加密的文件头是否需要解密,然后调用了两个函数一个计算解密长度,一个是根据加密文件长度解析出metadata,然后返回解密后的地址 16 | 17 | ![](Media/5.png)![](Media/6.png) 18 | 19 | 5、进入找到对应长度 和解密后的地址的汇编指令的地方进行断电,可以找到文件的长度1154020h 和 64EA050 20 | 21 | 22 | ![](Media/7.png) 23 | 6、有了地址和长度 不用管加密算法直接导出 24 | 25 | ![](Media/8.png) 26 | 27 | 7、然后IL2CppDumper 用dll 和解密后正确的meta问价导出dll 28 | 29 | ![](Media/9.png) 30 | -------------------------------------------------------------------------------- /Content/脱壳逆向/逆向一些事.md: -------------------------------------------------------------------------------- 1 | * [1、使用GameGuardian导出mono类游戏dll](#001) 2 | * [2、逆向的一些基础知识](#002) 3 | * [3、资源的逆向](#003) 4 | 5 |













[返回目录](#001) 6 |

1、使用GameGuardian导出mono类游戏dll

7 | 8 | 一下记录雷电模拟器上使用GameGuardian提取dll的方法这种只适用于Unitydll加载的方式咯。 9 | 10 | * 使用的是网易mumu模拟器,装了北凉悍刀行,然后通过adb 启动apk,等待 ida 附加debug进程。 11 | 12 | 手机上安装好GG,运行游戏然后打开GG,通过内存搜索的方式搜索9460301(0x4D5A9000) ,这也是PE文件Dos头的特征码。 13 | ![](Media/GG/gg_1.png) 14 | ![](Media/GG/gg_2.png) 15 | 16 | 搜索到的结果如下,记录下地址的开头和结尾。 后面dump需要这个地址,开始地址和结束地址要揽括记录的范围。 17 | ![](Media/GG/gg_3.png) 18 | 19 | 打开dump工具,进行dump 20 | ![](Media/GG/gg_4.png) 21 | ![](Media/GG/gg_5.png) 22 | 23 | 将文件导出来后用get_dll_from_dumped_bin.exe解析dll. 24 | 25 | 26 |













[返回目录](#002) 27 |

2、逆向的一些基础知识

28 | 29 | [IL2CPP的游戏修改](https://www.52pojie.cn/thread-982655-1-1.html) 30 | 31 | hook常用的一些框架工具:frida , substrate ,gameguardian , andlua . 32 | [Unity-Substrate-Hook](https://github.com/jbro129/Unity-Substrate-Hook-Android) 33 | 34 | 静态修改,动态修改 35 | 36 | 逆向注入主要手段: 37 | 框架类注入so 38 | xposed换so 39 | gg类内存修改 40 | 游戏蜂窝类自动点击 41 | apk残端破解 42 | 43 | 44 |

2、资源

45 | 46 | [Blender中国社区](https://www.blendercn.org/) 47 | [sketchfab模型网站](https://sketchfab.com/3d-models/gono-x-a7908e8496e44e3ea584a485a75ebfdf) 48 | [sketchfab加密提取](https://imjad.cn/archives/lab/ripping-sketchfab-models/) 49 | [遨游浏览器,资源嗅探器] 50 | 51 | 【Mesh Optimizer 】 Unity 减面插件,导出Blender修改。 52 | 【FBX export】 53 | 【Lost Crypt】 54 | 55 | -------------------------------------------------------------------------------- /Content/计算科学速成/10. 早期的编程方式-Early Programming.ass.txt: -------------------------------------------------------------------------------- 1 | Hi, I'm Carrie Anne and welcome to Crash Course Computer Science. 2 | (。・∀・)ノ゙嗨,我是 Carrie Anne,欢迎收看计算机科学速成课! 3 | 4 | Over the last few episodes, 5 | 前几集我们把重点放在计算机的原理 6 | 7 | We've talked a lot about the mechanics of how computers work. 8 | 前几集我们把重点放在计算机的原理 9 | 10 | How they use complex circuits to save and retrieve values from memory, 11 | 怎么从内存读写数据,执行操作 12 | 13 | and perform operations on those values 14 | 怎么从内存读写数据,执行操作 15 | 16 | like adding two numbers together. 17 | 比如把两个数字加在一起 18 | 19 | We've even briefly talked about sequences of operations, 20 | 还简单讲了下指令的执行,也就是计算机程序 21 | 22 | which is a computer program 23 | 还简单讲了下指令的执行,也就是计算机程序 24 | 25 | What we haven't talked about is how a program gets into a computer? 26 | 但我们还没讲的是:程序如何"进入"计算机 27 | 28 | You might remember in episode 7 and 8 , 29 | 你应该记得在第 7, 8 集,我们一步步讲了例子程序 30 | 31 | we step through some simple example programs for the CPU that we had created 32 | 你应该记得在第 7, 8 集,我们一步步讲了例子程序 33 | 34 | For simplicity, we just waved our hands and said that the program was already magically in memory 35 | 当时为了简单,我们假设程序已经魔法般在内存里了 36 | 37 | But in reality, programs have to be loaded into a computer's memory. 38 | 但事实是,程序需要加载进内存 39 | 40 | It's not magic. It's computer science 41 | 这不是魔法,是计算机科学! 42 | 43 | The need to program machines existed way before the development of computers. 44 | 给机器编程这个需求,早在计算机出现之前就有了 45 | 46 | The most famous example of this was in textile manufacturing 47 | 最著名的例子来自纺织业 48 | 49 | If you just wanted to weave a big red tablecloth 50 | 如果你只想织一块红色大桌布 51 | 52 | You could simply feed red thread into a loom and let it run 53 | 可以直接放红线进织布机 54 | 55 | What about if you wanted the cloth to have a pattern like stripes or plaid? 56 | 但如果想要图案怎么办? 比如条纹或者方格 57 | 58 | Workers would have to periodically reconfigure the loom as dictated by the pattern, 59 | 工人要每隔一会儿 调整一次织布机 60 | 61 | but this was labor intensive which made patterned fabrics expensive. 62 | 因为非常消耗劳动力,所以图案纺织品很贵 63 | 64 | The presence or absence of a hole in the card determined if a specific thread was held high or low in the loom 65 | 特定位置有没有穿孔,决定了线是高是低 66 | 67 | Such as the cross thread, called the weft, passed above or below the thread 68 | 横线是从上/从下穿过 69 | 70 | To vary the pattern across rows these punch cards were arranged in long chains 71 | 为了让每行图案不同,纸卡连成长条 72 | 73 | Forming a sequence of commands for the loom. 74 | 形成连续指令 75 | 76 | Sound familiar? 77 | 听起来很熟? 78 | 79 | Many consider Jacquard loom to be one of the earliest forms of programming. 80 | 很多人认为雅卡尔织布机是最早的编程 81 | 82 | Punched cards, turned out to be a cheap, reliable, fairly human-readable way to store data. 83 | 事实证明 穿孔纸卡便宜、可靠、也易懂 84 | 85 | Nearly a century later, 86 | 近一个世纪后 87 | 88 | punch cards were used to help tabulate the 1890 US census 89 | 穿孔纸卡用于 1890 年美国人口普查 90 | 91 | which we talked about in episode 1 92 | 我们在第一集提过 93 | 94 | Each card held an individual person's data. 95 | 一张卡存一个人的信息 96 | 97 | things like race 98 | 比如种族 99 | 100 | marital status 101 | 婚姻状况 102 | 103 | number of children 104 | 子女数量 105 | 106 | country of birth and so on 107 | 出生国家 等等 108 | 109 | for each demographic question 110 | 针对每个问题,人口普查工作者会在对应位置打孔 111 | 112 | a census worker would punch out a hole of the appropriate position 113 | 针对每个问题,人口普查工作者会在对应位置打孔 114 | 115 | when a card was fed into the tabulating machine 116 | 当卡片插入汇总机 117 | 118 | a hole would cause the running total for that specific answer to be increased by one 119 | 孔会让对应总和值+1 120 | 121 | in this way you could afeed the entire counties worth of people 122 | 可以插入整个国家人口的卡片 123 | 124 | and at the end you'd have running totals for all of the questions that you ask 125 | 在结束后得到各个总值 126 | 127 | It is important to note here that early tabulating machines were not truly computers 128 | 值得注意的是,早期汇总机不算计算机 129 | 130 | as they can only do one thing-tabulate 131 | 因为它们只做一件事 - 汇总数据 132 | 133 | their operation was fixed and not programmable 134 | 操作是固定的,不能编程 135 | 136 | punched cards stored data, but not a program 137 | 穿孔纸卡存的是数据,不是程序. 138 | 139 | over the next 60 years, these business machines grew in capability 140 | 之后60年,这些机器被加强,可以做减、乘、除 141 | 142 | Adding features to subtract multiply divide 143 | 之后60年,这些机器被加强,可以做减、乘、除 144 | 145 | and even make simple decisions about when to perform certain operations. 146 | 甚至可以做一些小决定,决定何时执行某指令 147 | 148 | To trigger these functions appropriately 149 | 为了正确执行不同计算,程序员需要某种控制面板 150 | 151 | so that different calculations could be performed, a programmer accessed a control panel 152 | 为了正确执行不同计算,程序员需要某种控制面板 153 | 154 | this panel was full of little sockets into which a programmer would plug cables 155 | 面板有很多小插孔,程序员可以插电线 156 | 157 | to pass values and signals between different parts of the machine 158 | 让机器的不同部分 互相传数据和信号 159 | 160 | for this reason they were also called plug boards 161 | 因此也叫 "插线板" 162 | 163 | Unfortunately this meant having to rewire the machine each time a different program needed to be run 164 | 不幸的是, 这意味着 运行不同程序要重新接线 165 | 166 | And so by the 1920s these plug boards were made swappable 167 | 所以到 1920 年代,控制面板变成了可拔插 168 | 169 | This not only made programming a lot more comfortable 170 | 让编程更方便 171 | 172 | but also allowed for different programs be plugged into a machine 173 | 可以给机器插入不同程序 174 | 175 | For example one board might be wired to calculate sales tax 176 | 比如,一个插线板算销售税,另一个算工资单 177 | 178 | While another helps with payroll 179 | 比如,一个插线板算销售税,另一个算工资单 180 | 181 | But plug boards were fiendishly complicated to program 182 | 但给插线板编程很复杂 183 | 184 | This tangle of wires is a program for calculating a profit loss summary using an IBM 402 accounting machine 185 | 图中乱成一团的线 负责算盈亏总额 \N 用于 IBM 402 核算机 186 | 187 | which were popular in the 1940s 188 | 在 1940 年代这样做很流行 189 | 190 | And this style of plug board programming wasn't unique through electromechanical computers 191 | 用插线板编程 不只在机电计算机流行 192 | 193 | The world's first general-purpose electronic computer, the ENIAC, completed in 1946 194 | 世上第一台通用电子计算机,ENIAC,完成于 1946 年 195 | 196 | used a ton of them 197 | 用了一大堆插线板 198 | 199 | Even after a program had been completely figured out on paper 200 | 程序在纸上设计好之后 201 | 202 | Physically wiring up the ENIAC and getting the program to run could take upwards of three weeks 203 | 给 ENIAC 连线,最多可能花三个星期 204 | 205 | Given the enormous cost of these early computers, weeks of downtime simply to switch programs was unacceptable 206 | 因为早期计算机非常昂贵 \N 停机几个星期只为换程序 完全无法接受 207 | 208 | and the new faster more flexible way to program machines was badly needed 209 | 人们急需更快、更灵活的新方式来编程 210 | 211 | Fortunately by the late 1940s and into the 50s 212 | 幸运的是,到 1940 年代晚期 1950 年代初 213 | 214 | electronic memory was becoming feasible 215 | 内存变得可行 216 | 217 | As costs fell, memory size grew, instead of storing a program as a physical plug board of wires 218 | 价格下降, 容量上升. 与其把程序存在插线板 219 | 220 | it became possible to store a program entirely in a computer's memory 221 | 存在内存变得可行 222 | 223 | where it could be easily changed by programmers and quickly accessed by the CPU 224 | 这样程序易于修改、方便 CPU 快速读取 225 | 226 | these machines were called Stored-program Computers 227 | 这类机器叫 "存储程序计算机" 228 | 229 | With enough computer memory you could store not only the program you wanted to run 230 | 如果内存足够,不仅可以存要运行的程序 231 | 232 | but also any data your program would need 233 | 还可以存程序需要的数据 234 | 235 | including new values it created along the way 236 | 包括程序运行时产生的新数据 237 | 238 | Unifying the program and data into a single shared memory is called the Von Neumann Architecture 239 | 程序和数据都存在一个地方,叫 "冯诺依曼结构" 240 | 241 | named after John Von Neumann 242 | 命名自 约翰·冯·诺依曼 243 | 244 | a prominent mathematician and physicist who worked on the Manhattan project and several early electronic computers 245 | 杰出的数学家和物理学家 \N 参与了曼哈顿计划和早期电子计算机项目 246 | 247 | and once said I am thinking about something much more important than Bombs 248 | 他曾说:我在思考比炸弹重要得多的东西 249 | 250 | I'm thinking about computers 251 | 计算机 252 | 253 | The hallmarks of a Von Neumann computer are a processing unit containing an arithmetic logic unit 254 | 冯诺依曼计算机的标志是,一个处理器(有算术逻辑单元)+ 255 | 256 | data registers and instruction register and instruction address register 257 | 数据寄存器+指令寄存器+指令地址寄存器 258 | 259 | And finally a memory to store both data and instructions 260 | +内存(负责存数据和指令) 261 | 262 | Hopefully this sounds familiar 263 | 希望这听起来很耳熟 264 | 265 | Because we actually built a Von Neumann computer in episode 7 266 | 因为第7集我们造了一个冯诺依曼计算机 267 | 268 | The very first Von Neumann Architecture Stored-program computer 269 | 第一台冯诺依曼架构的"储存程序计算机" 270 | 271 | was constructed in 1948 by the University of Manchester, nicknamed Baby. 272 | 由曼彻斯特大学于 1948 年建造完成,绰号"宝宝" 273 | 274 | and even the computer you are watching this video right now 275 | 甚至你现在看视频的计算机,也在用一样的架构 276 | 277 | uses the same architecture 278 | 甚至你现在看视频的计算机,也在用一样的架构 279 | 280 | Now electronic computer memory is great and all 281 | 虽然有内存很棒 282 | 283 | but you still have to load the program and data into the computer before it can run 284 | 但程序和数据 依然需要某种方式输入计算机 285 | 286 | and for this reason punch cards were used 287 | 所以用穿孔纸卡 288 | 289 | Let's get to the Thought bubbles 290 | 让我们进入 思维泡泡 291 | 292 | Well into the 1980s almost all computers have a punch card reader 293 | 到1980年代,几乎所有的计算机都有穿孔纸卡读取器 294 | 295 | which could suck in a single punch card at a time 296 | 可以吸入一张卡片,把卡片内容写进内存 297 | 298 | and write the contents of the card into the computer's memory 299 | 可以吸入一张卡片,把卡片内容写进内存 300 | 301 | If you load it in a stack of punch cards, 302 | 如果放了一叠卡片,读取器会一个个写进内存 303 | 304 | the reader would load them all into memory sequentially as a big block 305 | 如果放了一叠卡片,读取器会一个个写进内存 306 | 307 | once the program and data were in memory, the computer would be told to execute it 308 | 一旦程序和数据写入完毕,电脑会开始执行 309 | 310 | Of course even simple computer programs might have hundreds of instructions 311 | 即便简单程序也有几百条指令,要用一叠纸卡来存 312 | 313 | which meant that programs were stored as stacks of punch cards 314 | 即便简单程序也有几百条指令,要用一叠纸卡来存 315 | 316 | So if you ever have the misfortune of accidentally dropping your program on the floor 317 | 如果不小心摔倒弄撒了 318 | 319 | it could take you hours days or even weeks to put the code back in the right order 320 | 要花上几小时、几天、甚至几周来整理 321 | 322 | A common trick was to draw a diagonal line on the side of the card stack called striping, 323 | 有个小技巧是 在卡片侧面画对角线 324 | 325 | so you'd have at least some clue how to get it back into the right order 326 | 如果弄散了,整理起来会方便很多 327 | 328 | The largest program ever punched into punch cards was the US Air Force's SAGE air defense system, completed in 1955. 329 | 用纸卡的最大型程序 \N 是美国空军的 SAGE 防空系统,于 1955 年完成 330 | 331 | and its peak, the project is said to have employed 20% of the world's programmers 332 | 据称顶峰时期 雇佣了世上 20% 程序员 333 | 334 | Its main control program was stored on a whopping 62,500 punch cards 335 | 主控制程序用了 62500 张穿孔纸卡 336 | 337 | which is equivalent to roughly 5 megabytes of data 338 | 等同于大约 5MB 的数据 339 | 340 | Pretty underwhelming by today's standards 341 | 以如今的标准,不值一提 342 | 343 | And punch cards weren't only useful for getting data into computers 344 | 穿孔纸卡不仅可以往计算机放数据 345 | 346 | but also getting data out of them 347 | 还可以取出数据 348 | 349 | At the end of a program results could be written out of computer memory and onto punch cards by, well, punching cards 350 | 程序运行到最后,结果可以输到纸卡上,方式嘛,当然是打孔 351 | 352 | then this data could be analyzed by humans or loaded into a second program for additional computation 353 | 然后人可以分析结果,或者再次放进计算机,做进一步计算 354 | 355 | Thanks, thought-bubble 356 | 谢了 思维泡泡 357 | 358 | A close cousin to punch cards was punched paper tape 359 | 穿孔纸卡 的亲戚是纸带 360 | 361 | Which is basically the same idea, but continuous instead of being on individual cards 362 | 基本是一回事,只不过更连续,不是一张张卡. 363 | 364 | And of course we haven't talked about Hard Drives, CD-ROMs, DVDs, USB-Thumb drives and other similar goodies 365 | 当然我们还没提硬盘, 只读光盘, DVD, U盘等等 366 | 367 | We'll get to those more advanced types of data storage in a future episode 368 | 以后我们会讲这些更先进的存储方法 369 | 370 | Finally in addition to plug boards and punch paper 371 | 最后,除了插线板和穿孔纸卡 372 | 373 | there was another common way to program and control computers in pre-1980 374 | 在 1980 年代前,还有一种常见编程方式 375 | 376 | Panel programming 377 | 面板编程 378 | 379 | Rather than having to physically plug in cables to activate certain functions 380 | 与其插一堆线到插线板 381 | 382 | this could also be done with huge panels full of switches and buttons 383 | 可以用一大堆开关和按钮,做到一样的效果 384 | 385 | And there were indicator lights to display the status of various functions and values in memory 386 | 面板上有指示灯,代表各种函数的状态和内存中的值 387 | 388 | Computers of the 50s and 60s often featured huge control consoles that look like this 389 | 50和60年代的计算机,一般都有这样巨大的控制台 390 | 391 | Although it was rare to input a whole program using just switches,it was possible 392 | 很少有人只用开关来输入一整个程序,但技术上是可行的 393 | 394 | And early home computers made for the hobbyist market use switches extensively 395 | 早期针对计算机爱好者的家用计算机,大量使用了开关 396 | 397 | because most home users couldn't afford expensive peripherals like punch card readers 398 | 因为大多数家庭用户负担不起昂贵的外围设备 \N 比如穿孔纸卡读取器 399 | 400 | The first commercially successful home computer was the Altair 8800 401 | 第一款取得商业成功的家用计算机是 Altair 8800 402 | 403 | which sold in two versions: Pre-assembled and the Kit 404 | 有两种版本可以买: \N 1. 预先装好的整机 \N 2. 需要组装的组件 405 | 406 | the Kit which was popular with amateur computing enthusiasts, 407 | 计算机爱好者 喜欢买组件版 408 | 409 | sold for the then unprecedented low price are around $400 in 1975 410 | 售价极低,在 1975 年卖 400 美元左右 411 | 412 | Or about $2,000 in 2017 413 | 相当于 2017 年的 2000 美元 414 | 415 | To program the 8800, you'd literally toggle the switches on the front panel 416 | 为了给 8800 编程,你要拨动面板上的开关 417 | 418 | to enter the binary op-codes for the instruction you wanted 419 | 输入二进制操作码 420 | 421 | Then you press the deposit button to write that value into memory 422 | 然后按 "存储键" 把值存入内存 423 | 424 | Then in the next location in memory you toggle the switches again 425 | 然后会到下一个内存位置 \N 你可以再次拨开关,写下一个指令 426 | 427 | for your next instruction deposit it and so on 428 | 重复这样做 429 | 430 | When you finally entered your whole program into memory 431 | 把整个程序都写入内存之后 432 | 433 | you would toggle the switches moves back to memory address 0 434 | 可以推动开关,回到内存地址0 435 | 436 | press the run button and watch the little lights blink 437 | 然后按运行按钮,灯会闪烁 438 | 439 | That was home computing in 1975, Wow. 440 | 这就是 1975 年的家用计算机, 哇. 441 | 442 | Whether it was plug board, switches or punched paper 443 | 不管是插线板、开关或穿孔纸卡 444 | 445 | Programming these early computers was the realm of experts 446 | 早期编程都是专家活 447 | 448 | either professionals who did this for living or technology enthusiasts 449 | 不管是全职还是技术控,都要非常了解底层硬件 450 | 451 | you needed intimate knowledge of the underlying hardware, 452 | 不管是全职还是技术控,都要非常了解底层硬件 453 | 454 | so things like processor op-codes and register wits, to write programs 455 | 比如 操作码, 寄存器等, 才能写程序 456 | 457 | This meant programming was hard and tedious and even professional engineers 458 | 所以编程很难,很烦 459 | 460 | and scientists struggled to take full advantage of what computing could offer 461 | 哪怕工程师和科学家都无法 完全发挥计算机的能力 462 | 463 | What was needed was a simpler way to tell computers what to do, 464 | 我们需要一种更简单方式 告诉计算机要做什么 465 | 466 | a simpler way to write programs 467 | 一种更简单的编程方式 468 | 469 | And that brings us to programming languages, which we'll talk about next episode 470 | 这带领我们到下一个话题 - 编程语言, 我们下集会讲 471 | 472 | See you next week 473 | 下周见 474 | 475 | -------------------------------------------------------------------------------- /Content/计算科学速成/3. 布尔逻辑 和 逻辑门-Boolean Logic & Logic Gates.ass.txt: -------------------------------------------------------------------------------- 1 | Hi, I'm Carrie Anne and welcome to Crash Course Computer Science! 2 | 嗨,我是 Carrie Anne,欢迎收看计算机科学速成课! 3 | 4 | Today we start our journey up the ladder of abstraction, 5 | 今天我们开始"抽象"的旅程 6 | 7 | where we leave behind the simplicity of being able to see every switch and gear, 8 | 不用管底层细节,把精力用来构建更复杂的系统 9 | 10 | but gain the ability to assemble increasingly complex systems. 11 | 不用管底层细节,把精力用来构建更复杂的系统 12 | 13 | Last episode, we talked about how computers evolved from electromechanical devices, 14 | 上集,我们谈了计算机最早是机电设备 15 | 16 | that often had decimal representations of numbers 17 | 一般用十进制计数 18 | 19 | - like those represented by teeth on a gear 20 | - 比如用齿轮数来代表十进制 21 | 22 | - to electronic computers with transistors that can turn the flow of electricity on or off. 23 | - 再到晶体管计算机 24 | 25 | And fortunately, even with just two states of electricity, 26 | 幸运的是,只用 开/关 两种状态也可以代表信息 27 | 28 | we can represent important information. 29 | 幸运的是,只用 开/关 两种状态也可以代表信息 30 | 31 | We call this representation Binary 32 | 这叫 二进制 33 | 34 | -- which literally means "of two states", 35 | - 意思是"用两种状态表示" 36 | 37 | in the same way a bicycle has two wheels or a biped has two legs. 38 | 就像自行车有两个轮,双足动物有两条腿 39 | 40 | You might think two states isn't a lot to work with, and you'd be right! 41 | 你可能觉得两种状态不多,你是对的! 42 | 43 | But, it's exactly what you need for representing the values "true" and "false". 44 | 但如果只需要表示 true 和 false,两个值就够了 45 | 46 | In computers, an "on" state, when electricity is flowing, represents true. 47 | 电路闭合,电流流过,代表 "真" 48 | 49 | The off state, no electricity flowing, represents false. 50 | 电路断开,无电流流过,代表"假" 51 | 52 | We can also write binary as 1's and 0's instead of true's and false's 53 | 二进制也可以写成 1 和 0 而不是 true 和 false 54 | 55 | - they are just different expressions of the same signal 56 | - 只是不同的表达方式罢了 57 | 58 | - but we'll talk more about that in the next episode. 59 | - 我们下集会讲更多细节 60 | 61 | Now it is actually possible to use transistors for more than just turning electrical current on and off, 62 | 晶体管的确可以不只是 开/关,还可以让不同大小的电流通过 63 | 64 | and to allow for different levels of current. 65 | 晶体管的确可以不只是 开/关,还可以让不同大小的电流通过 66 | 67 | Some early electronic computers were ternary, that's three states, 68 | 一些早期电子计算机是三进制的,有 3 种状态 69 | 70 | and even quinary, using 5 states. 71 | 甚至五进制,5 种状态 72 | 73 | The problem is, the more intermediate states there are, 74 | 问题是,状态越多,越难区分信号 75 | 76 | the harder it is to keep them all seperate 77 | 问题是,状态越多,越难区分信号 78 | 79 | -- if your smartphone battery starts running low or there's electrical noise 80 | - 如果手机快没电了或者附近有电噪音 81 | 82 | because someone's running a microwave nearby, 83 | 因为有人在用微波炉, 84 | 85 | the signals can get mixed up... 86 | 信号可能会混在一起... 87 | 88 | and this problem only gets worse with transistors changing states millions of times per second! 89 | 而每秒百万次变化的晶体管会让这个问题变得更糟! 90 | 91 | So, placing two signals as far apart as possible 92 | 所以我们把两种信号尽可能分开 93 | 94 | - using just 'on and off' - gives us the most distinct signal to minimize these issues. 95 | - 只用"开"和"关"两种状态,可以尽可能减少这类问题 96 | 97 | Another reason computers use binary 98 | 计算机用二进制的另一个原因是 99 | 100 | is that an entire branch of mathematics already existed that dealt exclusively with true and false values. 101 | 有一整个数学分支存在,专门处理"真"和"假" 102 | 103 | And it had figured out all of the necessary rules and operations for manipulating them. 104 | 它已经解决了所有法则和运算 105 | 106 | It's called Boolean Algebra! 107 | 叫"布尔代数"! 108 | 109 | George Boole, from which Boolean Algebra later got its name, 110 | 乔治·布尔(George Boole)是布尔二字的由来 111 | 112 | was a self-taught English mathematician in the 1800s. 113 | 是一位 19 世纪自学成才的英国数学家 114 | 115 | He was interested in representing logical statements that went "under, over, and beyond" 116 | 他有兴趣用数学式子 扩展亚里士多德基于哲学的逻辑方法 117 | 118 | Aristotle's approach to logic, which was, unsurprisingly, grounded in philosophy. 119 | 他有兴趣用数学式子 扩展亚里士多德基于哲学的逻辑方法 120 | 121 | Boole's approach allowed truth to be systematically and formally proven, through logic equations 122 | 布尔用 逻辑方程 系统而正式的证明真理(truth) 123 | 124 | which he introduced in his first book, "The Mathematical Analysis of Logic" in 1847. 125 | 他在 1847 年的第一本书"逻辑的数学分析"中介绍过 126 | 127 | In "regular" algebra -- the type you probably learned in high school -- the values of variables 128 | 在"常规"代数里 - 你在高中学的那种 - 变量的值 129 | 130 | are numbers, and operations on those numbers are things like addition and multiplication. 131 | 是数字,可以进行加法或乘法之类的操作 132 | 133 | But in Boolean Algebra, the values of variables are true and false, and the operations are logical. 134 | 但在布尔代数中,变量的值是 true 和 false,\N 能进行逻辑操作 135 | 136 | There are three fundamental operations in Boolean Algebra: a NOT, an AND, and an OR operation. 137 | 布尔代数中有三个基本操作:NOT, AND 和 OR 138 | 139 | And these operations turn out to be really useful so we're going to look at them individually. 140 | 这些操作非常有用,我们一个个来看 141 | 142 | A NOT takes a single boolean value, either true or false, and negates it. 143 | NOT 操作把布尔值反转,\N把 true 进行 NOT 就会变成 false,反之亦然 144 | 145 | It flips true to false, and false to true. 146 | NOT 操作把布尔值反转,\N把 true 进行 NOT 就会变成 false,反之亦然 147 | 148 | We can write out a little logic table that shows the original value under Input, 149 | 我们可以根据 NOT 操作的输入和输出,做出这个表 150 | 151 | and the outcome after applying the operation under Output. 152 | 我们可以根据 NOT 操作的输入和输出,做出这个表 153 | 154 | Now here's the cool part -- we can easily build boolean logic out of transistors. 155 | 酷的地方是 - 用晶体管可以轻松实现这个逻辑 156 | 157 | As we discussed last episode, transistors are really just little electrically controlled switches. 158 | 上集说过,晶体管只是电控制的开关 159 | 160 | They have three wires: two electrodes and one control wire. 161 | 有 3 根线:2 根电极和 1 根控制线 162 | 163 | When you apply electricity to the control wire, 164 | 控制线通电时 165 | 166 | it lets current flow through from one electrode, through the transistor, to the other electrode. 167 | 电流就可以从一个电极流到另一个电极 168 | 169 | This is a lot like a spigot on a pipe 170 | 就像水龙头一样 171 | 172 | -- open the tap, water flows, 173 | - 打开水龙头,就有水流出来 174 | 175 | close the tap, water shuts off. 176 | 关掉水龙头,就没水了 177 | 178 | You can think of the control wire as an input, 179 | 可以把控制线,当做输入 ( input ) \N 底部的电极,当做输出(output) 180 | 181 | and the wire coming from the bottom electrode as the output. 182 | 可以把控制线,当做输入 ( input ) \N 底部的电极,当做输出(output) 183 | 184 | So with a single transistor, we have one input and one output. 185 | 所以 1 个晶体管,有一个输入和一个输出 186 | 187 | If we turn the input on, the output is also on because the current can flow through it. 188 | 如果我们打开输入(input on) \N 输出也会打开(output on) \N 因为电流可以流过 189 | 190 | If we turn the input off, the output is also off and the current can no longer pass through. 191 | 如果关闭输入(input off) \N 输出也会关闭(output off)\N 因为电流无法通过 192 | 193 | Or in boolean terms, when the input is true, the output is true. 194 | 或者用布尔术语来说\N 输入为 真,输出为 真 195 | 196 | And when the input is false, the output is also false. 197 | 输入为 假 \N 输出为 假 198 | 199 | Which again we can show on a logic table. 200 | 我们也可以把这个做成"真值表" 201 | 202 | This isn't a very exciting circuit though because its not doing anything 203 | 这个电路没什么意思,因为它没做什么事 204 | 205 | -- the input and output are the same. 206 | - 输入和输出是一样的 207 | 208 | But, we can modify this circuit just a little bit to create a NOT. 209 | 但我们可以稍加修改,实现 NOT 210 | 211 | Instead of having the output wire at the end of the transistor, we can move it before. 212 | 与其把下面那根线当做 输出,我们可以把 输出 放到上面 213 | 214 | If we turn the input on, the transistor allows current to pass through it to the "ground", 215 | 如果打开 输入,电流可以流过然后 "接地" 216 | 217 | and the output wire won't receive that current 218 | 输出就没有电流,所以输出是 off 219 | 220 | - so it will be off. 221 | 输出就没有电流,所以输出是 off 222 | 223 | In our water metaphor grounding would be like 224 | 如果用水来举例 225 | 226 | if all the water in your house was flowing out of a huge hose 227 | 就像家里的水都从一个大管子流走了 228 | 229 | so there wasn't any water pressure left for your shower. 230 | 打开淋浴头一点水也没有 231 | 232 | So in this case if the input is on, output is off. 233 | 如果输入是 on,输出是 off 234 | 235 | When we turn off the transistor, though, current is prevented from flowing down it to the ground, 236 | 当输入是 off,电流没法接地,就流过了输出,所以输出是 on 237 | 238 | so instead, current flows through the output wire. 239 | 当输入是 off,电流没法接地,就流过了输出,所以输出是 on 240 | 241 | So the input will be off and the output will be on. 242 | 如果输入是 off,输出是 on 243 | 244 | And this matches our logic table for NOT, so congrats, we just built a circuit that computes NOT! 245 | 和 NOT 操作表一样!太棒了!我们做了个有点用的电路! 246 | 247 | We call them NOT gates - we call them gates because they're controlling the path of our current. 248 | 我们叫它 "NOT 门" \N 之所以叫 "门",是因为它能控制电流的路径 249 | 250 | The AND Boolean operation takes two inputs, but still has a single output. 251 | "AND"操作有 2 个输入,1 个输出 252 | 253 | In this case the output is only true if both inputs are true. 254 | 如果 2 个输入都是 true,输出才是 true 255 | 256 | Think about it like telling the truth. 257 | 你可以想成是 说真话 258 | 259 | You're only being completely honest if you don't lie even a little. 260 | 如果完全不说谎,才是诚实 261 | 262 | For example, let's take the statement, 263 | 举例,看如下这个句子 264 | 265 | "My name is Carrie Anne AND I'm wearing a blue dress". 266 | 我叫 Carrie Anne "而且"我穿着蓝色的衣服 267 | 268 | Both of those facts are true, so the whole statement is true. 269 | 2 个都是真的,所以整个是真的 270 | 271 | But if I said, "My name is Carrie Anne AND I'm wearing pants" that would be false, 272 | 但如果说,我叫 Carrie Anne"而且"我穿了裤子, 就是假的 273 | 274 | because I'm not wearing pants. 275 | 因为我没穿裤子 276 | 277 | Or trousers. 278 | 或长裤,如果你是英国人你会用这个词……(英/美单词不同梗) 279 | 280 | If you're in England. 281 | 或长裤,如果你是英国人你会用这个词……(英/美单词不同梗) 282 | 283 | The Carrie Anne part is true, but a true AND a false, is still false. 284 | 虽然前半句是真的,但是 真 "AND" 假,还是假 285 | 286 | If I were to reverse that statement it would still obviously be false, 287 | 就算把前后顺序反过来,也依然是 假 288 | 289 | and if I were to tell you two complete lies that is also false, 290 | 如果我说 2 个假的事情,那么结果是假。 291 | 292 | and again we can write all of these combinations out in a table. 293 | 和上次一样,可以给"AND"做个表 294 | 295 | To build an AND gate, we need two transistors connected together 296 | 为了实现 "AND 门",我们需要 2 个晶体管连在一起 297 | 298 | so we have our two inputs and one output. 299 | 这样有 2 个输入和 1 个输出 300 | 301 | If we turn on just transistor A, current won't flow because the current is stopped by transistor B. 302 | 如果只打开 A,不打开 B \N 电流无法流到 output,所以输出是 false 303 | 304 | Alternatively, if transistor B is on, but the transistor A is off, 305 | 如果只打开 B,不打开 A ,也一样,电流无法流到 output 306 | 307 | the same thing, the current can't get through. 308 | 如果只打开 B,不打开 A ,也一样,电流无法流到 output 309 | 310 | Only if transistor A AND transistor B are on does the output wire have current. 311 | 只有 A 和 B 都打开了,output 才有电流 312 | 313 | The last boolean operation is OR 314 | 最后一个是 OR (前面讲了 NOT 和 AND) 315 | 316 | -- where only one input has to be true for the output to be true. 317 | 只要 2 个输入里,其中 1 个是 true,输出就是 true 318 | 319 | For example, my name is Margaret Hamilton OR I'm wearing a blue dress. 320 | 比如,我叫 Margaret Hamilton"或"我穿着蓝色衣服 321 | 322 | This is a true statement because although I'm not Margaret Hamilton unfortunately, 323 | 结果是 true,虽然我不是 Margaret Hamilton 324 | 325 | I am wearing a blue dress, so the overall statement is true. 326 | 但是我穿着蓝色衣服,所以结果是 true 327 | 328 | An OR statement is also true if both facts are true. 329 | 对于"OR 操作"来说,\N如果 2 个 输入都是 true,输出也是 true 330 | 331 | The only time an OR statement is false is if both inputs are false. 332 | 只有 2 个输入都是 false,OR 的结果才是 false 333 | 334 | Building an OR gate from transistors needs a few extra wires. 335 | 实现 "OR 门" 除了晶体管还要额外的线 336 | 337 | Instead of having two transistors in series -- one after the other -- 338 | 不是串联起来。而是并联 339 | 340 | we have them in parallel. 341 | 不是串联起来。而是并联 342 | 343 | We run wires from the current source to both transistors. 344 | 然后左边这条线有电流输入 345 | 346 | We use this little arc to note that the wires jump over one another and aren't connected, 347 | 我们用"小拱门"代表 2 条线没连在一起,只是跨过而已 348 | 349 | even though they look like they cross. 350 | 虽然看起来像连在一起 351 | 352 | If both transistors are turned off, the current is prevented from flowing to the output, 353 | 如果 A 和 B 都是 off,电流无法流过 354 | 355 | so the output is also off. 356 | 所以输出是 off 357 | 358 | Now, if we turn on just Transistor A, current can flow to the output. 359 | 如果打开 A,电流可以流过。输出是 on 360 | 361 | Same thing if transistor A is off, but Transistor B in on. 362 | 如果只打开 B 也一样 363 | 364 | Basically if A OR B is on, the output is also on. 365 | 只要 A OR B 是 on, 输出就是 on 366 | 367 | Also, if both transistors are on, the output is still on. 368 | 如果 A 和 B 都 on,结果是 on 369 | 370 | Ok, now that we've got NOT, AND, and OR gates, 371 | 好,现在 NOT 门, AND 门, OR 门 都搞定了 372 | 373 | and we can leave behind the constituent transistors and move up a layer of abstraction. 374 | 我们可以进行一次抽象 375 | 376 | The standard engineers use for these gates are a triangle with a dot for a NOT, 377 | NOT 门的画法是三角形前面一个圆点 378 | 379 | a D for the AND, and a spaceship for the OR. 380 | AND 门用 D 表示 ,OR 门用太空船表示 381 | 382 | Those aren't the official names, but that's howI like to think of them. 383 | "D 形状和太空船"不是标准叫法, 只是我喜欢这样叫而已 384 | 385 | Representing them and thinking about them this way allows us to build even bigger components 386 | 我们可以用这种方法表示它们,构建更大的组件 387 | 388 | while keeping the overall complexity relatively the same 389 | 就不会变得很复杂 390 | 391 | - just remember that that mess of transistors and wires is still there. 392 | - 晶体管和电线依然在那里,我们只是用符号来代表而已 393 | 394 | For example, another useful boolean operation in computation is called an Exclusive OR 395 | 除了前面说的三个\N 另一个有用的布尔操作叫 "异或" 396 | 397 | - or XOR for short. 398 | - 简称 XOR 399 | 400 | XOR is like a regular OR, but with one difference: 401 | XOR 就像普通 OR,但有一个区别: 402 | 403 | if both inputs are true, the XOR is false. 404 | 如果 2 个输入都是 true,XOR 输出 false 405 | 406 | The only time an XOR is true is when one input is true and the other input is false. 407 | 想要 XOR 输出 true \N 一个输入必须是 true,另一个必须是 false 408 | 409 | It's like when you go out to dinner and your meal comes with a side salad OR a soup 410 | 就像你出去吃晚饭,你点的饭要么配沙拉,要么配汤 411 | 412 | - sadly, you can't have both! 413 | - 你不能两个都要! 414 | 415 | And building this from transistors is pretty confusing, 416 | 用晶体管实现 XOR 门有点烧脑子 417 | 418 | but we can show how an XOR is created from our three basic boolean gates. 419 | 但我可以展示一下\N 怎么用前面提到的 3 种门来做 XOR 门 420 | 421 | We know we have two inputs again -- A and B -- and one output. 422 | 我们有 2 个输入,A 和 B ,还有 1 个输出. 423 | 424 | Let's start with an OR gate, since the logic table looks almost identical to an OR. 425 | 我们先放一个 OR 门. 因为 OR 和 XOR 的逻辑表很像 426 | 427 | There's only one problem - when A and B are true, the logic is different from OR, 428 | 只有 1 个问题 - 当 A 和 B 都是 true 时 \N OR 的输出和想要的 XOR 输出不一样 429 | 430 | and we need to output "false". 431 | 我们想要 false 432 | 433 | And XOR turns out to be a very useful component, 434 | XOR 超有用的 435 | 436 | and we'll get to it in another episode, 437 | 我们下次再说它 438 | 439 | so useful in fact engineers gave it its own symbol too -- an OR gate with a smile :) 440 | 因为超有用,\N 工程师给了它一个符号,一个 OR 门 + 一个笑脸 441 | 442 | But most importantly, we can now put XOR into our metaphorical toolbox 443 | 重要的是,现在可以把 XOR 放入"工具箱"了 444 | 445 | and not have to worry about the individual logic gates that make it up, 446 | 不用担心 XOR 具体用了几个门 447 | 448 | or the transistors that make up those gates, 449 | 这几个门又是怎么用晶体管拼的 450 | 451 | or how electrons are flowing through a semiconductor. 452 | 或电子是怎么流过半导体的 453 | 454 | Moving up another layer of abstraction. 455 | 再次向上抽象 456 | 457 | When computer engineers are designing processors, they rarely work at the transistor level, 458 | 工程师设计处理器时,很少在晶体管的层面上思考, 459 | 460 | and instead work with much larger blocks, like logic gates, and even larger components 461 | 而是用更大的组件,比如逻辑门,或者由逻辑门组成的更大组件, 462 | 463 | made up of logic gates, which we'll discuss in future episodes. 464 | 我们以后会讲 465 | 466 | And even if you are a professional computer programmer, 467 | 就算是专业程序员 468 | 469 | it's not often that you think about 470 | 也不用考虑逻辑是怎样在物理层面实现的 471 | 472 | how the logic that you are programming is actually implemented 473 | 也不用考虑逻辑是怎样在物理层面实现的 474 | 475 | in the physical world by these teeny tiny components. 476 | 也不用考虑逻辑是怎样在物理层面实现的 477 | 478 | We've also moved from thinking about raw electrical signals to our first representation of data 479 | 我们从电信号开始,到现在第一次表示数据 480 | 481 | - true and false - and we've even gotten a little taste of computation. 482 | - 真和假 - 开始有点"计算"的感觉了 483 | 484 | With just the logic gates in this episode, 485 | 仅用这集讲的 逻辑门 486 | 487 | we could build a machine that evaluates complex logic statements, 488 | 我们可以判断复杂的语句 比如: 489 | 490 | like if "Name is John Green AND after 5pm OR is Weekend AND near Pizza Hut", 491 | [如果是 John Green] AND [下午 5 点后] \N OR [周末] AND [在比萨店附近] 492 | 493 | then "John will want pizza" equals true. 494 | 那么 "John 想要比萨" = 真 495 | 496 | And with that, I'm starving, I'll see you next week. 497 | 我都说饿了,下周见 498 | 499 | -------------------------------------------------------------------------------- /Content/设计模拟板/Media/BusinessProcessDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/设计模拟板/Media/BusinessProcessDiagram.png -------------------------------------------------------------------------------- /Content/设计模拟板/Media/DomainModel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/设计模拟板/Media/DomainModel.png -------------------------------------------------------------------------------- /Content/设计模拟板/Media/PushSequenceDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/设计模拟板/Media/PushSequenceDiagram.png -------------------------------------------------------------------------------- /Content/设计模拟板/Media/SystemArchitecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/设计模拟板/Media/SystemArchitecture.png -------------------------------------------------------------------------------- /Content/设计模拟板/Media/model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/设计模拟板/Media/model.png -------------------------------------------------------------------------------- /Content/设计模拟板/Media/晋升答辩.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Content/设计模拟板/Media/晋升答辩.pptx -------------------------------------------------------------------------------- /Content/设计模拟板/README.md: -------------------------------------------------------------------------------- 1 | # 目录 2 | # 1.背景 3 | 4 | # 2.目标 5 | 6 | # 3.技术方案 7 | 8 | ## 3.1 模版配置化(简接入) 9 | 10 | ### 3.1.1整体设计 11 | 12 | ###3.1.2 详细设计 13 | 14 | ## 3.2 业务功能隔离(高稳定) 15 | 16 | ### 3.2.1 整体设计 17 | 18 | ### 3.2.2 详细设计 19 | 20 | ### 3.2.3 平滑上线计划及稳定性监控 21 | 22 | ## 3.3 端到端的实时监控 23 | 24 | ### 3.3.1 整体设计 25 | 26 | ### 3.3.2 详细设计 27 | 28 | ### 3.3.3 平台地址 29 | 30 | ## 3.4 push推送时序图 31 | 32 | ![](Media/PushSequenceDiagram.png) 33 | 34 | ## 3.5 整体业务流程图 35 | ![](Media/SystemArchitecture.png) 36 | ## 3.6 业务使用场景 37 | 38 | # 4.系统架构 39 | 40 | ## 4.1 系统架构 41 | 42 | ## 4.2 触达开店宝push中心能力 43 | 44 | ## 4.3 上下游链路 45 | 46 | # 5.接入情况 47 | -------------------------------------------------------------------------------- /ContentCW.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ] 7 | } -------------------------------------------------------------------------------- /Media/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Media/cover.jpg -------------------------------------------------------------------------------- /Media/cover2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Media/cover2.jpg -------------------------------------------------------------------------------- /Other/结果导向.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bambom/GameDevelopment-Study-Notes/17e44a59ac6578f30dedcba45204130fb9da6a3a/Other/结果导向.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ![](Media/cover2.jpg) 4 | 5 | 6 | 7 | # Game-Development-Study-Notes 8 | 9 | :anchor: 游戏程序员的读书笔记。 10 | 11 | 最好的习惯,最靠谱的提升方法:持续阅读,持续写作,持续编码。 12 | 13 | 新的开始,以此铭记,砥砺前行! 14 | 15 | # 目录 16 | 17 | ## 基础 数学*算法 18 | 19 | ## 渲染 20 | 21 | - [《Unity内置Shader源码剖析》]() 22 | - [《SRP相关摘记》](https://github.com/bambom/GameDevelopment-Study-Notes/blob/master/Content/%E3%80%8AUnity%20Scriptable%20Render%20Pipeline%E3%80%8B/Inctrodution-of-Univeral-RP.md) 23 | 24 | ## 软件 设计模式*Code 25 | 26 | - [《大话设计模式》提炼总结](https://github.com/bambom/GameDevelopment-Study-Notes/blob/master/Content/%E3%80%8A%E5%A4%A7%E8%AF%9D%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%E3%80%8B/README.md) 27 | 28 | ## 逆向 逆向工程 29 | 30 | * * * 31 | #### 实践 32 | - [使用Ida动态调试模拟器apk](https://github.com/bambom/GameDevelopment-Study-Notes/blob/master/Content/ida%E8%BF%9E%E6%A8%A1%E6%8B%9F%E5%99%A8apk/README.md) 33 | 34 | * * * 35 | #### 语言 36 | - [《C# to IL》]() 37 | - [《Intel汇编语言程序设计》]() 38 | - [《lua源码欣赏》]() 39 | - [《两周自制脚本语言》]() 40 | - [《一个64位操作系统的设计与实现》]() 41 | - [《自制编程语言》]() 42 | - [《GPU编程语言与CG语言》]() 43 | 44 | - [垃圾回收算法手册:自动内存管理的艺术](https://book.douban.com/subject/26740958/) 45 | - [垃圾回收的算法与实现](https://book.douban.com/subject/26821357/) 46 | - [《深入理解java虚拟机》]() 47 | 48 | * * * 49 | #### 计算机系统 50 | - [《深入理解计算机系统》]() 51 | - [《Windows PE 权威指南》]() 52 | - [《自己动手写操作系统》]() 53 | - [《领域热定语言》]() 54 | 55 | * * * 56 | #### 网络 57 | - [《计算机网络》]() 58 | 59 | * * * 60 | #### 硬件 61 | 62 | - [《数字电路与逻辑设计》]() 63 | - [《RISC-V处理器》]() 64 | 65 | * * * 66 | 67 | #### 逆向,反编译相关 68 | 69 | - [《IDA Pro 权威指南》]() 70 | - [《逆向工程核心原理》]() 71 | - [《逆向工程权威指南.上册》]() 72 | - [《逆向工程权威指南.下册》]() 73 | - [《加密与解密》]() 74 | - [《有趣的二进制:软件安全与逆向分析》]() 75 | - [《Android软件安全与逆向分析》]() 76 | - [《编码隐匿在计算机软硬件背后的语言》]() 77 | 78 | * * * 79 | ## Other 80 | - [《咨询的奥秘:寻求和提出建议的智慧》] 81 | - [《有用的商学课》随听摘录](https://github.com/bambom/GameDevelopment-Study-Notes/blob/master/Content/%E3%80%8A%E6%9C%89%E7%94%A8%E7%9A%84%E5%95%86%E5%AD%A6%E8%AF%BE%E3%80%8B/README.md) 82 | 83 | ## GameProject * 框架 84 | 85 | - [《GameProject》](https://github.com/bambom/GameDevelopment-Study-Notes/blob/master/Content/%E3%80%8AGameProject%E3%80%8B/GameProject_Menue.md) 86 | 87 | - [《GameUnity》](https://github.com/bambom/GameDevelopment-Study-Notes/blob/master/Content/%E3%80%8AGameUnity%E3%80%8B%E6%8F%90%E7%82%BC/GameUnity.md) 88 | 89 | ## 智能家居 * 物联网应用 * 全息投影 90 | 91 | ## 数值 92 | 93 | - [暗黑数值论坛](http://bbs.anhei2.com/) 94 | 95 | ## 音乐 96 | 97 | 98 | 99 | ## 美术资源 --------------------------------------------------------------------------------