Esempio n. 1
0
	void Awake () {
		sunLight = GetComponent<Light> ();

		timeLine = GameObject.FindWithTag ("Managers").GetComponent<TimeLine> ();

		if (timeLine == null)
			print ("WARNING: Sun: TimeLine not set");
	}
Esempio n. 2
0
 public static Job CreateJob(TimeLine tl)
 {
     Job j = new Job();
     do
     {
         j.Baslangic = tl.DayStart.Add(new TimeSpan(0, rnd.Next(tl.DayLengthMinute - tl.MaksJobLength), 0));
         j.Bitis = j.Baslangic.Add(new TimeSpan(0, rnd.Next(tl.MaksJobLength), 0));
     } while (j.JobLength > tl.MaksJobLength || j.JobLength < tl.MinJobLength);
     return j;
 }
Esempio n. 3
0
 public void RemoveSelf()
 {
     TimeLine = new TimeLine();
     TimeLine.Repeat(0.2f, t =>
     {
         var p = t.Progress;
         if (p > 1.0f) p = 1.0f;
         _adjust = 0.1f + 0.9f * (1 - p);
     }).Invoke(() =>
     {
         Parent.RemoveChild(this);
     });
 }
Esempio n. 4
0
        public void TimeRangeCombinedPeriodsTest()
        {
            TimePeriodCollection periods = new TimePeriodCollection();
            DateTime date1 = ClockProxy.Clock.Now;
            DateTime date2 = date1.AddDays( 1 );
            DateTime date3 = date2.AddDays( 1 );
            periods.Add( new TimeRange( date1, date2 ) );
            periods.Add( new TimeRange( date2, date3 ) );

            TimeLine<TimeRange> timeLine = new TimeLine<TimeRange>( periods, null, null );
            ITimePeriodCollection combinedPeriods = timeLine.CombinePeriods();
            Assert.AreEqual( 1, combinedPeriods.Count );
            Assert.AreEqual( new TimeRange( date1, date3 ), combinedPeriods[ 0 ] );
        }
Esempio n. 5
0
 private void FillTimeLine()
 {
     _tl?.mainCanvas.Children.Clear();
     try {
         _tl = new TimeLine(MainWindow.AppWindow.ActualWidth, 100.0, _endTimeMonitor);
         foreach (double timingS in _timingpointsAdded)
         {
             _tl.AddElement(timingS, 1);
         }
         foreach (double timingS in _timingpointsChanged)
         {
             _tl.AddElement(timingS, 2);
         }
         foreach (double timingS in _timingpointsRemoved)
         {
             _tl.AddElement(timingS, 3);
         }
         tl_host.Children.Clear();
         tl_host.Children.Add(_tl);
     } catch (Exception ex) {
         Console.WriteLine(ex.Message);
     }
 }
Esempio n. 6
0
        public TimeLineVM(TimeLine timeLine, TimeLineVM parent)
        {
            _timeLine  = timeLine;
            _timeLines = new ObservableCollection <TimeLineVM>();
            _exhibits  = new ObservableCollection <ExhibitVM>();
            _parent    = parent;

            if (timeLine.TimeLines != null)
            {
                foreach (var timeLineTimeLine in timeLine.TimeLines)
                {
                    _timeLines.Add(new TimeLineVM(timeLineTimeLine, this));
                }
            }

            if (_timeLine.Exhibits != null)
            {
                foreach (var timeLineExhibit in _timeLine.Exhibits)
                {
                    _exhibits.Add(new ExhibitVM(timeLineExhibit, this));
                }
            }
        }
Esempio n. 7
0
 private void FillTimeLine()
 {
     _tl?.mainCanvas.Children.Clear();
     try {
         _tl = new TimeLine(MainWindow.AppWindow.MainContentGrid.ActualWidth, 100.0, _endTimeMonitor);
         foreach (double timingS in _potentialUnloadingObjects)
         {
             _tl.AddElement(timingS, 1);
         }
         foreach (double timingS in _potentialDisruptors)
         {
             _tl.AddElement(timingS, 4);
         }
         foreach (double timingS in _unloadingObjects)
         {
             _tl.AddElement(timingS, 3);
         }
         tl_host.Children.Clear();
         tl_host.Children.Add(_tl);
     } catch (Exception ex) {
         Console.WriteLine(ex.Message);
     }
 }
Esempio n. 8
0
        public void EkranaJobYaz(TimeLine tl)
        {
            Console.CursorSize = 20;
            TimeSpan fark = Baslangic - tl.DayStart;

            for (int i = 0; i < (int)Math.Ceiling(fark.TotalMinutes / 3.0); i++)
            {
                Console.Write("-");
            }
            Console.ForegroundColor = Yazi;
            for (int i = 0; i < (int)Math.Ceiling(JobLength / 3.0); i++)
            {
                Console.Write("*");
            }
            Console.ForegroundColor = ConsoleColor.White;
            TimeSpan sonFark = tl.DayFinish - Bitis;
            for (int i = 0; i < (int)Math.Ceiling(sonFark.TotalMinutes / 3.0); i++)
            {
                Console.Write("-");
            }
            Console.Write(" {0:hh\\:mm}-{1}dk. ", Baslangic, JobLength);
            Console.WriteLine();
        }
        /// <summary>
        /// Method to iterate through a list of track elements and upload to timeline table
        /// </summary>
        /// <param name="gpxTrackList">list of CSV strings containing track information</param>
        /// <param name="lineupID">the associated lineup id</param>
        private void AddTrackElementsToTimeLineTable(List <string> gpxTrackList, int lineupID)
        {
            using (DataClassesDataContext dbContext = new DataClassesDataContext())
            {
                //Iterate trough list and generate new Timelines object from each
                for (int i = 0; i < gpxTrackList.Count; i++)
                {
                    string[] elements = gpxTrackList[i].Split(',');

                    TimeLine timeLines = new TimeLine
                    {
                        Latitude    = Convert.ToDouble(elements[1]),
                        Longitude   = Convert.ToDouble(elements[2]),
                        ReadingTime = Convert.ToDateTime(elements[3]),
                        LineupID    = lineupID,
                        GPSDeviceID = gpsDeviceID
                    };
                    //Write to database
                    dbContext.TimeLines.InsertOnSubmit(timeLines);
                    dbContext.SubmitChanges();
                }
            }
        }
Esempio n. 10
0
        public override async void Initialize(TwitterAccount account, SettingData setting, Action <TimelineAction> timelineActionCallback, Action <RowAction> rowActionCallback)
        {
            base.Initialize(account, setting, timelineActionCallback, rowActionCallback);

            ChangeLoadState(true);

            if (TimeLine.Count > 0)
            {
                string sinceId = (TimeLine.First() as TimelineRow).Tweet.id_str;

                var rows = (await Account.TwitterClient.GetHomeTimelineNewAsync(sinceId)).Select(r => new TimelineRow(r, Account.UserInfomation.screen_name, Setting, rowActionCallback)).Cast <RowBase>().ToList();
                rows = rows.Where(q => q.Tweet.entities.media != null && q.Tweet.entities.media.Count > 0).Select(q => q).ToList();
                await InsertRestInTimeLineAsync(rows);
            }
            else
            {
                var rows = (await Account.TwitterClient.GetHomeTimelineAsync(200)).Select(r => new TimelineRow(r, Account.UserInfomation.screen_name, Setting, rowActionCallback)).Cast <RowBase>().ToList();
                rows = rows.Where(q => q.Tweet.entities.media != null && q.Tweet.entities.media.Count > 0).Select(q => q).ToList();
                await InsertRestInTimeLineAsync(rows);
            }

            ChangeLoadState(false);
        }
Esempio n. 11
0
        void SetSpriteSwapKeys(Transform child, TimeLine timeLine, AnimationClip clip, Animation animation)
        {
            // Create ObjectReferenceCurve for swapping sprites. This curve will save data in object form instead of floats like regular AnimationCurve.
            var keyframes = new List <ObjectReferenceKeyframe>();

            foreach (var key in timeLine.keys)
            {
                var info   = (SpriteInfo)key.info;
                var sprite = Folders[info.folder][info.file];
                keyframes.Add(new ObjectReferenceKeyframe {
                    time = key.time, value = sprite
                });
            }
            var lastIndex = (animation.looping) ? 0 : timeLine.keys.Length - 1;
            var lastInfo  = (SpriteInfo)timeLine.keys[lastIndex].info;

            keyframes.Add(new ObjectReferenceKeyframe {
                time = animation.length, value = Folders[lastInfo.folder][lastInfo.file]
            });
            AnimationUtility.SetObjectReferenceCurve(clip, new EditorCurveBinding {
                path = GetPathToChild(child), propertyName = "m_Sprite", type = typeof(SpriteRenderer)
            }, keyframes.ToArray());
        }
Esempio n. 12
0
    void DrawTimeLine()
    {
        int      count;
        TimeLine timeLine = magic.TimeLine;

        count = EditorGUILayout.IntField("Size", timeLine.Count);
        if (count < timeLine.Count)
        {
            timeLine.RemoveLast(timeLine.Count - count);
        }
        else if (count > timeLine.Count)
        {
            timeLine.AddLast(count - timeLine.Count);
        }


        EditorGUI.indentLevel = 1;

        foreach (TimeLineEvent lineEvent in magic.TimeLine)
        {
            DrawTimeEvent(lineEvent);
        }
    }
        /// <summary>
        /// 根据给定的时间序列作为采样点对原始Sequential列表重新筛选,但对结果列表每项的time字段不去和timeline对齐
        /// 筛选后的结果列表数量和采样序点列timeline的数量一致。
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="src">必须是按时间递增的序列</param>
        /// <param name="timeline">时间采样点序列</param>
        /// <returns></returns>
        public static List <T> Resample <T>(IList <T> src, TimeLine timeline) where T : Sequential
        {
            if (src == null || timeline == null)
            {
                return(null);
            }
            var timelineInMillis = timeline.Millis;
            int n = timelineInMillis.Count;
            var res = new T[n];
            int i, j = 0;
            int sign = 1;

            //将src筛选,到res
            for (i = 0; i < n; i++)
            {
                for (; j < src.Count && (int)src[j].time.TimeOfDay.TotalMilliseconds <= timelineInMillis[i]; j++)
                {
                    ;
                }
                //  if (j < src.Count && (int)src[j].time.TimeOfDay.TotalMilliseconds <= timelineInMillis[i]) j++;
                if (j > 0)
                {
                    if (sign == 1 && i != 0) // 前面有为null的值
                    {
                        for (int jj = 0; jj < i; jj++)
                        {
                            res[jj] = src[j - 1];
                        }
                        sign = 0;
                    }

                    res[i] = src[j - 1];
                }
            }

            return(res.ToList());
        }
Esempio n. 14
0
        public IActionResult Edit(int id, TimeLineUpdForm form)
        {
            if (_sessionManager.User is not null)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        TimeLine tl = new TimeLine()
                        {
                            Id             = id
                            , DinerDate    = form.DinerDate
                            , NbrGuests    = form.NbrGuests
                            , UserId       = _sessionManager.User.Id
                            , RestaurantId = form.SelectedResaurant
                        };

                        bool updated = _timeLineService.Upd(id, tl);
                        if (!updated)
                        {
                            ViewBag.Message = "Error: Time Line NOT Updated (" + id.ToString() + ")";
                        }
                        return(RedirectToAction("index"));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    //ViewBag.Error = ex.Message;
                }
                return(View());
            }
            else
            {
                return(RedirectToAction("Login", "Auth"));
            }
        }
Esempio n. 15
0
        public int SubmitTimeLine(int UserID, TimeLine timeline)
        {
            int weddingID = timeline.WeddingID;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
                                                                 new TransactionOptions
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
            }))
            {
                if (timeline.TimeLineID == 0)
                {
                    timeline.CreatedDate = DateTime.Now;
                    timeline.CreatedBy   = UserID;
                    AccuitAdminDbContext.TimeLines.Add(timeline);
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
                else
                {
                    TimeLine tLine = AccuitAdminDbContext.TimeLines.Where(x => x.TimeLineID == timeline.TimeLineID).First();
                    tLine.ModifiedDate = DateTime.Now;
                    tLine.StoryDate    = timeline.StoryDate;
                    tLine.Title        = timeline.Title;
                    tLine.ImageUrl     = timeline.ImageUrl;
                    tLine.Story        = timeline.Story;
                    tLine.IsDeleted    = timeline.IsDeleted;
                    tLine.ModifiedBy   = UserID;
                    tLine.Location     = timeline.Location;
                    AccuitAdminDbContext.Entry <TimeLine>(tLine).State = System.Data.Entity.EntityState.Modified;
                    AccuitAdminDbContext.SaveChanges();
                    scope.Complete();
                }
            }

            return(timeline.TimeLineID);
        }
