Example #1
0
 public virtual bool Register <T>(T module)
 {
     if (module is IInit)
     {
         IInit v = (IInit)module;
         v.Init();
     }
     if (module is IUpdate)
     {
         IUpdate v = (IUpdate)module;
         if (!m_UpdateList.Contains(v))
         {
             m_UpdateList.Add(v);
         }
     }
     if (module is IDestroy)
     {
         IDestroy v = (IDestroy)module;
         if (!m_DestroyList.Contains(v))
         {
             m_DestroyList.Add(v);
         }
     }
     return(true);
 }
 public static void UnRegisteIInit(IInit single)
 {
     if (listInit.Contains(single))
     {
         single.OnRelease();
         listInit.Remove(single);
     }
 }
Example #3
0
 private Bootstrap(IInit init, IMain main, IGame game)
 {
     init.Done()
     .Select(_ => main.Run())
     .Switch()
     .Do(_ => main.Hide())
     .Select(game.Run)
     .Switch()
     .Do(_ => main.Show())
     .Subscribe();
 }
Example #4
0
        // the object for operations in Flow
        // has weights, (always initialized)
        // gradients, (initialize by default; can be told to not to initialize)
        // and gradient histories (not initialized; optimizers should do it)

        // for param init
        // using given initializer
        public Tensor(int rowDimension, int columnDimension, IInit init, bool needGrad = true)
        {
            Row      = rowDimension;
            Col      = columnDimension;
            Capacity = rowDimension * columnDimension;
            W        = init != null
                ? new Matrix(rowDimension, columnDimension, init.Next)
                : new Matrix(rowDimension, columnDimension);
            DW  = needGrad ? new Matrix(rowDimension, columnDimension) : null;
            HW  = null;
            HW2 = null;
        }
Example #5
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="n">TBD</param>
        /// <param name="init">TBD</param>
        public FanInShapeN(int n, IInit init) : base(init)
        {
            N   = n;
            In0 = NewInlet <T0>("in0");
            var builder = ImmutableArray.CreateBuilder <Inlet <T1> >(n);

            for (int i = 0; i < n; i++)
            {
                builder.Add(new Inlet <T1>("in" + i));
            }
            In1s = builder.ToImmutable();
        }
 public static void RegisteIInit(IInit single)
 {
     if (single == null)
     {
         return;
     }
     if (!listInit.Contains(single))
     {
         listInit.Add(single);
         single.OnInit();
     }
 }
Example #7
0
 // for param init
 // using given initializer
 public Tensor(int rowDimension, int columnDimension, IInit init)
 {
     Row      = rowDimension;
     Col      = columnDimension;
     Capacity = rowDimension * columnDimension;
     W        = init != null
         ? new Matrix(rowDimension, columnDimension, init.Next)
         : new Matrix(rowDimension, columnDimension);
     DW  = new Matrix(rowDimension, columnDimension);
     HW  = new Matrix(rowDimension, columnDimension);
     HW2 = new Matrix(rowDimension, columnDimension);
 }
Example #8
0
        // Start is called before the first frame update
        void Start()
        {
            //DataMgr.Instance.ClearAll();  // 数据修改的时候,作为清空重新加载使用

            GameStateModel.Instance.CurrentScene = SceneName.Main;
            IInit lifeCycle = LifeCycleMgr.Instance;

            lifeCycle.Init();

            AudioMgr.Instance.Init();

            UIMgr.Instance.Show(Paths.START_VIEW);
        }
    private IEnumerator Init()
    {
        yield return(TestMgr.Single.Init());

        //DataMgr.Single.ClearAll();
        GameStateModel.Single.CurrentScene = SceneName.Main;
        IInit lifeCycle = LifeCycleMgr.Single;

        lifeCycle.Init();

        UIManager.Single.Show(Paths.PREFAB_START_VIEW);

        DontDestroyOnLoad(gameObject);
    }
Example #10
0
        public static Control GetControl(this Requirement requirement, Dictionary <string, object> meta)
        {
            RequirementType r = (RequirementType)((int)requirement.RequirementType & 0xFF);

            IInit ctrl = null;

            switch (r)
            {
            case RequirementType.Bool:
                ctrl = new Boolean();
                break;

            case RequirementType.String:
                ctrl = new String();
                break;

            case RequirementType.Integer:
                ctrl = new Integer();
                break;

            case RequirementType.Password:
                ctrl = new Password();
                break;

            case RequirementType.FilePath:
                ctrl = new FilePath();
                break;

            case RequirementType.FolderPath:
                ctrl = new FolderPath();
                break;

            case RequirementType.DropDownList:
                ctrl = new DropDownList();
                break;

            case RequirementType.Link:
                ctrl = new Link();
                break;
            }
            if (ctrl != null)
            {
                ctrl.Init(requirement, meta);
            }
            return((Control)ctrl);
        }
