private void Start()
    {
        OperatorContext = new OperatorContext(timeLimit)
        {
            OperatorController = this
        };

        var pencilPrefab = DataManager.Instance.PrefabPlayerPencil;
        var layerId      = 0;

        if (operatorModel.eOperator == OperatorModel.EOperator.Player)
        {
            OperatorManager.Instance.PlayerController = this;
            pencilPrefab = DataManager.Instance.PrefabPlayerPencil;
            layerId      = 8;
        }
        else if (operatorModel.eOperator == OperatorModel.EOperator.Computer)
        {
            OperatorManager.Instance.ComputerController = this;
            pencilPrefab = DataManager.Instance.PrefabComputerPencil;
            layerId      = 9;
        }

        var pen = Instantiate(pencilPrefab, pencilSpawnPos.position, Quaternion.identity, pencilSpawnPos);

        operatorModel.pencil = pen.GetComponent <Pencil>();
        pen.layer            = layerId;

        BattleManager.Instance.ControllerList.Add(this);
    }
    public OperatorContext @operator()
    {
        OperatorContext _localctx = new OperatorContext(Context, State);

        EnterRule(_localctx, 4, RULE_operator);
        int _la;

        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 30;
                _la   = TokenStream.LA(1);
                if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << GreaterThan) | (1L << GreaterThanEqual) | (1L << LessThan) | (1L << LessThanEqual) | (1L << Equal))) != 0)))
                {
                    ErrorHandler.RecoverInline(this);
                }
                else
                {
                    ErrorHandler.ReportMatch(this);
                    Consume();
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
    public OperatorContext @operator()
    {
        OperatorContext _localctx = new OperatorContext(Context, State);

        EnterRule(_localctx, 12, RULE_operator);
        int _la;

        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 62;
                _la   = TokenStream.LA(1);
                if (!(_la == T__2 || _la == T__3))
                {
                    ErrorHandler.RecoverInline(this);
                }
                else
                {
                    ErrorHandler.ReportMatch(this);
                    Consume();
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
        public void OperatorContext_Simple()
        {
            var ur = new Uri("bing://foo/bar");

            using var ph = PhysicalScheduler.Create();
            using var sh = new LogicalScheduler(ph);

            var tc = new TraceSource("foo");
            var ee = new Environment();

            var ctx = new OperatorContext(ur, sh, tc, ee);

            Assert.AreSame(ur, ctx.InstanceId);
            Assert.AreSame(sh, ctx.Scheduler);
            Assert.AreSame(tc, ctx.TraceSource);
            Assert.AreSame(ee, ctx.ExecutionEnvironment);

            Assert.IsFalse(ctx.TryGetElement <string>("foo", out var s) && s == null);
        }
Exemple #5
0
 public GenericRepository(OperatorContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }