Exemplo n.º 1
0
    void Update()
    {
        //매월 10일 0시에 월세를 걷습니다.
        if (theDate.day == 10 && theDate.hour == 0 && flag == 0)
        {
            flag = 1;
            double totalRent = 0; //전체 월세 계산
            for (int i = 0; i < myBuildings.Length; i++)
            {
                if (myBuildings[i].buildingSold)
                {
                    totalRent += myBuildings[i].MonthlyRentValue();
                }
            }

            theNotice.NotificationAppear("매월 10일 월세를 걷습니다." + totalRent);
            /*레포트용 건물 월 거래비용 계산*/
            theReport.nMonthEarnEstateMoney += totalRent;
            theStat.myAllMoney += totalRent;
        }
        if (theDate.day == 10 && theDate.hour == 1)
        {
            flag = 0;
        }

        /* 시간이 지남에 따라 건물이 점점 낡습니다.. */
        if (DateManager.activated)
        {
            for (int i = 0; i < myBuildings.Length; i++)
            {
                if (myBuildings[i].buildingSold)
                {
                    myBuildings[i].currentTime -= Time.deltaTime;

                    if (myBuildings[i].currentTime < 0.0f)
                    {
                        myBuildings[i].currentTime = myBuildings[i].updateTime;
                        if (myBuildings[i].buildingCondition > 0.0f)
                        {  //각 빌딩의 updateTime이 지날때마다 1/100씩 낡아집니다.
                            myBuildings[i].buildingCondition         -= 0.01f;
                            myBuildings[i].buildingConditionText.text = "건물 상태 : " + (int)(myBuildings[i].buildingCondition * 100) + "/100";
                        }
                        if (myBuildings[i].buildingCondition < 0.1f)
                        {
                            myBuildings[i].buildingRentText.text = "월세 : $" + string.Format("{0}", myBuildings[i].MonthlyRentValue().ToString("n0"));
                            //10/100이하일 경우 지속적으로 주민으로부터 쪽지를 받습니다.
                            int        n       = DatabaseManager.buildingConditionNoteList.Count;
                            SimpleNote newNote = DatabaseManager.buildingConditionNoteList[Random.Range(0, n)];
                            newNote.SetWhom(myBuildings[i].buildingNameText.text + " 주민");
                            theNews.SetNewNote(newNote);

                            SimpleNote newNote2 = new SimpleNote(myBuildings[i].buildingNameText.text + "의 열악한 건물 상태에 방을 빼겠다는 주민들이 늘어나고 있습니다. 관계자의 말에 따르면 늘어나는 주민 불만에 월세 수입이 줄어들었다고 합니다.");
                            newNote2.SetWhom("동네 신문");
                            theNews.SetNewNote(newNote2);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
 /* 간단한 쪽지를 받는다 (뉴스 연계 안된다) */
 public void SetNewNote(SimpleNote newNote)
 {
     newsList.Add(new News(-1, newNote.fromWhom, newNote.content, -1, -1, 0)); //newNote 타입을 news타입으로 변환
     newsList[newsList.Count - 1].SetDate(theDate.year, theDate.month, theDate.day);
     SetAlert();
     theNotice.NotificationAppear("누군가 쪽지를 보냈습니다.");
 }
Exemplo n.º 3
0
 /// <summary>
 /// WPF OnKeyDown Event Handler
 /// </summary>
 /// <param name="s"></param>
 /// <param name="e"></param>
 public void wpfKeyDown(object s, KeyEventArgs e)
 {
     if (!IsKeyDown(e.Key))
     {
         SimpleNote n = ConvertKeyToNote(e.Key); midi.PlayNote(n); UpdateUI(n, e.Key); AddKeyDown(e.Key);
     }
 }
    public override void Draw(Graphics g)
    {
        SimpleNote left  = new SimpleNote(Location);
        SimpleNote right = new SimpleNote(new Point(Location.X + 20, Location.Y));

        left.Draw(g);
        right.Draw(g);
        g.DrawLine(new Pen(Color.Red), Location.X + 5, Location.Y - 15, Location.X + 25, Location.Y - 15);
    }
 private void OnBindBaseNoteExecute(SimpleNote simpleNote)
 {
     if (!isBindedBaseNote)
     {
         simpleNote.DataContext.Note        = Context;
         simpleNote.DataContext.Deleting   += () => { Deleting?.Invoke(); };
         simpleNote.DataContext.SelectDate += (n) => { SelectDate?.Invoke(Context); };
         isBindedBaseNote = true;
     }
 }
Exemplo n.º 6
0
        public BaseNote GetNoteById(long id)
        {
            SimpleNote simpleNote = (SimpleNote)simpleNoteHelper.GetNoteById(id);

            if (simpleNote.ScheduledNotification != null && simpleNote.ScheduledNotification.Date.Add(simpleNote.ScheduledNotification.Time) < DateTimeOffset.Now)
            {
                Debug.WriteLine("Notification too old..deleting");
                this.DeleteNotification(id);
                simpleNote.ScheduledNotification = null;
            }
            return(simpleNote);
        }
Exemplo n.º 7
0
            public void UpdateNoteAndNotification(long noteId, string title, string content, string schedulingId, DateTimeOffset dateTime)
            {
                SimpleNote note = (SimpleNote)GetNoteById(noteId);
                long       notificationId;

                if (note.ScheduledNotification != null)
                {
                    Debug.WriteLine("Updating notification with id : " + note.ScheduledNotification.DataBaseId);
                    NotificationHelper.UpdateNotification(note.ScheduledNotification.DataBaseId, schedulingId, dateTime);
                    notificationId = note.ScheduledNotification.DataBaseId;
                }
                else
                {
                    notificationId = NotificationHelper.AddNotification(schedulingId, dateTime);
                }
                UpdateNote(noteId, title, content, notificationId);
            }
Exemplo n.º 8
0
            public BaseNote GetNoteById(long id)
            {
                Debug.WriteLine("Searching notification with note_id " + id);
                ISQLiteStatement statement = dbConn.Prepare(SELECT_SIMPLE_NOTE_BY_ID);

                statement.Bind(1, id);
                SimpleNote note = null;

                while (statement.Step() == SQLiteResult.ROW)
                {
                    note = new SimpleNote((long)statement[0], (String)statement[1], null, (String)statement[2]);
                    ScheduledNotification notification;
                    if (statement[4] != null)
                    {
                        long notificationId = (long)statement[4];
                        notification = NotificationHelper.GetNotificationById((long)statement[4]);
                        note.ScheduledNotification = notification;
                    }
                }
                return(note);
            }
Exemplo n.º 9
0
 public EditSimpleNoteDetailViewModel(SimpleNote simpleNote)
 {
     this.simpleNote = simpleNote;
 }
Exemplo n.º 10
0
 public EditSimpleNoteDetailViewModel()
 {
     this.simpleNote = new SimpleNote();
 }
Exemplo n.º 11
0
 public SimpleNote(SimpleNote newNote)
 {
     content = newNote.content;
 }
Exemplo n.º 12
0
        /// <summary>
        /// This is where you map which keyboard keys play which note.
        /// </summary>
        /// <param name="k"></param>
        /// <returns></returns>
        public SimpleNote ConvertKeyToNote(Key k)
        {
            SimpleNote note = new SimpleNote();

            switch (k)
            {
            case Key.Z:  note = new SimpleNote("C-", 3); break;

            case Key.S:  note = new SimpleNote("C#", 3); break;

            case Key.X:  note = new SimpleNote("D-", 3); break;

            case Key.D:  note = new SimpleNote("D#", 3); break;

            case Key.C:  note = new SimpleNote("E-", 3); break;

            case Key.V:  note = new SimpleNote("F-", 3); break;

            case Key.G:  note = new SimpleNote("F#", 3); break;

            case Key.B:  note = new SimpleNote("G-", 3); break;

            case Key.H:  note = new SimpleNote("G#", 3); break;

            case Key.N:  note = new SimpleNote("A-", 3); break;

            case Key.J:  note = new SimpleNote("A#", 3); break;

            case Key.M:  note = new SimpleNote("B-", 3); break;

            //Next Octave
            case Key.Q:  note = new SimpleNote("C-", 4); break;

            case Key.D2: note = new SimpleNote("C#", 4); break;

            case Key.W:  note = new SimpleNote("D-", 4); break;

            case Key.D3: note = new SimpleNote("D#", 4); break;

            case Key.E:  note = new SimpleNote("E-", 4); break;

            case Key.R:  note = new SimpleNote("F-", 4); break;

            case Key.D5: note = new SimpleNote("F#", 4); break;

            case Key.T:  note = new SimpleNote("G-", 4); break;

            case Key.D6: note = new SimpleNote("G#", 4); break;

            case Key.Y:  note = new SimpleNote("A-", 4); break;

            case Key.D7: note = new SimpleNote("A#", 4); break;

            case Key.U:  note = new SimpleNote("B-", 4); break;

            //Next Octave
            case Key.I:  note = new SimpleNote("C-", 5); break;

            //"Rest" Note (nothing happens)
            default: break;
            }
            return(note);
        }
Exemplo n.º 13
0
 /// <summary>
 /// Updates the UI Elements with the last state
 /// </summary>
 /// <param name="note"></param>
 /// <param name="k"></param>
 public void UpdateUI(SimpleNote note, Key k)
 {
     tbKey.Text = GetCharFromKey(k) + ""; tbNote.Text = note.Pitch.Replace("-", " ") + note.Octave;
 }