Example #11
0
        public static void Register(IInit init)
        {
            try
            {
                var name = init.GetType().FullName;
                if (Ran.Where(t => t == name).Any())
                {
                    return;
                }

                k.Diagnostic.Debug(LOG, null, "Starting {0} dependencies", name);
                init.Init10_Dependencies();
                k.Diagnostic.Debug(LOG, null, "Starting {0} configs", name);
                init.Init20_Config();
                k.Diagnostic.Debug(LOG, null, "Starting {0} threads ", name);
                init.Init50_Threads();
                k.Diagnostic.Debug(LOG, null, "Registred the {0} library", name);
                Ran.Add(name);
            }catch (Exception ex)
            {
                k.Diagnostic.Error(init, ex);
                throw ex;
            }
        }
Example #12
0
        private Page GetView <TVM, TParameter>(TParameter param)
        {
            Type viewType;

            if (!_viewModelPageMapping.TryGetValue(typeof(TVM), out viewType))
            {
                throw new ArgumentException($"could not find view for {typeof(TVM)}");
            }
            var viewModel = _container.Resolve <TVM>();
            // get view ctor with no parameters
            var ctors    = viewType.GetTypeInfo().DeclaredConstructors;
            var viewCtor = viewType.GetTypeInfo().DeclaredConstructors.FirstOrDefault(ct => ct.GetParameters().Length == 0);
            var view     = viewCtor.Invoke(null) as Page;

            view.BindingContext = viewModel;
            IInit <TParameter> init = viewModel as IInit <TParameter>;

            if (init != null)
            {
                init.Init(param);
            }

            return(view);
        }
Example #13
0
 protected override FanInShape <T> Construct(IInit init)
 {
     return(new MergePreferredShape(_secondaryPorts, init));
 }
Example #14
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 /// <returns>TBD</returns>
 protected override FanInShape <TOut> Construct(IInit init)
 {
     return(new FanInShape <T0, T1, TOut>(init));
 }
Example #15
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 public FanInShape(IInit init) : base(init)
 {
     In0 = NewInlet <T0>("in0");
     In1 = NewInlet <T1>("in1");
 }
Example #16
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 public FanOutShape(IInit init) : base(init)
 {
     Out0 = NewOutlet <T0>("out0");
     Out1 = NewOutlet <T1>("out1");
 }
Example #17
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 /// <returns>TBD</returns>
 protected override FanOutShape <TIn> Construct(IInit init)
 {
     return(new FanOutShape <TIn, T0, T1>(init));
 }
Example #18
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="n">TBD</param>
 /// <param name="init">TBD</param>
 public UniformFanOutShape(int n, IInit init) : base(init)
 {
     _n   = n;
     Outs = Enumerable.Range(0, n).Select(i => NewOutlet <TOut>($"out{i}")).ToImmutableList();
 }
Example #19
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 /// <returns>TBD</returns>
 protected override FanOutShape <TIn> Construct(IInit init) => new UniformFanOutShape <TIn, TOut>(_n, init);
Example #20
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 protected FanOutShape(IInit init) : this(init.Inlet, init.Outlets, init.Name)
 {
 }
Example #21
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 /// <returns>TBD</returns>
 protected abstract FanOutShape <TIn> Construct(IInit init);
Example #22
0
 public static void Starting(IInit init)
 {
 }
Example #23
0
            public MergePreferredShape(int secondaryPorts, IInit init) : base(secondaryPorts, init)
            {
                _secondaryPorts = secondaryPorts;

                Preferred = NewInlet <T>("preferred");
            }
Example #24
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 /// <returns>TBD</returns>
 protected abstract FanInShape <TOut> Construct(IInit init);
Example #25
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="n">TBD</param>
 /// <param name="init">TBD</param>
 public UniformFanInShape(int n, IInit init) : base(init)
 {
     N   = n;
     Ins = Enumerable.Range(0, n).Select(i => NewInlet <TIn>($"in{i}")).ToImmutableList();
 }
Example #26
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="init">TBD</param>
 /// <returns>TBD</returns>
 protected override FanInShape <TOut> Construct(IInit init) => new UniformFanInShape <TIn, TOut>(N, init);