Inheritance: MonoBehaviour
コード例 #1
0
 void Awake()
 {
     instance    = this;
     Audio       = GameObject.Find("Audio").GetComponent <AudioSource>();
     config      = gameObject.GetComponent <Level_Settings>();
     gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
 }
コード例 #2
0
    /// <summary>
    /// シーン遷移用コルーチン
    /// </summary>
    /// <param name='scene'>シーン名</param>
    /// <param name='interval'>暗転にかかる時間(秒)</param>
    /// <param name="rc">変更したいRootController.</param>
    private IEnumerator TransScene(string scene, float interval, RootController rc = null)
    {
        //だんだん暗く
        this.isFading = true;
        float time = 0;

        while (time <= interval)
        {
            this.fadeAlpha = Mathf.Lerp(0f, 1f, time / interval);
            time          += Time.deltaTime;
            yield return(0);
        }

        //シーン切替
        SceneManager.LoadScene(scene);
        // Rootのmodeを変更する
        if (rc != null)
        {
            PlayerRoot.Instance.ChangeMode(rc);
        }

        //だんだん明るく
        time = 0;
        while (time <= interval)
        {
            this.fadeAlpha = Mathf.Lerp(1f, 0f, time / interval);
            time          += Time.deltaTime;
            yield return(0);
        }

        this.isFading = false;
        yield break;
    }
コード例 #3
0
        public void RootController_Get_WillReturnString()
        {
            var controller = new RootController();
            var message    = controller.Get();

            Assert.AreEqual("API is ready to receive requests", message);
        }
コード例 #4
0
 public void Init(IAdministratorController controller)
 {
     administratorController = controller;
     orderBoard            = administratorController.GetOrderBoardController();
     environmentController = RootController.GetControllerByType <IEnvironmentController>();
     cookTablePlaces       = environmentController.GetCookTablePlaces();
 }
コード例 #5
0
        public async Task SiUsuarioNoEsAdmin_Obtenemos2Links_UsandoMoq()
        {
            // Preparación
            var mockAuthorizationService = new Mock <IAuthorizationService>();

            mockAuthorizationService.Setup(x => x.AuthorizeAsync(
                                               It.IsAny <ClaimsPrincipal>(),
                                               It.IsAny <object>(),
                                               It.IsAny <IEnumerable <IAuthorizationRequirement> >()
                                               )).Returns(Task.FromResult(AuthorizationResult.Failed()));

            mockAuthorizationService.Setup(x => x.AuthorizeAsync(
                                               It.IsAny <ClaimsPrincipal>(),
                                               It.IsAny <object>(),
                                               It.IsAny <string>()
                                               )).Returns(Task.FromResult(AuthorizationResult.Failed()));

            var mockURLHelper = new Mock <IUrlHelper>();

            mockURLHelper.Setup(x =>
                                x.Link(It.IsAny <string>(),
                                       It.IsAny <object>()))
            .Returns(string.Empty);

            var rootController = new RootController(mockAuthorizationService.Object);

            rootController.Url = mockURLHelper.Object;

            // Ejecución
            var resultado = await rootController.Get();

            // Verificación
            Assert.AreEqual(2, resultado.Value.Count());
        }
コード例 #6
0
        public ArenaBoardLayer(ArenaDashboardLayer dashboard, RootController controller, BE.Game game)
        {
            this.controller = controller;
            this.rows       = game.Arena.Height;
            this.columns    = game.Arena.Weight;
            this.cells      = new Cell[rows, columns];
            this.Location   = new Point(200, 300);
            this.Size       = new Size(columns * cellWeight, rows * cellHeight);
            this.Visible    = true;

            for (int rowIndex = 0; rowIndex < rows; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < columns; columnIndex++)
                {
                    int positionX = (columnIndex * cellWeight);
                    int positionY = (rowIndex * cellHeight);

                    cells[rowIndex, columnIndex] = new Cell(
                        controller,
                        rowIndex, columnIndex, game.Id,
                        new Point(positionX, positionY),
                        new Size(cellWeight, cellHeight));
                    cells[rowIndex, columnIndex].PressCell += dashboard.OnPressCell;
                    this.Controls.Add(cells[rowIndex, columnIndex]);
                }
            }
        }
コード例 #7
0
ファイル: UnitTest.cs プロジェクト: salehatrq/SOEN341
        public void RootController_ShouldReturnPlaceholder()
        {
            var controller = new RootController(mockILoggerRootController());
            var result     = controller.Get() as ContentResult;

            Assert.Equal("This is a placeholder response for RootController", result.Content);
        }
コード例 #8
0
        private string HandleRootRoute()
        {
            _logger.LogInformation($"Documentation Route Activated for Root route");

            var controller = new RootController(_configuration);

            return(controller.GetMarkup());
        }
コード例 #9
0
 public void UpdateImportedControllers()
 {
     if (RootController == null)
     {
         return;
     }
     RootController.VisitAllNodes(c => c.ChildsCollection, ReadControllerTags);
 }
