Exemplo n.º 1
0
        public static DanmakuController Compress(this IEnumerable <IDanmakuController> controllers)
        {
            if (controllers == null)
            {
                throw new System.NullReferenceException();
            }

            DanmakuController controller = null;
            var list = controllers as IList <IDanmakuController>;

            if (list != null)
            {
                int count = list.Count;
                for (int i = 0; i < count; i++)
                {
                    IDanmakuController current = list[i];
                    if (current != null)
                    {
                        controller += current.Update;
                    }
                }
            }
            else
            {
                foreach (var current in controllers)
                {
                    if (current != null)
                    {
                        controller += current.Update;
                    }
                }
            }
            return(controller);
        }
Exemplo n.º 2
0
        public static T RemoveController <T> (this T danmakus, IDanmakuController controller) where T : class, IEnumerable <Danmaku>
        {
            if (danmakus == null)
            {
                return(null);
            }
            var arrayTest = danmakus as Danmaku[];
            DanmakuController controlleDelegate = controller.Update;

            if (arrayTest != null)
            {
                for (int i = 0; i < arrayTest.Length; i++)
                {
                    Danmaku danmaku = arrayTest[i];
                    if (danmaku != null)
                    {
                        danmaku.RemoveController(controlleDelegate);
                    }
                }
            }
            else
            {
                foreach (var danmaku in danmakus)
                {
                    if (danmaku != null)
                    {
                        danmaku.RemoveController(controlleDelegate);
                    }
                }
            }
            return(danmakus);
        }
Exemplo n.º 3
0
        public AddControllersModifier(IEnumerable <IDanmakuController> controllers)
        {
            this.controllers = null;

            if (controllers == null)
            {
                return;
            }

            var colList = controllers as IList <IDanmakuController>;

            if (colList != null)
            {
                for (int i = 0; i < colList.Count; i++)
                {
                    IDanmakuController controller = colList[i];
                    if (controller != null)
                    {
                        controllerAggregate += controller.Update;
                    }
                }
            }
            else
            {
                foreach (var controller in controllers)
                {
                    if (controller != null)
                    {
                        controllerAggregate += controller.Update;
                    }
                }
            }
        }
Exemplo n.º 4
0
 public void RemoveController(IDanmakuController controller)
 {
     if (controller != null)
     {
         ControllerUpdate -= controller.Update;
         controllerCheck   = ControllerUpdate != null;
     }
 }
Exemplo n.º 5
0
 public void AddController(IDanmakuController controller)
 {
     if (controller != null)
     {
         ControllerUpdate += controller.Update;
         controllerCheck   = ControllerUpdate != null;
     }
 }
 public FireBuilder WithController(IDanmakuController controller)
 {
     if (controller != null)
     {
         Controller += controller.Update;
     }
     return(this);
 }
Exemplo n.º 7
0
 public void RemoveController(IDanmakuController controller)
 {
     controllerAggregate -= controller.Update;
 }
Exemplo n.º 8
0
 public void AddController(IDanmakuController controller)
 {
     controllerAggregate += controller.Update;
 }
Exemplo n.º 9
0
 public AddControllersModifier(IDanmakuController controller)
 {
     controllers         = null;
     controllerAggregate = controller.Update;
 }