Esempio n. 16
0
        private void SaveEntity(TimeLine <ItemInfoEntity> line)
        {
            if (CheckTable <DBTStkMinuteEntity>())
            {
                var entity = new DBTStkMinuteEntity(accessor);
                entity.Code = line.Value.Code;

                if (line is TengxunMinuteLine)
                {
                    var tengxunline = line as TengxunMinuteLine;
                    entity.Time      = new DateTime(tengxunline.CloseTime.Year, tengxunline.CloseTime.Month, tengxunline.CloseTime.Day, tengxunline.CloseTime.Hour, tengxunline.CloseTime.Minute, 0);
                    entity.Open      = tengxunline.Open;
                    entity.Close     = tengxunline.Close;
                    entity.High      = tengxunline.High;
                    entity.Low       = tengxunline.Low;
                    entity.Average   = tengxunline.Average;
                    entity.VolAmount = tengxunline.VolAmount;
                    entity.VolMoney  = tengxunline.VolMoney;
                }

                entity.GenerateID();
                entity.Save();
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Gets the timeLine To post on
        /// </summary>
        /// <param name="EventID">EventID integer</param>
        /// <returns>A timeLine</returns>
        public static TimeLine GetTimeline(int EventID)
        {
            TimeLine Timeline = null;

            if (DatabaseConnectie.OpenConnection())
            {
                try
                {
                    DatabaseConnectie.OpenConnection();
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = DatabaseConnectie.connect;

                    cmd.CommandText = "SELECT * FROM Tijdlijn WHERE EventID = @EventID";
                    cmd.Parameters.Add(new SqlParameter("EventID", EventID));

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        int ID = Convert.ToInt32(reader["ID"]);
                        Timeline = new TimeLine(ID);
                    }

                    return(Timeline);
                }
                catch (SqlException e)
                {
                    Console.WriteLine("Query Failed: " + e.StackTrace + e.Message.ToString());
                }
                finally
                {
                    DatabaseConnectie.CloseConnection();
                }
            }
            return(Timeline);
        }
Esempio n. 18
0
	void Awake () {
		var managers = GameObject.FindWithTag ("Managers");
		timeLine = managers.GetComponent<TimeLine> ();
		slotRecord = managers.GetComponent<SlotRecord> ();
		csqTable = managers.GetComponent<MadnessConsequencesTable> ();
		soundMgr = managers.GetComponent<SoundManager> ();

		if (path == null)
			Debug.LogError (gameObject.name + " doesn't have a path");
		if (itemHolder == null)
			Debug.LogError (gameObject.name + " doesn't have an item holder");
		if (headRenderer == null)
			Debug.LogError (gameObject.name + " doesn't have an head renderer");
		if (materials.Length < 4)
			Debug.LogWarning (gameObject.name + " doesn't have enough materials");
		if (soundsMadnessConsequences.Length < 4)
			Debug.LogWarning (gameObject.name + " doesn't have enough sounds");

		anim = GetComponentInChildren<Animator> ();
		soundSrc = GetComponents<AudioSource> ();

		UpdateOrder ();
		CheckActionValidity ();
	}
        public void SaveProject(string path, MainWindow window)
        {
            if (window == null)
            {
                return;
            }

            TimeLine TimeLine = window.MainTimeline;

            ProjectInfoJson projectInfo = GetProjectInfo();

            projectInfo.animations.Clear();

            foreach (Keyframe keyFrame in TimeLine.GetKeyframes())
            {
                Dictionary <string, SpriteboxJson> spriteBoxes = new Dictionary <string, SpriteboxJson>();

                foreach (KeyValuePair <string, Spritebox> spr in keyFrame.GetSpriteBoxes())
                {
                    spriteBoxes.Add(spr.Key, Spritebox.ToJsonElement(spr.Value));
                }

                Animation animation = new Animation
                {
                    timelineX   = keyFrame.PositionX,
                    spriteBoxes = spriteBoxes
                };

                projectInfo.animations.Add(animation);
            }

            projectInfo.TimelineEnd           = TimeLine.TimeLineEnd;
            projectInfo.ProjectSaveIncrement += 1;

            SaveJSON(projectInfo, path);
        }
Esempio n. 20
0
        protected async Task InsertRestInTimeLineAsync(List <RowBase> tweetList)
        {
            if (tweetList != null)
            {
                List <RowBase> tempTweetList = new List <RowBase>();
                RowBase[]      tweetListCopy = null;
                await Task.Run(async() =>
                {
                    tweetList.Reverse();
                    tweetListCopy = new RowBase[TimeLine.Count];
                    TimeLine.CopyTo(tweetListCopy, 0);


                    foreach (var tweet in tweetList)
                    {
                        if (await IsAllFilterClearAsync(tweet.Tweet))
                        {
                            if (await isCompetition(tweetListCopy.ToList(), tweet.Tweet) == false)
                            {
                                tempTweetList.Add(tweet);
                            }
                        }
                    }
                });

                await SharedDispatcher.RunAsync(() =>
                {
                    foreach (var tweet in tempTweetList)
                    {
                        TimeLine.Insert(0, tweet);
                    }
                });

                //TimeLine.OrderBy(q => q.Tweet.created_at_time).Select(q => q);
            }
        }
Esempio n. 21
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            #region BackgroundTasks
            BackgroundHelper.RegisterBackgroundServices();
            #endregion
            #region Back handle
            if (Frame.CanGoBack)
            {
                try
                {
                    Frame.BackStack.Clear();
                }
                catch { }
            }

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

            #endregion
            #region navigations
            TimeLine.Navigate(typeof(TimeLine));
            Chats.Navigate(typeof(Graphs));
            #endregion
            _bgService.UpdateTiles();
        }
Esempio n. 22
0
        /// <summary> 添加插值器到物体上 </summary>
        public static TweenInterpolator Create(
            GameObject gameObject,
            bool isPlaying                  = true,
            float delay                     = 0.0f,
            float duration                  = 1.0f,
            float speed                     = 1.0f,
            TweenMethod method              = TweenMethod.Linear,
            WrapMode wrapMode               = WrapMode.Once,
            TimeLine timeLine               = TimeLine.Normal,
            Action <float> onUpdate         = null,
            UnityAction onArriveAtEnding    = null,
            UnityAction onArriveAtBeginning = null)
        {
            TweenInterpolator interpolator = gameObject.AddComponent <TweenInterpolator>();

            interpolator.isPlaying = isPlaying;
            interpolator.delay     = delay;
            interpolator.duration  = duration;
            interpolator.speed     = speed;
            interpolator.method    = method;
            interpolator.wrapMode  = wrapMode;
            interpolator.timeLine  = timeLine;
            if (onUpdate != null)
            {
                interpolator.onTween += onUpdate;
            }
            if (onArriveAtEnding != null)
            {
                interpolator.onArriveAtEnding.AddListener(onArriveAtEnding);
            }
            if (onArriveAtBeginning != null)
            {
                interpolator.onArriveAtBeginning.AddListener(onArriveAtBeginning);
            }
            return(interpolator);
        }
        public void SetGridLinesTimeline(TimeLine timeline, BackgroundFormatter backgroundFormatter)
        {
            if (timeline is null)
            {
                throw new ArgumentNullException(nameof(timeline));
            }
            if (backgroundFormatter is null)
            {
                throw new ArgumentNullException(nameof(backgroundFormatter));
            }

            if (!ganttChartData.TimeLines.Contains(timeline))
            {
                throw new Exception("Invalid timeline");
            }

            foreach (var item in timeline.Items)
            {
                item.BackgroundColor = backgroundFormatter(item);
            }

            GridLineTimeLine.Clear();
            GridLineTimeLine.Add(timeline);
        }
Esempio n. 24
0
        public TimeLine CreateTimeLine(PeriodSplitter.PeriodSplitter splitter, PeriodNameFormatter PeriodNameFormatter, BackgroundFormatter backgroundFormatter)
        {
            if (splitter.MaxDate != GanttData.MaxDate || splitter.MinDate != GanttData.MinDate)
            {
                throw new ArgumentException("The timeline must have the same max and min -date as the chart");
            }

            var timeLineParts = splitter.Split();

            var timeline = new TimeLine();

            foreach (var p in timeLineParts)
            {
                TimeLineItem item = new TimeLineItem()
                {
                    Name = PeriodNameFormatter(p), Start = p.Start, End = p.End.AddSeconds(-1)
                };
                item.BackgroundColor = backgroundFormatter(item);
                timeline.Items.Add(item);
            }

            ganttChartData.TimeLines.Add(timeline);
            return(timeline);
        }
Esempio n. 25
0
        private void advanceWeekButton_Click(object sender, EventArgs e)
        {
            if (Classrooms.Count == 0)
            {
                MessageBox.Show("You must create a schedule first!");
                return;
            }

            Date = Date.AddDays(7);
            DayNumber++;
            Money += 500;
            UpdateStatusWindow();

            CheckBuildClassrooms();

            List <Event> RemovedEvents = new List <Event>();

            foreach (Event Event in TimeLine)
            {
                if (Event.DateTime >= Date)
                {
                    switch (Event.EventType)
                    {
                    default:
                        break;
                    }
                    RemovedEvents.Add(Event);
                }
            }
            foreach (Event RemoveEvent in RemovedEvents)
            {
                TimeLine.Remove(RemoveEvent);
            }

            //
            int TotalScheduleHours = Schedule[0, 2] + Schedule[1, 2] + Schedule[2, 2] + Schedule[3, 2] + Schedule[4, 2] + Schedule[5, 2] + Schedule[6, 2] + Schedule[7, 2];

            for (int PersonNumber = 0; PersonNumber < Pupils.Count; PersonNumber++)
            {
                Pupil Person = Pupils[PersonNumber];

                if (TotalScheduleHours > 30)
                {
                    Person.Happiness -= (TotalScheduleHours - 30) * 2;
                }
                else
                {
                    Person.Happiness += 5;
                }

                for (int Subject = 0; Subject < 8; Subject++)
                {
                    Person.Happiness += Teachers[Schedule[Subject, 0]].FunFactor * Schedule[Subject, 2];
                    switch (Classrooms[Schedule[Subject, 1]].RoomType)
                    {
                    case RoomType.ClassroomSmall:
                        Person.Happiness += 0;
                        break;

                    case RoomType.ClassroomMedium:
                        Person.Happiness += 2;
                        break;

                    case RoomType.ClassroomLarge:
                        Person.Happiness += 5;
                        break;
                    }
                    Person.Happiness += Classrooms[Schedule[Subject, 1]].Blackboard.Data * Schedule[Subject, 2];
                }

                Person.Happiness += Person.Intelligence + Person.Motivation * 9 / 10;

                if (Person.Happiness > 1000)
                {
                    Person.Happiness = 1000;
                }
                if (Person.Happiness < 0)
                {
                    Person.Happiness = 0;
                }

                Pupils[PersonNumber] = Person;
            }
            //

            foreach (Teacher Teacher in Teachers)
            {
                Money -= Teacher.Salary;
            }

            int AverageHappiness = 0;

            foreach (Pupil Person in Pupils)
            {
                AverageHappiness += Person.Happiness;
            }
            AverageHappiness  /= Pupils.Count;
            progressBar1.Value = AverageHappiness > progressBar1.Maximum ? progressBar1.Maximum : AverageHappiness;
            label10.Text       = "Average Happiness: " + progressBar1.Value * 100 / progressBar1.Maximum + "%";
        }