コード例 #10
0
ファイル: PlayerRoot.cs プロジェクト: caesar0060/Amicitia
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(this.gameObject);
     //-----test
     controller = WalkMode.Instance;
     controller.Enter(this);
     //---------
 }
コード例 #11
0
ファイル: HostingTestCase.cs プロジェクト: zhoufoxcn/MonoRail
        public void HttpResult_WritesStatusCode()
        {
            var controller = new RootController();

            controller.ReplyWith304().Should().BeOfType <HttpResult>();

            var req   = WebRequest.CreateDefault(new Uri(BuildUrl("/root/replywith304")));
            var reply = (HttpWebResponse)req.GetResponse();
        }
コード例 #12
0
 public FriendshipController(AccountEntry accountEntry, AccountProjection accountProjection, ChessgameProjection gameProjection,
                             FriendshipProjection friendshipProjection, RootController rootController)
 {
     AccountEntry         = accountEntry;
     AccountProjection    = accountProjection;
     GameProjection       = gameProjection;
     FriendshipProjection = friendshipProjection;
     RenderCurrentcontent = RenderOverview;
 }
コード例 #13
0
        private void Start()
        {
            RootController.OnModuleAreReady -= Start;

            environmentController = RootController.GetControllerByType <IEnvironmentController>();
            administrator         = new GameObject("Administrator").AddComponent <Administrator>();
            administrator.Init(this);

            administrator.GetTableHall();
        }
コード例 #14
0
 void Awake()
 {
     _instance        = this;
     _stateController = new StateBase();
     _stateController.Start();
     _curState     = _stateController.State;
     _audio        = GameObject.Find("Audio").GetComponent <AudioSource>();
     players       = new List <Player>();
     _winnerPlayer = null;
 }
コード例 #15
0
        // ========================================
        // constructor
        // ========================================
        internal RootEditor(EditorCanvas owner) : base()
        {
            _owner = owner;

            _Controller = new RootController();
            _Figure     = _owner._PrimaryLayer;
            Model       = new object(); /// dummy

            Figure.Layout = new StackLayout();
        }
コード例 #16
0
ファイル: Cell.cs プロジェクト: mcabezas/superminesweeper
 public Cell(RootController controller, int row, int column, int gameId, Point location, Size size)
 {
     this.controller = controller;
     this.row        = row;
     this.column     = column;
     this.gameId     = gameId;
     this.Location   = location;
     this.Size       = size;
     this.Visible    = true;
 }
コード例 #17
0
        public void GetRequestReturns200StatusCodeIfSuccessful()
        {
            var userRepository = new UserRepository();
            var userService    = new UserService(userRepository);
            var controller     = new RootController(userService);

            var response = controller.HandleGetRequest();
            var actual   = response.StatusCode;

            Assert.Equal(200, actual);
        }
コード例 #18
0
 public RootForm()
 {
     InitializeComponent();
     Controller = new RootController(this);
     luffarRootControl1.Controller      = new GameController(luffarRootControl1);
     luffarRootControl1.Status          = this.statusLabel1;
     erpIntegration1.StatusLbl          = this.statusLabel1;
     openFileShowPlayers1.StatusLbl     = this.statusLabel1;
     erpIntegration1.WebController      = new WebServiceController1();
     openFileShowPlayers1.WebController = new WebServiceController1();
 }
コード例 #19
0
ファイル: TestGame.cs プロジェクト: vovchara/sestruhaBorcuha
        protected override async void OnInitialize()
        {
            await SwitchContext.To(GameThreadEnvironment);

            //AddFpsPanel();

            _rootNode.Initialize();
            AddComponent(_rootNode);

            _rootController = new RootController(this, _rootNode);
            _rootController.Start();
        }
コード例 #20
0
        public void DeleteRequestReturns405StatusCode()
        {
            var userRepository = new UserRepository();
            var userService    = new UserService(userRepository);
            var request        = new Request("/", "DELETE", "test");
            var controller     = new RootController(userService);

            var response = controller.HandlePostRequest(request.Body);
            var actual   = response.StatusCode;

            Assert.Equal(405, actual);
        }
コード例 #21
0
ファイル: HostingTestCase.cs プロジェクト: zhoufoxcn/MonoRail
        public void OutputWriterResult_WritesBack()
        {
            var controller = new RootController();

            controller.Index().Should().BeOfType <OutputWriterResult>();

            var req   = WebRequest.CreateDefault(new Uri(BuildUrl("/")));
            var reply = (HttpWebResponse)req.GetResponse();

            reply.StatusCode.Should().Be(HttpStatusCode.OK);
            reply.ContentType.Should().Be("text/html");
            new StreamReader(reply.GetResponseStream()).ReadToEnd().Should().Be("Howdy");
        }
