和Keyle一起学StrangeIoc – Introduction

Strange: the IoC framework for Unity

Strange attractors create predictable patterns, often in chaotic systems. 在混乱的系统中创造出一个可以预测的模式 .

Introduction

StrangeIoc主要用于C#与Unity3d,我们已经在IOS,Web,Android项目中成功运用,他包含了如下功能,其中大部分功能都是可选的

Strange is a super-lightweight and highly extensible Inversion-of-Control (IoC) framework, written specifically for C# and Unity. We’ve validated Strange on web, standalone, and iOS and Android. It contains the following features, most of which are optional:

框架的核心是让你绑定一个或多个对象

  • A core binding framework that pretty much lets you bind one or more of anything to one or more of anything else.

    依赖注入

    1.映射单例,每次都可通过工厂返回新实例

    2.类名注入

    3.属性器注入

    4.构造注入

    5.方法注入

    6.Monobehaviors注入

    7.绑定多态

    8.反射与绑定结合,减少反射的性能开销

  • Dependency Injection
    • Map as singleton, value or factory (get a new instance each time you need one)

    • Name injections
    • Perform constructor or setter injection
    • Tag your preferred constructor
    • Tag a method to fire after construction
    • Inject into MonoBehaviours
    • Bind polymorphically (bind any or all of your interfaces to a single concrete class)
    • Reflection binding dramatically reduces overhead of employing reflectivity

    两种类型的事件共享总线

    1.二者的dispatch事件可在程序的任何一处调用

    2.二者为了实现本地通信都需要映射本地事件总线

    3.二者为了分离逻辑都需要映射事件

    4.新的Signals的实现增加了类型安全

  • Two styles of shared event bus.
    • Both dispatch events to any point in your application

    • Both map local event bus for local communication
    • Both map events to Command classes to separate business logic
    • The new Signals implementation adds type saftety
    • NB: Examples in this document use the default EventDispatcher. We‘ve added a section explaining Signals, but didn‘t, frankly, have the patience to re-write the entire guide. Nevertheless, we encourage the use of Signals as the preferred means of communication.
  • MonoBehaviour mediation
    • Facilitate separation of a view from the application using it

    • Keep Unity-specific code isolated from the rest of the app
  • Optional MVCS (Model/View/Controller/Service) structure

    介绍可选MVCS部分

    1.多上下文,在单独的功能中使用自身的上下文,全局功能中使用程序级上下文

    2.允许多个上下文之间通信

  • Multiple contexts
    • Allow subcomponents (separate Scenes) to function on their own, or in the context of larger apps.

    • Allow communication between contexts.
  • Don’t see what you need? The core binding framework is simple to extend. Build new Binders like:
    • A different type of dispatcher

    • An entity framework
    • A multi-loader

    In addition to organizing your project into a sensible structure, Strange offers the following benefits:

    • Designed to play well with Unity3D. Also designed to play well without it.

    • Separate UnityEngine code from the rest of your app.
      • Improves portability

      • Improves unit testability
    • A common event bus makes information flow easy and highly decoupled. (Note: Unity’s SendMessage method does this, of course, but it’s dangerous as all get-out. I may write a whole article on just this topic at some point.)
    • The extensible binder really is amazing (a friend used to tell me “it’s good to like your own cookin’!”). The number of things you can accomplish with the tiny core framework would justify Strange all on its own.
    • Multiple contexts allow you to “bootstrap” subcomponents so they operate fine either on their own or as an integrated part. This can hugely speed up your development process and allow developers to work in isolation, then integrate in later stages of development.
    时间: 2024-10-26 11:36:48

    和Keyle一起学StrangeIoc – Introduction的相关文章

    和Keyle一起学StrangeIoc – Extensions

    Strange: the IoC framework for Unity Extensions You may have heard that Strange is a Dependency Injection framework. I'm a little uncomfortable with that description. Sure, Strange offers DI and it's a great use, but the core of the framework - as I'

    和Keyle一起学StrangeIoc – Binding

    Strange: the IoC framework for Unity Binding StrangeIoc的核心是一个非常简单的绑定包,它可以创建间接绑定,减轻代码对程序其他部分的依赖. The core of Strange is a very simple package for binding. This means, essentially, that we can bind (connect) one or more of anything to one or more of an

    和Keyle一起学StrangeIoc – MVCSContext

    MVCSContext: the big picture 本篇基本上就是介绍Strange框架的基本方法使用与部署Unity3d项目,另外所有框架的思路都是一致的,让项目变得易于维护.现在让我们一起开始吧. This section is basically a recipe for building a Strange app with MVCSContext. In the last section I described all the parts; in this one I'll ex

    和Keyle一起学StrangeIoc – 教程目录

    推荐你先快速阅读下项目概览Overview 翻译地址 http://www.cnblogs.com/Keyle/p/4289314.html 1. Binding  对应翻译 http://www.cnblogs.com/Keyle/p/4302442.html The structure of a binding 2. Extensions  对应翻译 http://www.cnblogs.com/Keyle/p/4304580.html The injection extension Ins

    和Keyle一起学ShaderForge – Custom Blinn-Phong

    用了两天时间精心准备了这篇教程,快来和Keyle一起学ShaderForge,玩起来~ 本章目录 1.什么是Blinn-Phong光照模型 2.如何使用自定义光照模型 2.1 ShaderForge内置光照模型 3.如何使用自定义类似光照实现Blinn-Phong的光照模型 4.完善我们的自定义Shader 4.1 我们先模拟出一个Diffuse的算法        4.2合并(通过加法),得到我们想要的结果        4.3 优化 去除重复声明的变量 如同Normal Direction 

    和Keyle一起学StrangeIoc- 视频教程

    StrangeIoC: The Good, The Bad and the Strange (Part 1 of 2)https://www.youtube.com/watch?v=4ebReOBH15Q StrangeIoC: The Good, The Bad and the Strange (Part 2 of 2)https://www.youtube.com/watch?v=k4Y7WgoYkD8&feature=iv&src_vid=4ebReOBH15Q&annota

    和Keyle一起学ShaderForge – Create Base Shader

    1.本篇让我们一起动手试试使用ShaderForge创建一个基本的Shader 2.介绍Shader文件Main函数中公开的节点 1.使用ShaderForge创建一个基本的Shader 效果如下左1为 node_1311 Color效果为纯白下的 ,左2为 node_1311 Color效果为红色RGB(255,0,0) 生成代码如下,在Properties 属性中增加了_keyleTexture 贴图,_TextureNormal 法线贴图 ,_node_1311 Color ,在两个对应的

    Swift学习手札

    ? Keyle以前学过1个礼拜的OC,但是OC基础还是无限趋近于零,原因是OC的语法实在是sang高xin大bing上kuang,现在恰好工作之余还有那么一些零散的时间可以看看Swift便在此记下一些学习心得,缓慢更新中 -? ? 收获第一个报错 第一个HelloWorld就遇到问题了,我对一个变量进行如下声明结果报错了...报错了... String name = "keyle" println(name) 直接定义基本类型会报错,但是定义为常量或者var类型则不会 let name

    StrangeIOC MVCS框架介绍及进阶

    这一篇教程将带大家熟悉 StrangeIOC框架 并且讲解一些C#的实用的高级技巧 如 "依赖注入(DI)之属性注入" ,"控制反转(IOC)".老规矩先问几个问题 1.框架在项目中实现"看起来"过于复杂? 答: 原本直接实现的东西现在要"兜一圈"当然这里的兜一圈是打引号的,其实是循规蹈矩的,该往哪里写代码早就在事先约定好了 2.使用了此框架后代码理解起来很费力? 答:这一条纯属是没有框架概念的人会有的,如果你稍稍注意代码的规