Esempio n. 26
0
        private static void SaveTwitterMessages(string profileId, oAuthTwitter oAuth)
        {
            TwitterUser twtuser;

            twtuser = new TwitterUser();
            try
            {
                TimeLine tl   = new TimeLine();
                JArray   data = null;
                try
                {
                    data = tl.Get_Statuses_Mentions_Timeline(oAuth);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    apiHitsCount = MaxapiHitsCount;
                }
                Domain.Socioboard.Models.Mongo.MongoTwitterMessage objTwitterMessage = new Domain.Socioboard.Models.Mongo.MongoTwitterMessage();
                if (data != null)
                {
                    apiHitsCount++;
                    foreach (var item in data)
                    {
                        objTwitterMessage.type = Domain.Socioboard.Enum.TwitterMessageType.TwitterMention;
                        objTwitterMessage.id   = MongoDB.Bson.ObjectId.GenerateNewId();

                        try
                        {
                            objTwitterMessage.messageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            const string format = "ddd MMM dd HH:mm:ss zzzz yyyy";
                            objTwitterMessage.messageDate      = DateTime.ParseExact(item["created_at"].ToString().TrimStart('"').TrimEnd('"'), format, System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy/MM/dd HH:mm:ss");
                            objTwitterMessage.messageTimeStamp = Domain.Socioboard.Helpers.SBHelper.ConvertToUnixTimestamp(DateTime.ParseExact(item["created_at"].ToString().TrimStart('"').TrimEnd('"'), format, System.Globalization.CultureInfo.InvariantCulture));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.twitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.fromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.fromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.fromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.inReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.sourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.profileId = profileId;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.screenName = item["user"]["screen_name"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        MongoRepository mongorepo = new MongoRepository("MongoTwitterMessage");
                        mongorepo.Add <Domain.Socioboard.Models.Mongo.MongoTwitterMessage>(objTwitterMessage);
                    }
                }
                else
                {
                    apiHitsCount = MaxapiHitsCount;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                apiHitsCount = MaxapiHitsCount;
            }
        }
Esempio n. 27
0
 private void HideSaveIcon(object obj)
 {
     saveIcon.SetActive(false);
     TimeLine.GetInstance().RemoveTimeEvent(HideSaveIcon);
 }
Esempio n. 28
0
        /// <summary>
        /// 通过波形生成时间序列
        /// </summary>
        /// <param name="fileName">波形文件路径</param>
        /// <param name="timeLine">时间序列</param>
        /// <param name="fre_count">频率采样数</param>
        /// <param name="vol_count">振幅采样数</param>
        /// <param name="tick_cycle">采样周期</param>
        /// <returns>时间序列</returns>
        public TimeLine Serialize(string fileName, TimeLine timeLine, int fre_count = 1, int vol_count = 1, int tick_cycle = 1, ShowProgress showProgress = null)
        {
            try
            {
                //Read Waves
                var reader = new WaveFileReader(fileName);
                reader.Position = 0;
                #region WaveFile -> WaveNodes
                //Create WaveNodes
                var     waveNodesL = new List <WaveNode>();
                var     waveNodesR = new List <WaveNode>();
                float[] samplesL   = new float[reader.Length / reader.BlockAlign];
                float[] samplesR   = new float[reader.Length / reader.BlockAlign];
                //Get Time-related Param
                var Hz          = (int)(samplesL.Length / reader.TotalTime.TotalSeconds);
                var FperTick    = Hz / 20;
                var SampleCycle = FperTick * tick_cycle;
                var totalTick   = samplesL.Length / FperTick;
                //Frequency & Peak
                int[]   Fre  = new int[] { /* left */ 0, /* right */ 0 };
                float[] Peak = new float[] { /* left_min */ 0, /* right_min */ 0, /* left_max */ 0, /* right_max */ 0 };
                #region Set Nodes'
                //Foreach Frequency & Peak in WaveFile
                int _temp = -1; /* Set Total Progress */ timeLine.totalProgress = samplesL.Length;
                for (int i = 0; i < samplesL.Length; i++)
                {
                    //Get Sample
                    float[] sample = reader.ReadNextSampleFrame();
                    samplesL[i] = sample[0]; //Mono - Right
                    samplesR[i] = sample[1]; //Stereo - Left
                    //Get Frequency & Peak
                    if (i > 0)
                    {
                        //Get Frequency
                        if (samplesL[i] * samplesL[i - 1] < 0)
                        {
                            Fre[0]++;
                        }
                        if (samplesR[i] * samplesR[i - 1] < 0)
                        {
                            Fre[1]++;
                        }
                        //Get Peak
                        if (samplesL[i] < Peak[0])
                        {
                            Peak[0] = samplesL[i];
                        }
                        else if (samplesL[i] > Peak[1])
                        {
                            Peak[1] = samplesL[i];
                        }
                        if (samplesR[i] < Peak[2])
                        {
                            Peak[2] = samplesR[i];
                        }
                        else if (samplesR[i] > Peak[3])
                        {
                            Peak[3] = samplesR[i];
                        }

                        //Creat Objects
                        int v = (i - 1) % SampleCycle;
                        int g = (i - 1) % FperTick;
                        int t = (i - 1) / FperTick;
                        if (v == 0)
                        {
                            waveNodesL.Add(new WaveNode()
                            {
                                TickStart = t,
                                IsLeft    = true
                            });
                            waveNodesR.Add(new WaveNode()
                            {
                                TickStart = t,
                                IsLeft    = false
                            });
                            _temp = t;
                        }
                        else if (g == 0)
                        {
                            waveNodesL.Add(new WaveNode()
                            {
                                TickStart = t,
                                IsLeft    = true
                            });
                            waveNodesR.Add(new WaveNode()
                            {
                                TickStart = t,
                                IsLeft    = false
                            });
                        }
                        //Write To Nodes
                        float ft = (float)SampleCycle / fre_count;
                        float vt = (float)SampleCycle / vol_count;
                        if (v % ft < 1)
                        {
                            waveNodesL[_temp].Param["FrequencyPerTick"].Add(new _Node_INT()
                            {
                                Name = "Fre", Value = Fre[0]
                            });
                            waveNodesR[_temp].Param["FrequencyPerTick"].Add(new _Node_INT()
                            {
                                Name = "Fre", Value = Fre[1]
                            });
                            Fre[0] = 0; Fre[1] = 0;
                        }
                        if (v % vt < 1)
                        {
                            waveNodesL[_temp].Param["VolumePerTick"].Add(new _Node_INT()
                            {
                                Name = "Vol", Value = (int)((Peak[1] - Peak[0]) * 1000)
                            });
                            waveNodesR[_temp].Param["VolumePerTick"].Add(new _Node_INT()
                            {
                                Name = "Vol", Value = (int)((Peak[3] - Peak[2]) * 1000)
                            });
                            Peak[0] = 0; Peak[1] = 0; Peak[2] = 0; Peak[3] = 0;
                        }
                    }
                    /* Update Current Progress */ timeLine.currentProgress++; if (showProgress != null && timeLine.totalProgress > 0)
                    {
                        showProgress((double)timeLine.currentProgress / timeLine.totalProgress);
                    }
                }
                #endregion
                #endregion
                #region WaveNodes -> TickNodes
                //Creat and Set Lenth of TickNodes
                if (timeLine.TickNodes == null)
                {
                    timeLine.TickNodes = new List <TickNode>();
                }
                if (totalTick >= timeLine.TickNodes.Count)
                {
                    var nowCount = timeLine.TickNodes.Count;
                    for (int i = 0; i < totalTick - nowCount + 1; i++)
                    {
                        timeLine.TickNodes.Add(new TickNode());
                    }
                }
                //WaveNodes -> TickNodes
                foreach (WaveNode waveNodeL in waveNodesL)
                {
                    if (timeLine.TickNodes[waveNodeL.TickStart].WaveNodesLeft == null)
                    {
                        timeLine.TickNodes[waveNodeL.TickStart].WaveNodesLeft = new List <WaveNode>();
                    }
                    timeLine.TickNodes[waveNodeL.TickStart].WaveNodesLeft.Add(waveNodeL);
                }
                foreach (WaveNode waveNodeR in waveNodesR)
                {
                    if (timeLine.TickNodes[waveNodeR.TickStart].WaveNodesRight == null)
                    {
                        timeLine.TickNodes[waveNodeR.TickStart].WaveNodesRight = new List <WaveNode>();
                    }
                    timeLine.TickNodes[waveNodeR.TickStart].WaveNodesRight.Add(waveNodeR);
                }
                #endregion
                timeLine.Param["TotalTicks"].Value = timeLine.TickNodes.Count;
                return(timeLine);
            }
            catch
            {
                return(null);
            }
        }
        private void TimeLinePresenter(TimeLine.TimeLine in_control, DateTime in_StartTime, TimeLine.Section[] a1)
        {

            DateTime T1 = get_T1(in_StartTime);
            DateTime T2 = get_T2(in_StartTime);
            DateTime CURR = get_CURR();
            //MessageBox.Show(in_StartTime.ToString());
            //MessageBox.Show(T1.ToString());

            in_control.SetEmpty();

            //for ASC sql order
            if (a1.Length != 0)
            {
                in_control.AddBasePeriod(T1, T2, false);
                //not empty left
                if (a1[0].StartTime < T1 && a1[0].EndTime != DateTime.MaxValue)
                    in_control.AddPeriod(a1[0].colorRed, a1[0].colorGreen, a1[0].colorBlue, T1, a1[0].EndTime, false);
                //empty left
                if (a1[0].StartTime >= T1)
                    in_control.AddPeriod(a1[0].colorRed, a1[0].colorGreen, a1[0].colorBlue, a1[0].StartTime, a1[0].EndTime, false);
                for (int i = 1; i < a1.Length - 1; i++)
                {
                    in_control.AddPeriod(a1[i].colorRed, a1[i].colorGreen, a1[i].colorBlue, a1[i].StartTime, a1[i].EndTime, false);
                }
                bool temp_is_last = false;
                //for last time
                if (a1[a1.Length - 1].EndTime == DateTime.MaxValue) temp_is_last = true;

                if (temp_is_last && T2 < CURR && a1[a1.Length - 1].StartTime > T1)
                    in_control.AddPeriod(a1[a1.Length - 1].colorRed, a1[a1.Length - 1].colorGreen, a1[a1.Length - 1].colorBlue, a1[a1.Length - 1].StartTime, T2, temp_is_last);
                if (temp_is_last && T2 < CURR && a1[a1.Length - 1].StartTime <= T1)
                    in_control.AddPeriod(a1[a1.Length - 1].colorRed, a1[a1.Length - 1].colorGreen, a1[a1.Length - 1].colorBlue, T1, T2, temp_is_last);
                if (temp_is_last && T1 < CURR && CURR < T2 && a1[a1.Length - 1].StartTime < T1)
                    in_control.AddPeriod(a1[a1.Length - 1].colorRed, a1[a1.Length - 1].colorGreen, a1[a1.Length - 1].colorBlue, T1, CURR, temp_is_last);
                if (temp_is_last && T1 < CURR && CURR < T2 && a1[a1.Length - 1].StartTime >= T1)
                    in_control.AddPeriod(a1[a1.Length - 1].colorRed, a1[a1.Length - 1].colorGreen, a1[a1.Length - 1].colorBlue, a1[a1.Length - 1].StartTime, CURR, temp_is_last);
                //MessageBox.Show(temp_is_last.ToString());
                if (!temp_is_last && a1[a1.Length - 1].StartTime >= T1)
                    in_control.AddPeriod(a1[a1.Length - 1].colorRed, a1[a1.Length - 1].colorGreen, a1[a1.Length - 1].colorBlue, a1[a1.Length - 1].StartTime, T2, temp_is_last);
                if (!temp_is_last && a1[a1.Length - 1].StartTime < T1)
                    in_control.AddPeriod(a1[a1.Length - 1].colorRed, a1[a1.Length - 1].colorGreen, a1[a1.Length - 1].colorBlue, T1, T2, temp_is_last);
            }
            if (a1.Length == 0)
            {
                in_control.AddBasePeriod(T1, T2, true);
            }
            in_control.Refresh();
        }
        /// <summary>
        /// Método chamado quando o usuário abre uma janela
        /// </summary>
        /// <param name="e">SingleChoiceActionExecuteEventArgs</param>
        protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs e)
        {
            if ((e.SelectedChoiceActionItem != null) &&
                e.SelectedChoiceActionItem.Id == "Cronograma")
            {
                ObjectSpace objectSpace = (ObjectSpace)Application.CreateObjectSpace();

                CronogramaPresenter.ServicoPlanejamento = new PlanejamentoServiceUtil();
                CronogramaPresenter.ServicoGeral        = new GeralServiceUtil();
                CronogramaView cronograma = new CronogramaView();

                if (!cronograma.IsDisposed)
                {
                    cronograma.Show();
                }

                return;
            }
            else if (e.SelectedChoiceActionItem != null &&
                     (e.SelectedChoiceActionItem.Id == "Configuracao_ListView" || e.SelectedChoiceActionItem.Id == "Configuracao_DetailView" ||
                      e.SelectedChoiceActionItem.Id == "Configuração"))
            {
                ObjectSpace objectSpace = (ObjectSpace)Application.CreateObjectSpace();

                using (XPCollection itens = new XPCollection(objectSpace.Session, typeof(Configuracao)))
                {
                    if (itens.Count > 0)
                    {
                        e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, itens[0]);
                    }
                    else
                    {
                        e.ShowViewParameters.CreatedView = Application.CreateDetailView(objectSpace, new Configuracao(objectSpace.Session));
                    }
                }

                e.ShowViewParameters.TargetWindow = TargetWindow.Default;

                // Cancel the default processing for this navigation item.
                return;
            }
            else if (e.SelectedChoiceActionItem.Id != null && e.SelectedChoiceActionItem.Id == "PlanejamentoFerias_DetailView")
            {
                ObjectSpace obj = Application.CreateObjectSpace() as ObjectSpace;

                TimeLine line = new TimeLine(obj.Session);
                line.Show();

                return;
            }
            else if (e.SelectedChoiceActionItem.Id != null && e.SelectedChoiceActionItem.Id == "MeusDados_DetailView")
            {
                ObjectSpace obj = Application.CreateObjectSpace() as ObjectSpace;

                e.SelectedChoiceActionItem.Data = null;

                Colaborador colab = Colaborador.GetColaboradorCurrent(obj.Session, new Guid(SecuritySystem.CurrentUserId.ToString()));

                e.ShowViewParameters.CreatedView = Application.CreateDetailView(obj, "MeusDados_DetailView", true, colab);

                //e.SelectedChoiceActionItem.Id = "PlanejamentoFerias_DetailView";

                e.ShowViewParameters.TargetWindow = TargetWindow.Default;

                return;
            }



            //Continue the default processing for other navigation items.
            base.ShowNavigationItem(e);
        }
		private void SetKeys (AnimationCurve curve, TimeLine timeLine, ref Sprite[] sprites, Animation animation) {
			foreach (var key in timeLine.keys) { //Create a key for every key on its personal TimeLine
				var info = (SpriteInfo)key.info;
				curve.AddKey (new Keyframe (key.time, GetIndexOrAdd (ref sprites, Folders [info.folder] [info.file]), inf, inf));
			} //InTangent and OutTangent are set to Infinity to make transitions instant instead of gradual
			var lastIndex = (animation.looping) ? 0 : timeLine.keys.Length - 1;
			var lastInfo = (SpriteInfo)timeLine.keys [lastIndex].info;
			curve.AddKey (new Keyframe (animation.length, GetIndexOrAdd (ref sprites, Folders [lastInfo.folder] [lastInfo.file]), inf, inf));
		}
Esempio n. 32
0
 //    public void CreateNewToken( TimeLine.TokenInfo tokenInfo)
 //    {
 //        CreateNewToken( tokenInfo.name , tokenInfo.size , tokenInfo.i , tokenInfo.j, tokenInfo.duration, tokenInfo.maxSize , tokenInfo.eat , tokenInfo.delete);
 //    }
 public void CreateNewToken( TimeLine.TokenInfo tokenInfo ,  int maxTry = 300  )
 {
     if ( tokenInfo.i == tokenInfo.j || tokenInfo.j == -1 )
         StartCoroutine( CreateNewTokenRandomly( tokenInfo,  maxTry ));
     else
         StartCoroutine( CreateNewTokenFixed( tokenInfo ));
 }
Esempio n. 33
0
    IEnumerator CreateNewTokenFixed( TimeLine.TokenInfo tokenInfo  )
    {
        GameObject tokenObj = Instantiate( tokenPrefab ) as GameObject;
        Token token = tokenObj.GetComponent<Token>();
        int i = tokenInfo.i;
        int j = tokenInfo.j;

        if ( i == -1 || i >= blockRows)
        {
            i = UnityEngine.Random.Range(0,blockRows);
        }
        if ( j == -1 || j >= blockCols )
        {
            j = UnityEngine.Random.Range(0,blockCols);
        }

        BackBlock targetBackblock = backbloctMat[i][j];

        while(true)
        {
            if ( token.Init( targetBackblock, tokenInfo ))
                yield break;
            yield return null;
        }
    }
Esempio n. 34
0
    IEnumerator CreateNewTokenRandomly(  TimeLine.TokenInfo tokenInfo ,  int maxTry = 300  )
    {
        GameObject tokenObj = Instantiate( tokenPrefab ) as GameObject;
        Token token = tokenObj.GetComponent<Token>();
        int i = tokenInfo.i;
        int j = tokenInfo.j;

        if ( i == -1 || i >= blockRows)
        {
            i = UnityEngine.Random.Range(0,blockRows);
        }
        if ( j == -1 || j >= blockCols )
        {
            j = UnityEngine.Random.Range(0,blockCols);
        }

        BackBlock targetBackblock = backbloctMat[i][j];

        while(maxTry > 0)
        {
            if ( token.Init( targetBackblock , tokenInfo ))
                yield break;
            maxTry --;
            if ( tokenInfo.i.Equals( -1 ) )
                i = UnityEngine.Random.Range(0,blockRows);
            if ( tokenInfo.j.Equals( -1 ))
                j = UnityEngine.Random.Range(0,blockCols);
            targetBackblock = backbloctMat[i][j];
            yield return null;
        }
    }
Esempio n. 35
0
 public bool Init( BackBlock block, TimeLine.TokenInfo tokenInfo )
 {
     maxSize = tokenInfo.maxSize;
     move = tokenInfo.move;
     resize = tokenInfo.resize;
     eat = tokenInfo.eat;
     delete = tokenInfo.delete;
     if ( tokenInfo.size == -1 )
         size = UnityEngine.Random.Range(1 , 4);
     else
         size = tokenInfo.size;
     if ( !TryAttachTo( block ) )
         return false;
     AdjustSize( size );
     SetMovie( tokenInfo.name );
     StartCoroutine(CheckEnd(tokenInfo.duration));
     ifInit = false;
     MessageEventArgs msg = new MessageEventArgs();
     msg.AddMessage("name" , movieName );
     BEventManager.Instance.PostEvent( EventDefine.OnTokenInit , msg );
     return true;
 }
Esempio n. 36
0
 /// <summary> 添加插值器到物体上 </summary>
 public static TweenInterpolator Create(
     GameObject gameObject,
     bool isPlaying = true,
     float delay = 0.0f,
     float duration = 1.0f,
     float speed = 1.0f,
     TweenMethod method = TweenMethod.Linear,
     WrapMode wrapMode = WrapMode.Once,
     TimeLine timeLine = TimeLine.Normal,
     Action<float> onUpdate = null,
     UnityAction onArriveAtEnding = null,
     UnityAction onArriveAtBeginning = null)
 {
     TweenInterpolator interpolator = gameObject.AddComponent<TweenInterpolator>();
     interpolator.isPlaying = isPlaying;
     interpolator.delay = delay;
     interpolator.duration = duration;
     interpolator.speed = speed;
     interpolator.method = method;
     interpolator.wrapMode = wrapMode;
     interpolator.timeLine = timeLine;
     if (onUpdate != null) interpolator.onTween += onUpdate;
     if (onArriveAtEnding != null) interpolator.onArriveAtEnding.AddListener(onArriveAtEnding);
     if (onArriveAtBeginning != null) interpolator.onArriveAtBeginning.AddListener(onArriveAtBeginning);
     return interpolator;
 }
		private void SetKeys (AnimationCurve curve, TimeLine timeLine, Func<SpatialInfo, float> infoValue, Animation animation) {
			foreach (var key in timeLine.keys) { //Create a keyframe for every key on its personal TimeLine
				curve.AddKey (key.time, infoValue (key.info));
			}
			var lastIndex = (animation.looping) ? 0 : timeLine.keys.Length - 1; //Depending on the loop type, duplicate the first or last frame
			curve.AddKey (animation.length, infoValue (timeLine.keys [lastIndex].info)); //At the end of the curve
		}
Esempio n. 38
0
        private void GenerateContent()
        {
            this.log.WriteInformation("Generating content...");

            // Kreira pozadinu za graf
            Color blackTrans = Color.Black;
            blackTrans.A = 150;

            Range backgroundRange = new Range(GraphWidth, GraphHeight);
            backgroundQuad = new Rectangle(position + backgroundRange.UpperLeft,
                                                               position + backgroundRange.LowerRight, blackTrans);

            // Ucitava linije
            if (graphLines == null) graphLines = new TimeLine[GraphWidth];
            for (int index = 0; index < GraphWidth; index++) {
                if (graphLines[index] == null) {
                    graphLines[index] = new TimeLine {
                        PointA = new Vector3(position.X + index, position.Y + GraphHeight, position.Z),
                        PointB = new Vector3(position.X + index, position.Y + GraphHeight, position.Z),
                        ColorA = Color.DarkGreen,
                        ColorB = Color.Green,
                    };
                }
                else {
                    graphLines[index].PointA = new Vector3(position.X + index, position.Y + GraphHeight, position.Z);
                    graphLines[index].PointB = new Vector3(graphLines[index].PointA.X,
                                                           graphLines[index].PointA.Y - graphLines[index].Height, position.Z);
                }
            }
            this.log.WriteInformation("{0} TimeLines generated!", this.graphLines.Length);

            this.log.WriteInformation("Content generated!");
        }
		private IDictionary<ChangedValues, AnimationCurve> GetCurves (TimeLine timeLine, SpatialInfo defaultInfo, List<TimeLineKey> parentTimeline) {
			var rv = new Dictionary<ChangedValues, AnimationCurve> (); //This method checks every animatable property for changes
			foreach (var key in timeLine.keys) {		//And creates a curve for that property if changes are detected
				var info = key.info;
				if (!info.processed) {
					SpatialInfo parentInfo = null;
					if (parentTimeline != null) {
						var pKey = parentTimeline.Find (x => x.time == key.time);
						if (pKey == null) {
							var pKeys = parentTimeline.FindAll (x => x.time < key.time);
							pKeys.Sort ((x, y) => x.time.CompareTo (y.time) * -1);
							if (pKeys.Count > 0) pKey = pKeys [0];
							else {
								pKeys = parentTimeline.FindAll (x => x.time > key.time);
								pKeys.Sort ((x, y) => x.time.CompareTo (y.time));
								if (pKeys.Count > 0) pKey = pKeys [0];
							}
						}
						if (pKey != null) parentInfo = pKey.info;
					}
					info.Process (parentInfo);
				}
				if (!rv.ContainsKey (ChangedValues.PositionX) && (defaultInfo.x != info.x || defaultInfo.y != info.y)) {
					rv [ChangedValues.PositionX] = new AnimationCurve (); //There will be irregular behaviour if curves aren't added for all members  
					rv [ChangedValues.PositionY] = new AnimationCurve (); //in a group, so when one is set, the others have to be set as well
					rv [ChangedValues.PositionZ] = new AnimationCurve ();
				}
				if (!rv.ContainsKey (ChangedValues.RotationZ) && (defaultInfo.rotation.z != info.rotation.z || defaultInfo.rotation.w != info.rotation.w)) {
				    rv [ChangedValues.RotationZ] = new AnimationCurve ();//x and y not necessary since the default of 0 is fine
					rv [ChangedValues.RotationW] = new AnimationCurve ();
				}
				if (!rv.ContainsKey (ChangedValues.ScaleX) && (defaultInfo.scale_x != info.scale_x || defaultInfo.scale_y != info.scale_y)) {
					rv [ChangedValues.ScaleX] = new AnimationCurve ();
					rv [ChangedValues.ScaleY] = new AnimationCurve ();
					rv [ChangedValues.ScaleZ] = new AnimationCurve ();
				}
				if (!rv.ContainsKey (ChangedValues.Alpha) && defaultInfo.a != info.a)
					rv [ChangedValues.Alpha] = new AnimationCurve ();
				var scontrol = defaultInfo as SpriteInfo;
				if (scontrol != null && !rv.ContainsKey (ChangedValues.Sprite)) {
					var sinfo = (SpriteInfo)info;
					if (scontrol.file != sinfo.file || scontrol.folder != sinfo.folder)
						rv [ChangedValues.Sprite] = new AnimationCurve ();
				}
			}
			return rv;
		}
Esempio n. 40
0
        private void SetCurves(Transform child, SpatialInfo defaultInfo, List <TimeLineKey> parentTimeline, TimeLine timeLine, AnimationClip clip, Animation animation, ref float defaultZ)
        {
            var childPath = GetPathToChild(child);

            foreach (var kvPair in GetCurves(timeLine, defaultInfo, parentTimeline))                //Makes sure that curves are only added for properties
            {
                switch (kvPair.Key)                                                                 //that actually mutate in the animation
                {
                case ChangedValues.PositionX:
                    SetKeys(kvPair.Value, timeLine, x => x.x, animation);
                    clip.SetCurve(childPath, typeof(Transform), "localPosition.x", kvPair.Value);
                    break;

                case ChangedValues.PositionY:
                    SetKeys(kvPair.Value, timeLine, x => x.y, animation);
                    clip.SetCurve(childPath, typeof(Transform), "localPosition.y", kvPair.Value);
                    break;

                case ChangedValues.PositionZ:
                    kvPair.Value.AddKey(0f, defaultZ);
                    clip.SetCurve(childPath, typeof(Transform), "localPosition.z", kvPair.Value);
                    defaultZ = inf;                     //Lets the next method know this value has been set
                    break;

                case ChangedValues.RotationZ:
                    SetKeys(kvPair.Value, timeLine, x => x.rotation.z, animation);
                    clip.SetCurve(childPath, typeof(Transform), "localRotation.z", kvPair.Value);
                    break;

                case ChangedValues.RotationW:
                    SetKeys(kvPair.Value, timeLine, x => x.rotation.w, animation);
                    clip.SetCurve(childPath, typeof(Transform), "localRotation.w", kvPair.Value);
                    break;

                case ChangedValues.ScaleX:
                    SetKeys(kvPair.Value, timeLine, x => x.scale_x, animation);
                    clip.SetCurve(childPath, typeof(Transform), "localScale.x", kvPair.Value);
                    break;

                case ChangedValues.ScaleY:
                    SetKeys(kvPair.Value, timeLine, x => x.scale_y, animation);
                    clip.SetCurve(childPath, typeof(Transform), "localScale.y", kvPair.Value);
                    break;

                case ChangedValues.ScaleZ:
                    kvPair.Value.AddKey(0f, 1f);
                    clip.SetCurve(childPath, typeof(Transform), "localScale.z", kvPair.Value);
                    break;

                case ChangedValues.Alpha:
                    SetKeys(kvPair.Value, timeLine, x => x.a, animation);
                    clip.SetCurve(childPath, typeof(SpriteRenderer), "m_Color.a", kvPair.Value);
                    break;

                case ChangedValues.Sprite:
                    var swapper = child.GetComponent <TextureController> ();
                    if (swapper == null)                       //Add a Texture Controller if one doesn't already exist
                    {
                        swapper = child.gameObject.AddComponent <TextureController> ();
                        var info = (SpriteInfo)defaultInfo;
                        swapper.Sprites = new[] { Folders [info.folder] [info.file] };
                    }
                    SetKeys(kvPair.Value, timeLine, ref swapper.Sprites, animation);
                    clip.SetCurve(childPath, typeof(TextureController), "DisplayedSprite", kvPair.Value);
                    break;
                }
            }
            clip.EnsureQuaternionContinuity();
        }
        /// <summary>
        /// All Triggers of the game by default/start
        /// </summary>
        /// <returns>true if game started</returns>
        public override void StartSetup()
        {
            //create trigger CPTime
            startDate		= GameScenario.Instance.currentDate.AddDays(2);
            duration 		= (float) GameScenario.Instance.cpDurationInDays;//float.Parse(GameConfiguration.Instance.GetValue("cpDurationInDays")); // in days
            minutesPerWeek 	= (float) P0000_GameParams.Instance.MinutesPerWeek;	//5 minutes

            GameManager.Instance.RegisterEventHandler("TIMELINE", ProcessTimelineEvent);

            date = startDate;

            GameObject objCP = UIManager.Instance.GetHud("TimeLineCP");
            timeLine = objCP.GetComponent<TimeLine>();
            Log.Assert(timeLine, "Missing TimeLine");

            maxValue = duration * (minutesPerWeek * 60 / 7);

            timeLine.SetTimeBar(0,0,maxValue);

            //Edit TimelineCP Dates
            string text = "";
            text = I18nManager.Instance.Get ("Timeline", "001").Replace("TAG1", startDate.Day + "." + startDate.Month);
            I18nManager.Instance.Set ("Timeline", "001", text);
            text = I18nManager.Instance.Get ("Timeline", "002").Replace("BAU", startDate.AddDays(duration).Day + "." + startDate.AddDays(duration).Month);
            I18nManager.Instance.Set ("Timeline", "002", text);

            //UpdateCPTime (0);

            GameManager.Instance.Event ("TIMELINE", "CP", "Activate");
            GameManager.Instance.Event ("TIMELINE", "CP", "Start");
        }
Esempio n. 42
0
        //This is for curves that are tracked slightly differently from regular curves: Active curve and Z-index curve
        private void SetAdditionalCurves(Transform child, MainLineKey[] keys, TimeLine timeLine, AnimationClip clip, float defaultZ)
        {
            var positionChanged = false;
            var kfsZ            = new List <Keyframe> ();
            var changedZ        = false;
            var active          = child.gameObject.activeSelf; //If the sprite or bone isn't present in the mainline,
            var kfsActive       = new List <Keyframe> ();      //Disable the GameObject if it isn't already disabled
            var childPath       = GetPathToChild(child);

            foreach (var key in keys)               //If it is present, enable the GameObject if it isn't already enabled
            {
                var mref = ArrayUtility.Find(key.objectRefs, x => x.timeline == timeLine.id);
                if (mref != null)
                {
                    if (defaultZ == inf)
                    {
                        defaultZ        = mref.z_index;
                        positionChanged = true;
                    }
                    if (!changedZ && mref.z_index != defaultZ)
                    {
                        changedZ = true;
                        if (key.time > 0)
                        {
                            kfsZ.Add(new Keyframe(0f, defaultZ, inf, inf));
                        }
                    }
                    if (changedZ)
                    {
                        kfsZ.Add(new Keyframe(key.time, mref.z_index, inf, inf));
                    }
                    if (!active)
                    {
                        if (kfsActive.Count <= 0 && key.time > 0)
                        {
                            kfsActive.Add(new Keyframe(0f, 0f, inf, inf));
                        }
                        kfsActive.Add(new Keyframe(key.time, 1f, inf, inf));
                        active = true;
                    }
                }
                else if (active)
                {
                    if (kfsActive.Count <= 0 && key.time > 0)
                    {
                        kfsActive.Add(new Keyframe(0f, 1f, inf, inf));
                    }
                    kfsActive.Add(new Keyframe(key.time, 0f, inf, inf));
                    active = false;
                }
            }             //Only add these curves if there is actually a mutation
            if (kfsZ.Count > 0)
            {
                clip.SetCurve(childPath, typeof(Transform), "localPosition.z", new AnimationCurve(kfsZ.ToArray()));
                if (!positionChanged)
                {
                    var info = timeLine.keys [0].info;                     //If these curves don't actually exist, add some empty ones
                    clip.SetCurve(childPath, typeof(Transform), "localPosition.x", new AnimationCurve(new Keyframe(0f, info.x)));
                    clip.SetCurve(childPath, typeof(Transform), "localPosition.y", new AnimationCurve(new Keyframe(0f, info.y)));
                }
            }
            if (kfsActive.Count > 0)
            {
                clip.SetCurve(childPath, typeof(GameObject), "m_IsActive", new AnimationCurve(kfsActive.ToArray()));
            }
        }
Esempio n. 43
0
    public static TimeLine[] GetTimeLineItem(string gid, DateTime start, DateTime end)
    {
        DataTable dtTimeline = DBHelper.GetDataTable(" select * from  " + gid + "_timeline where ticktime >= '" + start.ToString() + "' and ticktime < '" + end.ToString() + "' order by ticktime ");
        DataTable dtNormal   = DBHelper.GetDataTable(" select * from " + gid + "  where convert(datetime, [date] + ' ' + [time]) >='"
                                                     + start.ToString() + "'  and  convert(datetime, [date] + ' ' + [time]) < '" + end.ToString() + "'  and 1 = 0 order by convert(datetime, [date] + ' ' + [time]) ");
        int timeLineCount = Math.Max(dtTimeline.Rows.Count, dtNormal.Rows.Count);

        TimeLine[] timeLineArray = new TimeLine[timeLineCount * 2];
        int        j             = 0;

        for (int i = 0; i < timeLineCount; i++)
        {
            //timeLineArray[i] = new TimeLine();
            DateTime currentDateTimeLine = DateTime.Parse("2000-1-1");
            if (i < dtTimeline.Rows.Count)
            {
                currentDateTimeLine = DateTime.Parse(dtTimeline.Rows[i]["ticktime"].ToString());
            }
            DateTime currentDateTimeNormal = DateTime.Parse("2000-1-1");
            if (i < dtNormal.Rows.Count)
            {
                currentDateTimeNormal = DateTime.Parse(dtNormal.Rows[i]["date"].ToString() + " " + dtNormal.Rows[i]["time"].ToString());
            }
            if (currentDateTimeNormal == currentDateTimeLine && currentDateTimeLine != DateTime.Parse("2000-1-1"))
            {
                timeLineArray[j]             = new TimeLine();
                timeLineArray[j].gid         = gid;
                timeLineArray[j].name        = dtNormal.Rows[i]["name"].ToString().Trim();
                timeLineArray[j].trade       = double.Parse(dtTimeline.Rows[i]["trade"].ToString().Trim());
                timeLineArray[j].buy         = double.Parse(dtTimeline.Rows[i]["buy"].ToString().Trim());
                timeLineArray[j].sell        = double.Parse(dtTimeline.Rows[i]["sell"].ToString().Trim());
                timeLineArray[j].settle      = double.Parse(dtTimeline.Rows[i]["settlement"].ToString().Trim());
                timeLineArray[j].open        = double.Parse(dtTimeline.Rows[i]["open"].ToString().Trim());
                timeLineArray[j].volume      = int.Parse(dtTimeline.Rows[i]["volume"].ToString().Trim());
                timeLineArray[j].amount      = double.Parse(dtTimeline.Rows[i]["amount"].ToString().Trim());
                timeLineArray[j].buy1        = int.Parse(dtNormal.Rows[i]["buyOne"].ToString());
                timeLineArray[j].buy1Amount  = double.Parse(dtNormal.Rows[i]["buyOnePri"].ToString());
                timeLineArray[j].buy2        = int.Parse(dtNormal.Rows[i]["buyTwo"].ToString());
                timeLineArray[j].buy2Amount  = double.Parse(dtNormal.Rows[i]["buyTwoPri"].ToString());
                timeLineArray[j].buy3        = int.Parse(dtNormal.Rows[i]["buyThree"].ToString());
                timeLineArray[j].buy3Amount  = double.Parse(dtNormal.Rows[i]["buyThreePri"].ToString());
                timeLineArray[j].buy4        = int.Parse(dtNormal.Rows[i]["buyFour"].ToString());
                timeLineArray[j].buy4Amount  = double.Parse(dtNormal.Rows[i]["buyFourPri"].ToString());
                timeLineArray[j].buy5        = int.Parse(dtNormal.Rows[i]["buyFive"].ToString());
                timeLineArray[j].buy5Amount  = double.Parse(dtNormal.Rows[i]["buyFivePri"].ToString());
                timeLineArray[j].sell1       = int.Parse(dtNormal.Rows[i]["sellOne"].ToString());
                timeLineArray[j].sell1Amount = int.Parse(dtNormal.Rows[i]["sellOnePri"].ToString());
                timeLineArray[j].sell2       = int.Parse(dtNormal.Rows[i]["sellTwo"].ToString());
                timeLineArray[j].sell2Amount = int.Parse(dtNormal.Rows[i]["sellTwoPri"].ToString());
                timeLineArray[j].sell3       = int.Parse(dtNormal.Rows[i]["sellThree"].ToString());
                timeLineArray[j].sell3Amount = int.Parse(dtNormal.Rows[i]["sellThreePri"].ToString());
                timeLineArray[j].sell4       = int.Parse(dtNormal.Rows[i]["sellFour"].ToString());
                timeLineArray[j].sell4Amount = int.Parse(dtNormal.Rows[i]["sellFourPri"].ToString());
                timeLineArray[j].sell5       = int.Parse(dtNormal.Rows[i]["sellFive"].ToString());
                timeLineArray[j].sell5Amount = int.Parse(dtNormal.Rows[i]["sellFivePri"].ToString());
                timeLineArray[j].tickTime    = DateTime.Parse(dtTimeline.Rows[i]["ticktime"].ToString());
                if (j > 0)
                {
                    timeLineArray[j].volumeIncrease = timeLineArray[j].volume - timeLineArray[j - 1].volume;
                    timeLineArray[j].amountIncrease = timeLineArray[j].amount - timeLineArray[j - 1].amount;
                }
                j++;
            }
            else
            {
                if (currentDateTimeLine < currentDateTimeNormal)
                {
                    if (currentDateTimeLine != DateTime.Parse("2000-1-1"))
                    {
                        timeLineArray[j]          = new TimeLine();
                        timeLineArray[j].gid      = gid;
                        timeLineArray[j].name     = dtTimeline.Rows[i]["name"].ToString().Trim();
                        timeLineArray[j].trade    = double.Parse(dtTimeline.Rows[i]["trade"].ToString().Trim());
                        timeLineArray[j].buy      = double.Parse(dtTimeline.Rows[i]["buy"].ToString().Trim());
                        timeLineArray[j].sell     = double.Parse(dtTimeline.Rows[i]["sell"].ToString().Trim());
                        timeLineArray[j].settle   = double.Parse(dtTimeline.Rows[i]["settlement"].ToString().Trim());
                        timeLineArray[j].open     = double.Parse(dtTimeline.Rows[i]["open"].ToString().Trim());
                        timeLineArray[j].volume   = int.Parse(dtTimeline.Rows[i]["volume"].ToString().Trim());
                        timeLineArray[j].amount   = double.Parse(dtTimeline.Rows[i]["amount"].ToString().Trim());
                        timeLineArray[j].tickTime = DateTime.Parse(dtTimeline.Rows[i]["ticktime"].ToString());
                        if (j > 0)
                        {
                            timeLineArray[j].volumeIncrease = timeLineArray[j].volume - timeLineArray[j - 1].volume;
                            timeLineArray[j].amountIncrease = timeLineArray[j].amount - timeLineArray[j - 1].amount;
                            timeLineArray[j].buy1           = timeLineArray[j - 1].buy1;
                            timeLineArray[j].buy1Amount     = timeLineArray[j - 1].buy1Amount;
                            timeLineArray[j].buy2           = timeLineArray[j - 1].buy2;
                            timeLineArray[j].buy2Amount     = timeLineArray[j - 1].buy2Amount;
                            timeLineArray[j].buy3           = timeLineArray[j - 1].buy3;
                            timeLineArray[j].buy3Amount     = timeLineArray[j - 1].buy3Amount;
                            timeLineArray[j].buy4           = timeLineArray[j - 1].buy4;
                            timeLineArray[j].buy4Amount     = timeLineArray[j - 1].buy4Amount;
                            timeLineArray[j].buy5           = timeLineArray[j - 1].buy5;
                            timeLineArray[j].buy5Amount     = timeLineArray[j - 1].buy5Amount;
                            timeLineArray[j].sell1          = timeLineArray[j - 1].sell1;
                            timeLineArray[j].sell1Amount    = timeLineArray[j - 1].sell1Amount;
                            timeLineArray[j].sell2          = timeLineArray[j - 1].sell2;
                            timeLineArray[j].sell2Amount    = timeLineArray[j - 1].sell2Amount;
                            timeLineArray[j].sell3          = timeLineArray[j - 1].sell3;
                            timeLineArray[j].sell3Amount    = timeLineArray[j - 1].sell3Amount;
                            timeLineArray[j].sell4          = timeLineArray[j - 1].sell4;
                            timeLineArray[j].sell4Amount    = timeLineArray[j - 1].sell4Amount;
                            timeLineArray[j].sell5          = timeLineArray[j - 1].sell5;
                            timeLineArray[j].sell5Amount    = timeLineArray[j - 1].sell5Amount;
                        }
                        j++;
                    }
                    timeLineArray[j]             = new TimeLine();
                    timeLineArray[j].gid         = gid;
                    timeLineArray[j].name        = dtNormal.Rows[i]["name"].ToString().Trim();
                    timeLineArray[j].trade       = double.Parse(dtNormal.Rows[i]["nowPri"].ToString().Trim());
                    timeLineArray[j].buy         = double.Parse(dtNormal.Rows[i]["competitivePri"].ToString().Trim());
                    timeLineArray[j].sell        = double.Parse(dtNormal.Rows[i]["reservePri"].ToString().Trim());
                    timeLineArray[j].settle      = double.Parse(dtNormal.Rows[i]["yestodEndPri"].ToString().Trim());
                    timeLineArray[j].open        = double.Parse(dtNormal.Rows[i]["todayStartPri"].ToString().Trim());
                    timeLineArray[j].volume      = int.Parse(dtNormal.Rows[i]["traNumber"].ToString().Trim());
                    timeLineArray[j].amount      = double.Parse(dtNormal.Rows[i]["traAmount"].ToString().Trim());
                    timeLineArray[j].buy1        = int.Parse(dtNormal.Rows[i]["buyOne"].ToString());
                    timeLineArray[j].buy1Amount  = double.Parse(dtNormal.Rows[i]["buyOnePri"].ToString());
                    timeLineArray[j].buy2        = int.Parse(dtNormal.Rows[i]["buyTwo"].ToString());
                    timeLineArray[j].buy2Amount  = double.Parse(dtNormal.Rows[i]["buyTwoPri"].ToString());
                    timeLineArray[j].buy3        = int.Parse(dtNormal.Rows[i]["buyThree"].ToString());
                    timeLineArray[j].buy3Amount  = double.Parse(dtNormal.Rows[i]["buyThreePri"].ToString());
                    timeLineArray[j].buy4        = int.Parse(dtNormal.Rows[i]["buyFour"].ToString());
                    timeLineArray[j].buy4Amount  = double.Parse(dtNormal.Rows[i]["buyFourPri"].ToString());
                    timeLineArray[j].buy5        = int.Parse(dtNormal.Rows[i]["buyFive"].ToString());
                    timeLineArray[j].buy5Amount  = double.Parse(dtNormal.Rows[i]["buyFivePri"].ToString());
                    timeLineArray[j].sell1       = int.Parse(dtNormal.Rows[i]["sellOne"].ToString());
                    timeLineArray[j].sell1Amount = double.Parse(dtNormal.Rows[i]["sellOnePri"].ToString());
                    timeLineArray[j].sell2       = int.Parse(dtNormal.Rows[i]["sellTwo"].ToString());
                    timeLineArray[j].sell2Amount = double.Parse(dtNormal.Rows[i]["sellTwoPri"].ToString());
                    timeLineArray[j].sell3       = int.Parse(dtNormal.Rows[i]["sellThree"].ToString());
                    timeLineArray[j].sell3Amount = double.Parse(dtNormal.Rows[i]["sellThreePri"].ToString());
                    timeLineArray[j].sell4       = int.Parse(dtNormal.Rows[i]["sellFour"].ToString());
                    timeLineArray[j].sell4Amount = double.Parse(dtNormal.Rows[i]["sellFourPri"].ToString());
                    timeLineArray[j].sell5       = int.Parse(dtNormal.Rows[i]["sellFive"].ToString());
                    timeLineArray[j].sell5Amount = double.Parse(dtNormal.Rows[i]["sellFivePri"].ToString());
                    timeLineArray[j].tickTime    = DateTime.Parse(dtNormal.Rows[i]["date"].ToString() + " " + dtNormal.Rows[i]["time"].ToString());
                    if (j > 0)
                    {
                        timeLineArray[j].volumeIncrease = timeLineArray[j].volume - timeLineArray[j - 1].volume;
                        timeLineArray[j].amountIncrease = timeLineArray[j].amount - timeLineArray[j - 1].amount;
                    }
                    j++;
                }
                else
                {
                    if (currentDateTimeNormal < currentDateTimeLine)
                    {
                        if (currentDateTimeNormal != DateTime.Parse("2000-1-1"))
                        {
                            timeLineArray[j]             = new TimeLine();
                            timeLineArray[j].gid         = gid;
                            timeLineArray[j].name        = dtNormal.Rows[i]["name"].ToString().Trim();
                            timeLineArray[j].trade       = double.Parse(dtNormal.Rows[i]["nowPri"].ToString().Trim());
                            timeLineArray[j].buy         = double.Parse(dtNormal.Rows[i]["competitivePri"].ToString().Trim());
                            timeLineArray[j].sell        = double.Parse(dtNormal.Rows[i]["reservePri"].ToString().Trim());
                            timeLineArray[j].settle      = double.Parse(dtNormal.Rows[i]["yestodEndPri"].ToString().Trim());
                            timeLineArray[j].open        = double.Parse(dtNormal.Rows[i]["todayStartPri"].ToString().Trim());
                            timeLineArray[j].volume      = int.Parse(dtTimeline.Rows[i]["traNumber"].ToString().Trim());
                            timeLineArray[j].amount      = double.Parse(dtTimeline.Rows[i]["traAmount"].ToString().Trim());
                            timeLineArray[j].buy1        = int.Parse(dtNormal.Rows[i]["buyOne"].ToString());
                            timeLineArray[j].buy1Amount  = double.Parse(dtNormal.Rows[i]["buyOnePri"].ToString());
                            timeLineArray[j].buy2        = int.Parse(dtNormal.Rows[i]["buyTwo"].ToString());
                            timeLineArray[j].buy2Amount  = double.Parse(dtNormal.Rows[i]["buyTwoPri"].ToString());
                            timeLineArray[j].buy3        = int.Parse(dtNormal.Rows[i]["buyThree"].ToString());
                            timeLineArray[j].buy3Amount  = double.Parse(dtNormal.Rows[i]["buyThreePri"].ToString());
                            timeLineArray[j].buy4        = int.Parse(dtNormal.Rows[i]["buyFour"].ToString());
                            timeLineArray[j].buy4Amount  = double.Parse(dtNormal.Rows[i]["buyFourPri"].ToString());
                            timeLineArray[j].buy5        = int.Parse(dtNormal.Rows[i]["buyFive"].ToString());
                            timeLineArray[j].buy5Amount  = double.Parse(dtNormal.Rows[i]["buyFivePri"].ToString());
                            timeLineArray[j].sell1       = int.Parse(dtNormal.Rows[i]["sellOne"].ToString());
                            timeLineArray[j].sell1Amount = double.Parse(dtNormal.Rows[i]["sellOnePri"].ToString());
                            timeLineArray[j].sell2       = int.Parse(dtNormal.Rows[i]["sellTwo"].ToString());
                            timeLineArray[j].sell2Amount = double.Parse(dtNormal.Rows[i]["sellTwoPri"].ToString());
                            timeLineArray[j].sell3       = int.Parse(dtNormal.Rows[i]["sellThree"].ToString());
                            timeLineArray[j].sell3Amount = double.Parse(dtNormal.Rows[i]["sellThreePri"].ToString());
                            timeLineArray[j].sell4       = int.Parse(dtNormal.Rows[i]["sellFour"].ToString());
                            timeLineArray[j].sell4Amount = double.Parse(dtNormal.Rows[i]["sellFourPri"].ToString());
                            timeLineArray[j].sell5       = int.Parse(dtNormal.Rows[i]["sellFive"].ToString());
                            timeLineArray[j].sell5Amount = double.Parse(dtNormal.Rows[i]["sellFivePri"].ToString());
                            timeLineArray[j].tickTime    = DateTime.Parse(dtNormal.Rows[i]["date"].ToString() + " " + dtNormal.Rows[i]["time"].ToString());
                            if (j > 0)
                            {
                                timeLineArray[j].volumeIncrease = timeLineArray[j].volume - timeLineArray[j - 1].volume;
                                timeLineArray[j].amountIncrease = timeLineArray[j].amount - timeLineArray[j - 1].amount;
                            }
                            j++;
                        }
                    }
                    timeLineArray[j]          = new TimeLine();
                    timeLineArray[j].gid      = gid;
                    timeLineArray[j].name     = dtTimeline.Rows[i]["name"].ToString().Trim();
                    timeLineArray[j].trade    = double.Parse(dtTimeline.Rows[i]["trade"].ToString().Trim());
                    timeLineArray[j].buy      = double.Parse(dtTimeline.Rows[i]["buy"].ToString().Trim());
                    timeLineArray[j].sell     = double.Parse(dtTimeline.Rows[i]["sell"].ToString().Trim());
                    timeLineArray[j].settle   = double.Parse(dtTimeline.Rows[i]["settlement"].ToString().Trim());
                    timeLineArray[j].open     = double.Parse(dtTimeline.Rows[i]["open"].ToString().Trim());
                    timeLineArray[j].volume   = int.Parse(dtTimeline.Rows[i]["volume"].ToString().Trim());
                    timeLineArray[j].amount   = double.Parse(dtTimeline.Rows[i]["amount"].ToString().Trim());
                    timeLineArray[j].tickTime = DateTime.Parse(dtTimeline.Rows[i]["ticktime"].ToString());
                    if (j > 0)
                    {
                        timeLineArray[j].volumeIncrease = timeLineArray[j].volume - timeLineArray[j - 1].volume;
                        timeLineArray[j].amountIncrease = timeLineArray[j].amount - timeLineArray[j - 1].amount;
                        timeLineArray[j].buy1           = timeLineArray[j - 1].buy1;
                        timeLineArray[j].buy1Amount     = timeLineArray[j - 1].buy1Amount;
                        timeLineArray[j].buy2           = timeLineArray[j - 1].buy2;
                        timeLineArray[j].buy2Amount     = timeLineArray[j - 1].buy2Amount;
                        timeLineArray[j].buy3           = timeLineArray[j - 1].buy3;
                        timeLineArray[j].buy3Amount     = timeLineArray[j - 1].buy3Amount;
                        timeLineArray[j].buy4           = timeLineArray[j - 1].buy4;
                        timeLineArray[j].buy4Amount     = timeLineArray[j - 1].buy4Amount;
                        timeLineArray[j].buy5           = timeLineArray[j - 1].buy5;
                        timeLineArray[j].buy5Amount     = timeLineArray[j - 1].buy5Amount;
                        timeLineArray[j].sell1          = timeLineArray[j - 1].sell1;
                        timeLineArray[j].sell1Amount    = timeLineArray[j - 1].sell1Amount;
                        timeLineArray[j].sell2          = timeLineArray[j - 1].sell2;
                        timeLineArray[j].sell2Amount    = timeLineArray[j - 1].sell2Amount;
                        timeLineArray[j].sell3          = timeLineArray[j - 1].sell3;
                        timeLineArray[j].sell3Amount    = timeLineArray[j - 1].sell3Amount;
                        timeLineArray[j].sell4          = timeLineArray[j - 1].sell4;
                        timeLineArray[j].sell4Amount    = timeLineArray[j - 1].sell4Amount;
                        timeLineArray[j].sell5          = timeLineArray[j - 1].sell5;
                        timeLineArray[j].sell5Amount    = timeLineArray[j - 1].sell5Amount;
                    }
                    j++;
                }
            }
        }
        TimeLine[] timeLineRetArr = new TimeLine[j];
        for (int k = 0; k < j; k++)
        {
            timeLineRetArr[k] = timeLineArray[k];
        }
        return(timeLineRetArr);
    }
Esempio n. 44
0
        private IDictionary <ChangedValues, AnimationCurve> GetCurves(TimeLine timeLine, SpatialInfo defaultInfo, List <TimeLineKey> parentTimeline)
        {
            var rv = new Dictionary <ChangedValues, AnimationCurve> (); //This method checks every animatable property for changes

            foreach (var key in timeLine.keys)                          //And creates a curve for that property if changes are detected
            {
                var info = key.info;
                if (!info.processed)
                {
                    SpatialInfo parentInfo = null;
                    if (parentTimeline != null)
                    {
                        var pKey = parentTimeline.Find(x => x.time == key.time);
                        if (pKey == null)
                        {
                            var pKeys = parentTimeline.FindAll(x => x.time < key.time);
                            pKeys.Sort((x, y) => x.time.CompareTo(y.time) * -1);
                            if (pKeys.Count > 0)
                            {
                                pKey = pKeys [0];
                            }
                            else
                            {
                                pKeys = parentTimeline.FindAll(x => x.time > key.time);
                                pKeys.Sort((x, y) => x.time.CompareTo(y.time));
                                if (pKeys.Count > 0)
                                {
                                    pKey = pKeys [0];
                                }
                            }
                        }
                        if (pKey != null)
                        {
                            parentInfo = pKey.info;
                        }
                    }
                    info.Process(parentInfo);
                }
                if (!rv.ContainsKey(ChangedValues.PositionX) && (defaultInfo.x != info.x || defaultInfo.y != info.y))
                {
                    rv [ChangedValues.PositionX] = new AnimationCurve();                      //There will be irregular behaviour if curves aren't added for all members
                    rv [ChangedValues.PositionY] = new AnimationCurve();                      //in a group, so when one is set, the others have to be set as well
                    rv [ChangedValues.PositionZ] = new AnimationCurve();
                }
                if (!rv.ContainsKey(ChangedValues.RotationZ) && (defaultInfo.rotation.z != info.rotation.z || defaultInfo.rotation.w != info.rotation.w))
                {
                    rv [ChangedValues.RotationZ] = new AnimationCurve();                 //x and y not necessary since the default of 0 is fine
                    rv [ChangedValues.RotationW] = new AnimationCurve();
                }
                if (!rv.ContainsKey(ChangedValues.ScaleX) && (defaultInfo.scale_x != info.scale_x || defaultInfo.scale_y != info.scale_y))
                {
                    rv [ChangedValues.ScaleX] = new AnimationCurve();
                    rv [ChangedValues.ScaleY] = new AnimationCurve();
                    rv [ChangedValues.ScaleZ] = new AnimationCurve();
                }
                if (!rv.ContainsKey(ChangedValues.Alpha) && defaultInfo.a != info.a)
                {
                    rv [ChangedValues.Alpha] = new AnimationCurve();
                }
                var scontrol = defaultInfo as SpriteInfo;
                if (scontrol != null && !rv.ContainsKey(ChangedValues.Sprite))
                {
                    var sinfo = (SpriteInfo)info;
                    if (scontrol.file != sinfo.file || scontrol.folder != sinfo.folder)
                    {
                        rv [ChangedValues.Sprite] = new AnimationCurve();
                    }
                }
            }
            return(rv);
        }
Esempio n. 45
0
 private void OnSaveGame(object obj)
 {
     saveIcon.SetActive(true);
     TimeLine.GetInstance().AddTimeEvent(HideSaveIcon, 1f, null, gameObject);
 }
		private void SetCurves (Transform child, SpatialInfo defaultInfo, List<TimeLineKey> parentTimeline, TimeLine timeLine, AnimationClip clip, Animation animation) {
			var defZ = 0f;
			SetCurves (child, defaultInfo, parentTimeline, timeLine, clip, animation, ref defZ);
		}
Esempio n. 47
0
        //TODO Move to datahandlersevice
        //* Returns list with Events of itempurchases that participantId did
        public List <List <Event> > GetItemEventsForParticipant(int participantId, TimeLine timeline)
        {
            try
            {
                //Gets list with all item purchases and sells
                var result = timeline.Frames
                             .Select(x => x.Events
                                     .Where(
                                         y => y.ParticipantId == participantId &&
                                         y.Type == TypeEnum.ItemPurchased ||
                                         y.Type == TypeEnum.ItemUndo &&
                                         y.ParticipantId == participantId ||
                                         y.Type == TypeEnum.ItemSold &&
                                         y.ParticipantId == participantId
                                         ).ToList()
                                     ).ToList();

                result = result.Where(x => x.Count > 0).ToList();
                int index = 0;
                //* Removes undo items from list
                foreach (var frame in result.ToList())
                {
                    foreach (var item in frame.ToList())
                    {
                        if (item.Type == TypeEnum.ItemUndo)
                        {
                            var undo = frame.Where(x => x.ItemId == item.AfterId || x.ItemId == item.BeforeId).FirstOrDefault();
                            if (undo == null)
                            {
                                //TODO Fix dis undo item kan hamna i frame innan.
                                var itemExist = result.ElementAt(index - 1).Where(x => x.ItemId == item.AfterId || x.ItemId == item.BeforeId).FirstOrDefault();
                                result.ElementAt(index - 1).Remove(itemExist);
                                frame.Remove(item);
                            }
                            else
                            {
                                frame.Remove(undo);
                                frame.Remove(item);
                            }
                        }
                    }
                    //* To remove duplicates for frontend
                    var moreThanOne = frame
                                      .GroupBy(x => x.ItemId)
                                      .Where(g => g.Count() > 1)
                                      .Select(z => z.First()).ToList();
                    if (moreThanOne.Count > 0)
                    {
                        foreach (var item in moreThanOne)
                        {
                            var rFrame = item;
                            rFrame.Quantity = frame
                                              .Where(x => x.ItemId == rFrame.ItemId && x.Type == rFrame.Type)
                                              .Count();
                            frame.RemoveAll(x => x.ItemId == rFrame.ItemId && x.Type == rFrame.Type);
                            frame.Add(rFrame);
                        }
                    }
                    index++;
                }
                result = result.Where(x => x.Count != 0).ToList();
                return(result);
            }
            catch (System.Exception ex)
            {
                string msg = ex.Message;
                throw ex;
            }
        }
		private void SetCurves (Transform child, SpatialInfo defaultInfo, List<TimeLineKey> parentTimeline, TimeLine timeLine, AnimationClip clip, Animation animation, ref float defaultZ) {
			var childPath = GetPathToChild (child);
			foreach (var kvPair in GetCurves (timeLine, defaultInfo, parentTimeline)) { //Makes sure that curves are only added for properties 
				switch (kvPair.Key) {									//that actually mutate in the animation
				case ChangedValues.PositionX :
					SetKeys (kvPair.Value, timeLine, x => x.x, animation);
					clip.SetCurve (childPath, typeof(Transform), "localPosition.x", kvPair.Value);
					break;
				case ChangedValues.PositionY :
					SetKeys (kvPair.Value, timeLine, x => x.y, animation);
					clip.SetCurve (childPath, typeof(Transform), "localPosition.y", kvPair.Value);
					break;
				case ChangedValues.PositionZ :
					kvPair.Value.AddKey (0f, defaultZ);
					clip.SetCurve (childPath, typeof(Transform), "localPosition.z", kvPair.Value);
					defaultZ = inf; //Lets the next method know this value has been set
					break;
				case ChangedValues.RotationZ :
					SetKeys (kvPair.Value, timeLine, x => x.rotation.z, animation);
					clip.SetCurve (childPath, typeof(Transform), "localRotation.z", kvPair.Value);
					break;
				case ChangedValues.RotationW :
					SetKeys (kvPair.Value, timeLine, x => x.rotation.w, animation);
					clip.SetCurve (childPath, typeof(Transform), "localRotation.w", kvPair.Value);
					break;
				case ChangedValues.ScaleX :
					SetKeys (kvPair.Value, timeLine, x => x.scale_x, animation);
					clip.SetCurve (childPath, typeof(Transform), "localScale.x", kvPair.Value);
					break;
				case ChangedValues.ScaleY :
					SetKeys (kvPair.Value, timeLine, x => x.scale_y, animation);
					clip.SetCurve (childPath, typeof(Transform), "localScale.y", kvPair.Value);
					break;
				case ChangedValues.ScaleZ :
					kvPair.Value.AddKey (0f, 1f);
					clip.SetCurve (childPath, typeof(Transform), "localScale.z", kvPair.Value);
					break;
				case ChangedValues.Alpha :
					SetKeys (kvPair.Value, timeLine, x => x.a, animation);
					clip.SetCurve (childPath, typeof(SpriteRenderer), "m_Color.a", kvPair.Value);
					break;
				case ChangedValues.Sprite :
					var swapper = child.GetComponent<TextureController> ();
					if (swapper == null) { //Add a Texture Controller if one doesn't already exist
						swapper = child.gameObject.AddComponent<TextureController> ();
						var info = (SpriteInfo)defaultInfo;
						swapper.Sprites = new[] {Folders [info.folder] [info.file]};
					}
					SetKeys (kvPair.Value, timeLine, ref swapper.Sprites, animation);
					clip.SetCurve (childPath, typeof(TextureController), "DisplayedSprite", kvPair.Value);
					break;
				}
			}
			clip.EnsureQuaternionContinuity ();
		}
Esempio n. 49
0
 public static void SaveUserFollowers(oAuthTwitter OAuth, string screeenName, string TwitterUserId)
 {
     try
     {
         TimeLine _TimeLine   = new TimeLine();
         JArray   jdata       = _TimeLine.Get_User_Followers(OAuth);
         JArray   user_data   = JArray.Parse(jdata[0]["users"].ToString());
         string   curser      = string.Empty;
         string   curser_next = string.Empty;
         try
         {
             curser_next = jdata[0]["next_cursor"].ToString();
         }
         catch (Exception ex)
         {
             curser_next = "0";
         }
         do
         {
             curser = curser_next;
             Domain.Socioboard.Models.Mongo.MongoTwitterMessage _InboxMessages;
             if (jdata != null)
             {
                 apiHitsCount++;
                 foreach (var item in user_data)
                 {
                     try
                     {
                         _InboxMessages            = new Domain.Socioboard.Models.Mongo.MongoTwitterMessage();
                         _InboxMessages.id         = ObjectId.GenerateNewId();
                         _InboxMessages.profileId  = TwitterUserId;
                         _InboxMessages.type       = Domain.Socioboard.Enum.TwitterMessageType.TwitterFollower;
                         _InboxMessages.messageId  = "";
                         _InboxMessages.readStatus = 1;
                         try
                         {
                             _InboxMessages.twitterMsg = item["description"].ToString();
                         }
                         catch (Exception ex)
                         {
                         }
                         try
                         {
                             _InboxMessages.fromId = item["id_str"].ToString();
                         }
                         catch (Exception ex)
                         {
                             _InboxMessages.fromId = item["id"].ToString();
                         }
                         try
                         {
                             _InboxMessages.fromName = item["screen_name"].ToString();
                         }
                         catch (Exception ex)
                         {
                         }
                         try
                         {
                             _InboxMessages.FollowerCount = Convert.ToInt32(item["followers_count"].ToString());
                         }
                         catch (Exception ex)
                         {
                         }
                         try
                         {
                             _InboxMessages.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                         }
                         catch (Exception ex)
                         {
                         }
                         try
                         {
                             _InboxMessages.fromProfileUrl = item["profile_image_url"].ToString();
                         }
                         catch (Exception ex)
                         {
                             _InboxMessages.fromProfileUrl = item["profile_image_url_https"].ToString();
                         }
                         try
                         {
                             _InboxMessages.messageDate      = DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss");
                             _InboxMessages.messageTimeStamp = Domain.Socioboard.Helpers.SBHelper.ConvertToUnixTimestamp(DateTime.UtcNow);
                         }
                         catch (Exception ex)
                         {
                         }
                         _InboxMessages.RecipientId   = TwitterUserId;
                         _InboxMessages.RecipientName = screeenName;
                         MongoRepository mongorepo = new MongoRepository("MongoTwitterMessage");
                         var             result    = mongorepo.Find <Domain.Socioboard.Models.Mongo.MongoTwitterMessage>(t => t.fromId == _InboxMessages.fromId && t.RecipientId == _InboxMessages.RecipientId && t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterFollower);
                         var             task      = Task.Run(async() =>
                         {
                             return(await result);
                         });
                         IList <Domain.Socioboard.Models.Mongo.MongoTwitterMessage> lstMongoTwitterMessage = task.Result;
                         if (lstMongoTwitterMessage.Count > 0)
                         {
                             mongorepo.UpdateReplace <Domain.Socioboard.Models.Mongo.MongoTwitterMessage>(_InboxMessages, t => t.id == lstMongoTwitterMessage[0].id);
                         }
                         else
                         {
                             mongorepo.Add <Domain.Socioboard.Models.Mongo.MongoTwitterMessage>(_InboxMessages);
                         }
                     }
                     catch (Exception ex)
                     {
                     }
                 }
             }
             else
             {
                 apiHitsCount = MaxapiHitsCount;
             }
             if (curser != "0")
             {
                 jdata       = _TimeLine.Get_User_FollowersWithCurser(OAuth, curser);
                 user_data   = JArray.Parse(jdata[0]["users"].ToString());
                 curser_next = jdata[0]["next_cursor"].ToString();
             }
         }while (curser != "0");
     }
     catch (Exception ex)
     {
         apiHitsCount = MaxapiHitsCount;
     }
 }
		//This is for curves that are tracked slightly differently from regular curves: Active curve and Z-index curve
		private void SetAdditionalCurves (Transform child, MainLineKey[] keys, TimeLine timeLine, AnimationClip clip, float defaultZ) {
			var positionChanged = false;
			var kfsZ = new List<Keyframe> ();
			var changedZ = false;
			var active = child.gameObject.activeSelf; //If the sprite or bone isn't present in the mainline,
			var kfsActive = new List<Keyframe> (); //Disable the GameObject if it isn't already disabled
			var childPath = GetPathToChild (child);
			foreach (var key in keys) { //If it is present, enable the GameObject if it isn't already enabled
				var mref = ArrayUtility.Find (key.objectRefs, x => x.timeline == timeLine.id);
				if (mref != null) {
					if (defaultZ == inf) {
						defaultZ = mref.z_index;
						positionChanged = true;
					}
					if (!changedZ && mref.z_index != defaultZ) {
						changedZ = true;
						if (key.time > 0) kfsZ.Add (new Keyframe (0f, defaultZ, inf, inf));
					}
					if (changedZ) 
						kfsZ.Add (new Keyframe (key.time, mref.z_index, inf, inf));
					if (!active) {
						if (kfsActive.Count <= 0 && key.time > 0) kfsActive.Add (new Keyframe (0f, 0f, inf, inf));
						kfsActive.Add (new Keyframe (key.time, 1f, inf, inf));
						active = true;
					}
				}
				else if (active) {
					if (kfsActive.Count <= 0 && key.time > 0) kfsActive.Add (new Keyframe (0f, 1f, inf, inf));
					kfsActive.Add (new Keyframe (key.time, 0f, inf, inf));
					active = false;
				}
			} //Only add these curves if there is actually a mutation
			if (kfsZ.Count > 0) {
				clip.SetCurve (childPath, typeof(Transform), "localPosition.z", new AnimationCurve (kfsZ.ToArray ()));
				if (!positionChanged) {
					var info = timeLine.keys [0].info; //If these curves don't actually exist, add some empty ones
					clip.SetCurve (childPath, typeof(Transform), "localPosition.x", new AnimationCurve (new Keyframe (0f, info.x)));
					clip.SetCurve (childPath, typeof(Transform), "localPosition.y", new AnimationCurve (new Keyframe (0f, info.y)));
				}
			}
			if (kfsActive.Count > 0) clip.SetCurve (childPath, typeof(GameObject), "m_IsActive", new AnimationCurve (kfsActive.ToArray ()));
		}
Esempio n. 51
0
        static void Main(string[] args)
        {
            var jobCount = 10;
            TimeLine tl = new TimeLine(TimeSpan.FromHours(10), TimeSpan.FromHours(13));
            List<Job> jobs = new List<Job>();

            for (int i = 0; i < jobCount; i++)
            {
                Job j = Job.CreateJob(tl);
                j.EkranaJobYaz(tl);
                jobs.Add(j);
            }

            var baslamaSaatiGruplu = jobs.OrderBy(x => x.JobLength).GroupBy(x => x.Baslangic).OrderBy(a => a.Key);
            var avaregeJobLength = jobs.Average(x => x.JobLength);
            Console.WriteLine("Ortalama Uzunluk : {0:0.00}", avaregeJobLength);

            Console.WriteLine();
            Console.WriteLine();

            var secilenler = new List<Job>();

            foreach (var group in baslamaSaatiGruplu)
            {

                var uyanlar = group.Where(x => x.JobLength < avaregeJobLength).ToList();
                if (secilenler.Count == 0)
                {
                    if (uyanlar.Count > 0)
                    {
                        secilenler.Add(uyanlar.Last());
                    }
                }
                else
                {
                    bool eklendiMi = false;
                    foreach (Job item in uyanlar)
                    {
                        if (item.Baslangic > secilenler.Last().Bitis)
                        {
                            secilenler.Add(item);
                            eklendiMi = true;
                            break;
                        }
                    }

                    if (!eklendiMi)
                    {
                        var buyukler = group.Where(x => x.JobLength > avaregeJobLength).OrderBy(x => x.JobLength).ToList();
                        foreach (Job item in buyukler)
                        {
                            if (secilenler.Count==0)
                            {
                                secilenler.Add(item);
                                break;
                            }
                            if (item.Baslangic > secilenler.Last().Bitis)
                            {
                                secilenler.Add(item);
                            }
                        }
                    }

                }

            }

            foreach (var item in secilenler)
            {
                item.EkranaJobYaz(tl);
            }

            Console.ReadLine();
        }
        /// <summary>
        /// All Triggers of the game by default/start
        /// </summary>
        /// <returns>true if game started</returns>
        public override void StartSetup()
        {
            //Initiates Variables
            if (GameScenario.Instance.simStartYear == 0)
                startDate		= GameScenario.Instance.currentDate;
            else
                startDate		= new DateTime(GameScenario.Instance.simStartYear,
                                          	   GameScenario.Instance.simStartMonth,
                                          	   GameScenario.Instance.simStartDay);
            TimeSpan span 	= startDate.AddYears ((int)GameScenario.Instance.simDurationInYears) - startDate;
            duration 		= (float) span.TotalDays;	//in days
            //WebPlayerDebugManager.addOutput (duration + " Days from " + startDate + " till " + startDate.AddYears((int)GameScenario.Instance.simDurationInYears), 1);
            minutesPerYear 	= (float)P0000_GameParams.Instance.MinutesPerYear;

            GameObject obj = UIManager.Instance.GetPopup("SaveSimPopup");
            if(obj)
            {
                obj.SetActive(false);
            }

            GameManager.Instance.RegisterEventHandler("TIMELINE", ProcessTimelineEvent);

            simMenu = UIManager.Instance.GetHud ("SimulationMenu");
            simMenu.SetActive (true);
            scoreBoard = UIManager.Instance.GetHud ("ScoreBoard");
            scoreBoard.SetActive (true);
            date = startDate;

            GameObject objSIM = UIManager.Instance.GetHud("TimeLineSIM");
            timeLine = objSIM.GetComponent<TimeLine>();

            maxValue = duration * (minutesPerYear * 60 / 365);
            timeLine.SetTimeBar(0,0,maxValue);

            //Edit TimelineSIM Dates
            //TODO When shall this start?
            string text = "";
            text = I18nManager.Instance.Get ("Timeline", "003").Replace("SIMTAG1", startDate.Month + "." + startDate.Year);
            I18nManager.Instance.Set ("Timeline", "003", text);
            text = I18nManager.Instance.Get ("Timeline", "004").Replace("SIMBAU", startDate.AddDays (duration).Month + "." + startDate.AddDays (duration).Year);
            I18nManager.Instance.Set ("Timeline", "004", text);

            //Starts the Timeline
            GameManager.Instance.Event ("TIMELINE", "SIM", "Activate");
            GameManager.Instance.Event ("TIMELINE", "SIM", "Start");
        }