コード例 #22
0
    private void OnIntroStopped(PlayableDirector obj)
    {
        startSequence.stopped -= OnIntroStopped;
        Debug.Log("Intro Stopped");

        if (rootController != null)
        {
            rootController.gameObject.SetActive(true);
        }
        this.Player = rootController;

        startSequence.gameObject.SetActive(false);
        SetState(GameState.Active);
    }
コード例 #23
0
        public void Init()
        {
            identity          = Substitute.For <IIdentity>();
            principal         = Substitute.For <IPrincipal>();
            principalProvider = Substitute.For <IPrincipalProvider>();

            principal.Identity.Returns(identity);
            principalProvider.GetCurrent().Returns(principal);

            controller = new RootController(principalProvider)
            {
                Logger = Substitute.For <ILogger>()
            };
        }
コード例 #24
0
ファイル: PlayerRoot.cs プロジェクト: caesar0060/Amicitia
 /// <summary>
 /// モードを変更する
 /// </summary>
 /// <param name="newMode">New mode.</param>
 public void ChangeMode(RootController newMode)
 {
     if (controller != newMode)
     {
         controller.Exit(this);
         previous_controller = controller;
         controller          = newMode;
         controller.Enter(this);
     }
     else
     {
         Debug.LogError("same");
     }
 }
コード例 #25
0
        public ArenaView(RootController controller, Game game, List <Player> players)
        {
            this.Location = new Point(0, 0);
            this.Size     = new Size(1000, 1000);
            this.Visible  = true;

            this.dashboard = new ArenaDashboardLayer();
            this.Controls.Add(dashboard);

            this.board = new ArenaBoardLayer(dashboard, controller, game);
            this.Controls.Add(board);

            this.background = new ArenaBackgroundLayer();
            this.Controls.Add(background);
        }
コード例 #26
0
        public void GetRequestReturnsDefaultGreetingResponse()
        {
            var userRepository = new UserRepository();
            var userService    = new UserService(userRepository);
            var controller     = new RootController(userService);

            var time     = DateTime.Now.ToString("%h:mm tt");
            var date     = DateTime.Now.ToString("%d MMMM yyyy");
            var expected = $"Hello Martyna - the time on the server is {time} on {date}";

            var response = controller.HandleGetRequest();
            var actual   = response.Body;

            Assert.Equal(expected, actual);
        }
コード例 #27
0
        public async void GetUsersReturnsViewResultListOrItemOrNotFound()
        {
            var id = new Guid("2d65fadd-cdfc-4a67-9e85-2b200bd269da");

            //var id = Guid.Empty;
            _mock.Setup(repo => repo.GetUsers(id)).Returns(_repo.GetTestUsers(id));

            var controller = new RootController(_mock.Object);
            var result     = await controller.Index(id);

            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(viewResult.Model);
            Assert.Equal(viewResult.Model.ToString().GetHashCode(),
                         _repo.GetTestUsers(id).ToString().GetHashCode());
        }
コード例 #28
0
        private void Start()
        {
            _controller = GameObjectFactory.Get <RootController>();
            _dispatcher = GameObjectFactory.Get <Dispatcher>();
            _dispatcher.Register(_controller);

            _systems = new List <SystemBase>
            {
                GameObjectFactory.Get <ProjectileSystem>(),
                GameObjectFactory.Get <UnitSystem>()
            };

            _systems.ForEach(_dispatcher.Register);

            Debug.Log(LogExtension.Bold("[Root][Start] Complete"));
        }
コード例 #29
0
    /// <summary>
    /// 会話用のUIを出す
    /// </summary>
    /// <param name="interval">必要時間.</param>
    /// <param name="rc">変更したいRootController.</param>
    public IEnumerator ReadyTalkUI(float interval, RootController rc)
    {
        onTalk         = true;
        Time.timeScale = 0;
        PlayerRoot.Instance.ChangeMode(rc);
        float time = 0;

        while (time <= interval)
        {
            color.a          = Mathf.Lerp(0f, 0.6f, (time / interval));
            blackImage.color = color;
            time            += Time.unscaledDeltaTime;
            yield return(0);
        }
        yield break;
    }
コード例 #30
0
        public async void GetStoragesReturnsViewResultListOrItemOrNotFound()
        {
            var id = new Guid("11687780-3255-4B10-85A6-8A562E5DAD2F");

            //var id = Guid.Empty;
            _mock.Setup(repo => repo.GetStorages(id)).Returns(_repo.GetTestStorages(id));

            var controller = new RootController(_mock.Object);
            var result     = await controller.Storages(id);

            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(viewResult.Model);
            Assert.Equal(viewResult.Model.ToString().GetHashCode(),
                         _repo.GetTestStorages(id).ToString().GetHashCode());
        }
コード例 #31
0
ファイル: Root.cs プロジェクト: jesliwang/xy
 // Use this for initialization
 void Start()
 {
     mController = new EntranceController ();
     mController.Init();
 }