Example #1
0
        void HandleUITimeRequest(UITimeRequest packet)
        {
            UITime response = new UITime();

            response.Time = (uint)Time.UnixTime;
            SendPacket(response);
        }
Example #2
0
    static void EndGame()
    {
        if (Schedule)
        {
            Schedule.StopTimer();
            Schedule.Delay(() =>
            {
                Cursor.visible = true;
                UIOver.gameObject.SetActive(true);
                UITime.UpdateTime2(0);
                var lastTime = PlayerPrefs.GetFloat("LastTime");
                PlayerPrefs.SetFloat("LastTime", Schedule.Current);


                string v  = "Get Best Score \n" + "Score: {0}";
                string v2 = "NO ooooooooo \n" + "Last Score: {0}";
                Debug.Log(lastTime + "  " + Schedule.Current);
                if (Schedule.Current > lastTime)
                {
                    UIOver.SetText(string.Format(v, Schedule.Current.ToString("0.00")));
                }
                else
                {
                    UIOver.SetText(string.Format(v2, lastTime.ToString("0.00")));
                }
            }, 0.05f);
        }
    }
Example #3
0
 public override void Awake()
 {
     base.Awake();
     if (uITime == null)
     {
         uITime = this;
     }
     Name = "Time";
 }
Example #4
0
        public void UpdateLayout()
        {
            double curTop = 0;

            foreach (UIElement UITime in this.UICalendar.Children)
            {
                if (UITime is UITime)
                {
                    UITime uiT = UITime as UITime;
                    uiT.setTop(curTop);
                    curTop += uiT.Height;
                }
            }
            this.UICalendar.Height = curTop;
        }
 // Use this for initialization
 void Start()
 {
     GM = GameObject.Find ("GM");
     TimeUI = GameObject.Find ("TimeUI");
     if (TimeUI != null) {//If is exists
         ui = TimeUI.GetComponent<UITime> ();
     }
     Player = GameObject.Find ("Player");
     GetComponent<Renderer>().material.color = myColour;
     interaction = Player.GetComponent<Interaction> ();
     Background = GameObject.Find ("Quad");
     colour = Background.GetComponent<Colour> ();
     colour.Changecolour (Level-1);
     Level = Application.loadedLevel;
 }
Example #6
0
 public void Clear()
 {
     foreach (UIElement UIE in this.UICalendar.Children)
     {
         if (UIE is UITime)
         {
             UITime tmp = UIE as UITime;
             tmp.Clear();
         }
     }
     if (this.Groups != null)
     {
         foreach (GroupEvent gE in this.Groups)
         {
             gE.Clear();
         }
     }
 }
Example #7
0
 public void LoadUI()
 {
     this.Clear();
     GroupEvent.ExpansionIndex = new List <int>();
     if (this.Events == null)
     {
         return;
     }
     foreach (Event e in this.Events)
     {
         if (e.loop)
         {
             e.Begin = e.Begin.setDate(this.curDateView.Date);
             e.End   = e.End.setDate(this.curDateView.Date);
         }
         if (e.End.Date >= this.curDateView.Date && e.Begin.Date <= this.curDateView.Date)
         {
             for (int i = e.beginIndex(this.curDateView); i <= e.EndIndex(this.curDateView); i++)
             {
                 UITime time = this.UICalendar.Children[i] as UITime;
                 if (time != null && time.hasEvent == false)
                 {
                     time.hasEvent = true;
                     GroupEvent.ExpansionIndex.Add(i);
                 }
             }
         }
     }
     this.UpdateLayout();
     for (int i = 0; i < this.Events.Count; i++)
     {
         Event e = this.Events[i];
         if (e.End.Date >= this.curDateView.Date && e.Begin.Date <= this.curDateView.Date)
         {
             UIEvent UIE = new UIEvent();
             if (e.isAllDay(this.curDateView))
             {
                 e.Width            = this.UICalendar.Width - 110;
                 e.Height           = 38;
                 e.Left             = 0;
                 UIE.Event          = e;
                 UIE.Orientation    = Orientation.Horizontal;
                 UIE.DeleteEvent   += UIE_DeleteEvent;
                 UIE.AddChildEvent += UIE_AddChildEvent;
                 UIE.EditEvent     += UIE_EditEvent;
                 UIE.SelectEvent   += UIE_SelectEvent;
                 UIE.LinkEvent     += UIE_LinkEvent;
                 this.Time_0.AddChild(UIE);
             }
             else
             {
                 int index = e.comitBeginIndex(this.curDateView);
                 e.Top    = e.getTop(this.curDateView);
                 e.Height = e.getHeight(this.curDateView);
                 bool canAdd = false;
                 foreach (GroupEvent G in this.Groups)
                 {
                     if (G.Add(ref e))
                     {
                         UIE.Event = e;
                         canAdd    = true;
                         break;
                     }
                 }
                 if (!canAdd)
                 {
                     GroupEvent gE = new GroupEvent(ModeGroup.Vertical, 20 + (this.Groups.Count * this.widthCol), this.widthCol - this.margin);
                     gE.Add(ref e);
                     this.Groups.Add(gE);
                     UIE.Event             = e;
                     this.UICalendar.Width = this.Groups[this.Groups.Count - 1].Left + this.widthCol + 100;
                 }
                 if (e.Height > 100)
                 {
                     UIE.Orientation = Orientation.Vertical;
                 }
                 else
                 {
                     UIE.Orientation = Orientation.Horizontal;
                 }
                 UIE.DeleteEvent   += UIE_DeleteEvent;
                 UIE.EditEvent     += UIE_EditEvent;
                 UIE.AddChildEvent += UIE_AddChildEvent;
                 UIE.SelectEvent   += UIE_SelectEvent;
                 UIE.LinkEvent     += UIE_LinkEvent;
                 (this.UICalendar.Children[index] as UITime).AddChild(UIE);
             }
         }
     }
 }
Example #8
0
 // Update is called once per frame
 void Update()
 {
     UITime.write(gameLogic.remainingTime);
 }