Ejemplo n.º 1
0
        public void when_execute()
        {
            Contexts            contexts        = null;
            Mock <ITimeService> timeServiceMock = null;
            TimeSystem          timeSystem      = null;

            before = () =>
            {
                contexts        = new Contexts();
                timeServiceMock = new Mock <ITimeService>();
                timeSystem      = new TimeSystem(contexts, timeServiceMock.Object);
                timeSystem.Initialize();
            };

            new Each <float, float>
            {
                { 1f, 1f },
                { 2f, 2f },
                { 1.5f, 1.5f }
            }.Do((given, expected) =>
            {
                it["Delta time component must be {0}".With(expected)] = () =>
                {
                    timeServiceMock.SetupGet(x => x.DeltaTime).Returns(given);
                    timeSystem.Execute();
                    contexts.time.deltaTime.value.should_be(expected);
                };
            });
        }
Ejemplo n.º 2
0
    // Use this for initialization
    void Awake()
    {
        timeSystem  = TimeSystem.GetInstance();
        plantedTime = timeSystem.GetTime();

        SetPhaseIndex(0);
    }
Ejemplo n.º 3
0
        private void CheckTimeout()
        {
            float curTime = TimeSystem.GetSecondsSinceStartup();

            if (curTime - m_lastCheckTimeoutStamp >= 5)
            {
                m_lastCheckTimeoutStamp = curTime;

                var list = m_listRspListener.ToArray();
                for (int i = 0; i < list.Length; i++)
                {
                    var   helper = list[i];
                    float dt     = curTime - helper.timestamp;
                    if (dt >= helper.timeout)
                    {
                        m_listRspListener.Remove(helper.index);
                        if (helper.onErr != null)
                        {
                            helper.onErr.DynamicInvoke(NetErrorCode.Timeout);
                        }

                        Debuger.LogWarning("cmd:{0} Is Timeout!", helper.cmd);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        protected override void OnCreate()
        {
            base.OnCreate();

            m_Canvas                      = World.GetOrCreateSystem <ClientCanvasSystem>().CreateCanvas(out _, "UIDrumCanvas", defaultAddRaycaster: false);
            m_Canvas.renderMode           = RenderMode.WorldSpace;
            m_Canvas.transform.localScale = new Vector3() * 0.05f;

            m_CameraQuery = GetEntityQuery(typeof(GameCamera));

            var address = AddressBuilder.Client()
                          .Folder("Models")
                          .Folder("InGame")
                          .Folder("UIDrum")
                          .GetAsset("UIDrumPressure");

            for (var i = 1; i <= 4; i++)
            {
                DrumPresentationPools[i] = new AsyncAssetPool <GameObject>(address);
                DrumBackendPools[i]      = new AssetPool <GameObject>(CreateBackendDrumGameObject, World);
                DrumVariantCount[i]      = 0;
            }

            timeSystem = World.GetExistingSystem <TimeSystem>();

            m_EngineQuery = GetEntityQuery(typeof(RhythmEngineDescription), typeof(Relative <PlayerDescription>));
        }
Ejemplo n.º 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (latencies_ != null)
            {
                hash ^= Latencies.GetHashCode();
            }
            if (TimeElapsed != 0D)
            {
                hash ^= TimeElapsed.GetHashCode();
            }
            if (TimeUser != 0D)
            {
                hash ^= TimeUser.GetHashCode();
            }
            if (TimeSystem != 0D)
            {
                hash ^= TimeSystem.GetHashCode();
            }
            hash ^= requestResults_.GetHashCode();
            if (CqPollCount != 0UL)
            {
                hash ^= CqPollCount.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 6
0
    void Start()
    {
        inputHandler = gameObject.GetComponent <InputHandler>();
        TimeSystem.GetTimeSystem().AddTimer(this);
        uiModule = GiraffeSystem.FindModule <UIModule>();

        playerCamera = gameObject.GetComponentInChildren <RaceCamera>();
        rigidbody    = gameObject.GetComponentInChildren <Rigidbody>();

        var root = GameObject.Find("Root");

        indicator = root.FindChildByName("Billboard").GetComponent <EmoticonIndicator>();
        ghost     = root.FindChildByName("Ghost");

        //inputHandler.OnUpKey = () => { AddForce(Vector3.back); };
        inputHandler.OnDownKey     = () => { AddForce(Vector3.forward); };
        inputHandler.OnLeftKey     = () => { AddForce(Vector3.left); };
        inputHandler.OnRightKey    = () => { AddForce(Vector3.right); };
        inputHandler.OnInputFinish = ProcessForce;
        inputHandler.OnSpaceDown   = TryBooster;

        // audio
        dragging = gameObject.FindChildByName("Dragging").GetComponent <AudioSource>();
        booster  = gameObject.FindChildByName("Booster").GetComponent <AudioSource>();
    }
Ejemplo n.º 7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TimeElapsed != 0D)
            {
                hash ^= TimeElapsed.GetHashCode();
            }
            if (TimeUser != 0D)
            {
                hash ^= TimeUser.GetHashCode();
            }
            if (TimeSystem != 0D)
            {
                hash ^= TimeSystem.GetHashCode();
            }
            if (TotalCpuTime != 0UL)
            {
                hash ^= TotalCpuTime.GetHashCode();
            }
            if (IdleCpuTime != 0UL)
            {
                hash ^= IdleCpuTime.GetHashCode();
            }
            if (CqPollCount != 0UL)
            {
                hash ^= CqPollCount.GetHashCode();
            }
            if (coreStats_ != null)
            {
                hash ^= CoreStats.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 8
0
        public mgCategory()
        {
            InitializeComponent();
            LoadDataGid();

            TimeSystem.Start();
        }
Ejemplo n.º 9
0
        public void Active(IPEndPoint remoteEndPoint)
        {
            m_lastActiveTime = (int)TimeSystem.GetSecondsSinceStartup();
            m_active         = true;

            this.remoteEndPoint = remoteEndPoint as IPEndPoint;
        }
Ejemplo n.º 10
0
    //冒泡排序3
    public static void BubSortV3(int[] arr)
    {
        TimeSystem.TickStart();
        int  sweapCount   = 0;
        int  compareCount = 0;
        int  sweapIndex   = 0;
        bool chageFlag;
        int  len = arr.Length - 1;

        for (int i = 0; i < arr.Length - 1; i++)
        {
            chageFlag = false;
            for (int j = 0; j < len; j++)
            {
                compareCount++;
                if (arr[j] > arr[j + 1])
                {
                    Sweap(arr, j, j + 1);
                    sweapCount++;
                    sweapIndex = j;
                    chageFlag  = true;
                }
            }
            len = sweapIndex;

            if (!chageFlag)
            {
                break;
            }
        }
        TimeSystem.TickEnd();
        LogArr(arr);
        Debug.LogError(compareCount + " " + sweapCount);
    }
Ejemplo n.º 11
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TimeElapsed != 0D)
            {
                hash ^= TimeElapsed.GetHashCode();
            }
            if (TimeUser != 0D)
            {
                hash ^= TimeUser.GetHashCode();
            }
            if (TimeSystem != 0D)
            {
                hash ^= TimeSystem.GetHashCode();
            }
            if (TotalCpuTime != 0UL)
            {
                hash ^= TotalCpuTime.GetHashCode();
            }
            if (IdleCpuTime != 0UL)
            {
                hash ^= IdleCpuTime.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 12
0
    public void SetInfo()
    {
        ///设置已签到的对象
        foreach (var data in PlayerData.Signs)
        {
            GameObject signItem = singIned[data.signId.ToString()];
            ResourceMgr.CreateUIPrefab("GUIs/SignIn/siged", signItem.transform);
            Utility.FindChild <Button>(signItem.transform, "icon").interactable = false;
        }

        ///设置过期对象
        for (int i = 0; i < TimeSystem.GetCurrentDay - 1; i++)
        {
            GameObject signItem = signs[i];
            if (signItem.transform.childCount == 3)
            {
                ResourceMgr.CreateUIPrefab("GUIs/SignIn/passed", signs[i].transform);
                Utility.FindChild <Button>(signItem.transform, "icon").interactable = false;
            }
        }

        GameObject today = signs[TimeSystem.GetCurrentDay - 1];

        ResourceMgr.CreateUIPrefab("GUIs/SignIn/SignInSelect", today.transform);

        for (int i = TimeSystem.GetCurrentDay; i < TimeSystem.DaysInMonth(); i++)
        {
            GameObject signItem = signs[i];
            Utility.FindChild <Button>(signItem.transform, "icon").interactable = false;
        }
    }
Ejemplo n.º 13
0
    //选择排序 不稳定的
    public static void SelSort(int[] arr)
    {
        TimeSystem.TickStart();
        int changeTimes = 0;
        int min         = 0;
        int loopCount   = 0;

        for (int i = 0; i < arr.Length - 1; i++)
        {
            //将第一个未排序的下标记录
            min = i;
            for (int j = i + 1; j < arr.Length; j++)
            {
                loopCount++;
                //如果当前元素小于最小值,则将当前元素设为最小值
                if (arr[j] < arr[min])
                {
                    min = j;
                }
            }
            //如果min有修改过,则说明第一个未排序的数不是最小的,需要和最小的交换位置
            if (min != i)
            {
                Sweap(arr, i, min);
                changeTimes++;
            }
        }
        TimeSystem.TickEnd();
        //LogArr(arr);
        Debug.LogError("changeTimes : " + changeTimes + " loopCount:" + loopCount);
    }
Ejemplo n.º 14
0
 // Update is called once per frame
 void Update()
 {
     if (gameObject.activeSelf && tabMenu != null)
     {
         resetLayout();
         if (Time.timeScale != 0.0f)
         {
             Time.timeScale = 0.0f;
             WorldInteraction.worldInteraction.stopEveryone(true);
         }
         if (Input.GetKeyDown(KeyCode.Tab) || Input.GetKeyDown(KeyCode.Escape))
         {
             if (!defaultPanel.activeSelf)
             {
                 showPanel(TabPanelType.DefaultPanel, true);
             }
             else
             {
                 gameObject.SetActive(false);
                 Time.timeScale = 1.0f;
                 //TroopManagement.troopManagement.leaveManagement();
                 //InventoryManagement.inventoryManagement.leaveManagement();
             }
         }
         if (closing)
         {
             if (animator.GetCurrentAnimatorStateInfo(0).IsName("Default"))
             {
                 gameObject.SetActive(false);
                 Time.timeScale = 1.0f;
             }
         }
     }
     timeDisplay.text = TimeSystem.getTimeDisplay();
 }
Ejemplo n.º 15
0
 public void Start()
 {
     days = TimeSystem.DaysInMonth();
     CreateSignItems();
     Refresh();
     LunaMessage.AddMsgHandler((int)MessageId.ESignInRes, OnSignRes);
 }
Ejemplo n.º 16
0
    public static string WeekDayToString(DayOfWeek dayOfWeek, TimeSystem timeSystem = TimeSystem.System24)
    {
        DayOfWeek day = dayOfWeek;

        switch (day)
        {
        case DayOfWeek.Monday:
            return(timeSystem == TimeSystem.Twelve ? "月曜" : "星期一");

        case DayOfWeek.Tuesday:
            return(timeSystem == TimeSystem.Twelve ? "金曜" : "星期二");

        case DayOfWeek.Wednesday:
            return(timeSystem == TimeSystem.Twelve ? "木曜" : "星期三");

        case DayOfWeek.Thursday:
            return(timeSystem == TimeSystem.Twelve ? "水曜" : "星期四");

        case DayOfWeek.Friday:
            return(timeSystem == TimeSystem.Twelve ? "火曜" : "星期五");

        case DayOfWeek.Saturday:
            return(timeSystem == TimeSystem.Twelve ? "土曜" : "星期六");

        case DayOfWeek.Sunday:
        default:
            return(timeSystem == TimeSystem.Twelve ? "日曜" : "星期日");
        }
    }
Ejemplo n.º 17
0
    // Start is called before the first frame update
    void Start()
    {
        // Find the time system that tracks time during the scene
        _timeSystem = FindObjectOfType <TimeSystem>();
        if (_timeSystem == null)
        {
            Debug.LogError("The scene is missing a TimeSystem");
            _canUseScript = false;
        }

        // Check if this hitbox has a result script
        if (_boxResult == null)
        {
            Debug.LogError(name + " has no box attached to it");
            _canUseScript = false;
        }
        else
        {
            _boxResult.gameObject.SetActive(false);
        }

        // Make sure that the hitbox has a starting and ending position
        if (_positionList.Count <= 0)
        {
            Debug.LogError(name + " has no positions attached to it");
            _canUseScript = false;
        }
    }
Ejemplo n.º 18
0
    private void Start()
    {
        pointSystem = PointSystem.Instance;
        timeSystem  = TimeSystem.Instance;

        // Make sure timeSystem has started timer
        StartCoroutine(GetStartTime());
    }
Ejemplo n.º 19
0
 void LoadEveryThings()
 {
     LoadTableFood();
     LoadCategory();
     TimeSystem.Start(); // Hiển thị thời gian
     LoadNameOfStaff();
     LoadComboSwitchTable();
 }
Ejemplo n.º 20
0
 public void StartHint()
 {
     if (!isActive && !(hintType == HintType.Dash && !GameInput.Hint_IsLilium))
     {
         TimeSystem.Delay(delay, t => { Show(); });
         isActive = true;
     }
 }
Ejemplo n.º 21
0
 private void Initialize()
 {
     CameraMaster.MovedToPivot  += DisplayMenu;
     TimeSystem.EndedTransition += EndTransitionTime;
     CanvasGroup.alpha           = 0;
     _arrow       = transform.GetChild(transform.childCount - 1);
     _timeManager = GetComponentInParent <TimeSystem>();
 }
Ejemplo n.º 22
0
 // Use this for initialization
 void Awake()
 {
     if (instance != null)
     {
         return;
     }
     instance = this;
 }
Ejemplo n.º 23
0
    void Start()
    {
        GameObject door = GameObject.FindGameObjectWithTag("Door");

        tSystem = door.GetComponent <TimeSystem>();
        nSystem = gameObject.GetComponent <NourishmentSystem>();
        pInfo   = FindObjectOfType <Canvas>();
        player  = FindObjectOfType <Player>();
    }
Ejemplo n.º 24
0
        private void SimulateTimeSystemForFrames(TimeSystem timeSystem, int frameCount, float fps = 60.0f)
        {
            var spf = 1.0f / fps;

            for (int i = 0; i < frameCount; i++)
            {
                timeSystem.Simulate(spf);
            }
        }
Ejemplo n.º 25
0
 private void Start()
 {
     temposystem       = FindObjectOfType(typeof(TimeSystem)) as TimeSystem;
     interacao         = FindObjectOfType(typeof(Interacao)) as Interacao;
     quickMenu         = FindObjectOfType(typeof(QuickMenu)) as QuickMenu;
     inventarioSeletor = FindObjectOfType(typeof(Inventario)) as Inventario;
     dialogo           = FindObjectOfType(typeof(Dialogos)) as Dialogos;
     podeAndar         = true;
 }
Ejemplo n.º 26
0
 // now if we forget to put a TimeSystem in the scene, we can still
 // call this and one will be dynamically created
 public static TimeSystem GetInstance()
 {
     if (instance == null)
     {
         instance      = new GameObject().AddComponent <TimeSystem>();
         instance.name = "TimeSystem";
     }
     return(instance);
 }
Ejemplo n.º 27
0
 protected internal override void RecieveData(IDataReciever reciever)
 {
     if (!wasTriggered)
     {
         wasTriggered = true;
         onStartBreaking?.Invoke();
         TimeSystem.Delay(delayTime, t => Break());
     }
 }
Ejemplo n.º 28
0
 void Start()
 {
     // Find the time system
     _timeSystem = FindObjectOfType <TimeSystem>();
     if (_timeSystem == null)
     {
         Debug.LogError("The scene is missing a TimeSystem");
         _canUseScript = false;
     }
 }
Ejemplo n.º 29
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Debug.Log("Coll");
     if (!collision.gameObject.GetComponent <PlayerMovement>().Equals(null))
     {
         Debug.Log("Move to " + cameraFocalPoint.position);
         Camera.Instance.MoveCamera(cameraFocalPoint.position);
         TimeSystem.IncrementTime();
     }
 }
Ejemplo n.º 30
0
 public virtual void Start()
 {
     // Find the time script that controls how long the scene will take
     _timeSystem = FindObjectOfType <TimeSystem>();
     if (_timeSystem == null)
     {
         Debug.LogError("The scene is missing a TimeSystem");
         _canUseScript = false;
     }
 }
Ejemplo n.º 31
0
        public Window()
            : base(640, 480, GraphicsMode.Default, "L2D")
        {
            Path resources = Path.ProcessFile.Parent.Parent.Parent.Parent["Resources"];
            Path shaders = resources["Shaders"];

            this.VSync = VSyncMode.Off;

            //GL.Enable(EnableCap.ColorArray);
            GL.Enable(EnableCap.VertexArray);
            GL.Enable(EnableCap.NormalArray);
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.TextureCoordArray);
			
			
            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);
            //GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);

            this.WindowState = WindowState.Maximized;

            Blur b = new Blur(shaders);
            VisualSystem vissys = new VisualSystem(shaders);
            TimeSystem tsys = new TimeSystem();

            PhysicsSystem psys = new PhysicsSystem();
            this._World = new World(vissys, tsys, psys);

            

            // Make it midday
            tsys.Offset = tsys.SecondsPerDay / 2.0;
#if SHADERS
            this._World.Add(Atmosphere.MakeEntity(shaders, AtmosphereOptions.DefaultEarth, AtmosphereQualityOptions.Default));
			this._World.Add(new Sun(37.3 * Math.PI / 180.0 /* LOL my house */));
#endif
            this._World.Add(new GroundTest(resources, new Vector2d(1.0, 1.0)));
            this._World.Add(new PhysDuck(resources));
            
            vissys.Setup();
            vissys.SetSize(this.Width, this.Height);
 
			this._World.Add(this._Player = new Player(this._World.Physics.PhysWorld));
			
			this.Keyboard.KeyDown += delegate(object sender, KeyboardKeyEventArgs e)
            {
                if (e.Key == Key.Q) this._TimeRate *= 2.0;
                if (e.Key == Key.E) this._TimeRate *= 0.5;
            };
            this._TimeRate = 1.0;
        }
Ejemplo n.º 32
0
 // Use this for initialization
 void Awake()
 {
     m_TimeSystem = new TimeSystem();
     m_RitualManager = new RitualManager();
 }