Пример #1
0
        private void MoonPhaseForm_Load(object sender, EventArgs e)
        {
            this.Icon = Icon.FromHandle(Resources.IMAGE_MOON02.GetHicon());

            MoonPhase lastMoonPhase = FFACEControl.GetMoonPhaseFromVanaTime(fface.Timer.GetVanaTime());

            FFACE.TimerTools.VanaTime v = new FFACE.TimerTools.VanaTime();
            v.Year = fface.Timer.GetVanaTime().Year;
            v.Month = fface.Timer.GetVanaTime().Month;
            v.Day = fface.Timer.GetVanaTime().Day;

            for (int i = 0; i <= 4; i++)
            {
                gridMoonPhase.Columns[i].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                gridMoonPhase.Columns[i].HeaderCell.Style.Font = new Font(gridMoonPhase.Font,gridMoonPhase.Font.Style | FontStyle.Bold);
            }
            MoonPhase last = FFACEControl.GetMoonPhaseFromVanaTime(v);
            for (int i = 0; i < 360; i++)
            {
                v = FFACEControl.addVanaDay(v);
                MoonPhase m = FFACEControl.GetMoonPhaseFromVanaTime(v);
                if (last != m)
                {
                    gridMoonPhase.Rows.Add();
                    gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[0].Value = FFACEControl.GetEarthTimeFromVanaTime(v).ToString("yyyy/MM/dd HH:mm");
                    gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[1].Value = string.Format("{0:0000}/{1:00}/{2:00}", v.Year, v.Month, v.Day);
                    gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[2].Value = MainForm.dicWeekDayImage[FFACEControl.GetWeekdayFromVanaTime(v)];
                    gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[3].Value = MainForm.dicMoonPhaseImage[m];
                    gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[4].Value = MainForm.dicMoonPhaseName[m];
                    //行の色変更
                    gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Black;
                    gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionForeColor = Color.Black;
                    if (m == MoonPhase.New || m == MoonPhase.Full)
                    {
                        gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.BackColor = Color.FromArgb(0x80, 0xFF, 0xFF);
                        gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionBackColor = Color.FromArgb(0x80, 0xFF, 0xFF);
                    }
                    else if (m == MoonPhase.FirstQuarter || m == MoonPhase.LastQuarter)
                    {
                        gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightGray;
                        gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionBackColor = Color.LightGray;
                    }
                    else
                    {
                        gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.BackColor = Color.White;
                        gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionBackColor = Color.White;
                    }
                }
                last = m;
            }
        }
Пример #2
0
 /// <summary>
 /// 地球時間からヴァナ時間を取得
 /// </summary>
 /// <param name="iEarthDate">地球時間</param>
 /// <returns>ヴァナ時間</returns>
 public static FFACETools.FFACE.TimerTools.VanaTime GetVanaTimeFromEarthTime(DateTime iEarthDate)
 {
     //地球時間 2002/01/01 00:00:00 = 天晶暦 0886/01/01 00:00:00
     //一年=360日 一ヶ月=30日 一日=24時間 一時間=60分 一分=60秒
     var ret = new FFACE.TimerTools.VanaTime();
     DateTime baseDate = new DateTime(2002, 1, 1, 0, 0, 0);
     DateTime nowDate = new DateTime(iEarthDate.Year, iEarthDate.Month, iEarthDate.Day, iEarthDate.Hour, iEarthDate.Minute, iEarthDate.Second);
     long baseTicks = baseDate.Ticks / 10000000L;
     long nowTicks = nowDate.Ticks / 10000000L;
     long vanaTicks = (nowTicks - baseTicks) * 25L;
     //年
     double year = vanaTicks / (360D * 24D * 60D * 60D);
     ret.Year = (short)(Math.Floor(year) + 886D);
     //月
     ret.Month = (byte)((vanaTicks % (360D * 24D * 60D * 60D)) / (30D * 24D * 60D * 60D) + 1);
     //日
     ret.Day = (byte)((vanaTicks % (30D * 24D * 60D * 60D)) / (24D * 60D * 60D) + 1);
     //時
     ret.Hour = (byte)((vanaTicks % (24D * 60D * 60D)) / (60D * 60D));
     //分
     ret.Minute = (byte)((vanaTicks % (60D * 60D)) / (60D));
     //秒
     ret.Second = (byte)(vanaTicks % 60D);
     //曜日
     double dayType = (byte)((vanaTicks % (8D * 24D * 60D * 60D)) / (24D * 60D * 60D));
     ret.DayType = (Weekday)dayType;
     //月齢
     double moonPhase = (byte)((vanaTicks % (12D * 7D * 24D * 60D * 60D)) / (7D * 24D * 60D * 60D));
     ret.MoonPhase = (MoonPhase)moonPhase;
     return ret;
 }
Пример #3
0
        private void timer_Tick(object sender, EventArgs e)
        {
            int workDone = FishChat.NewChat();
            currentStatus = _FFACE.Player.Status;
            vanaNow = _FFACE.Timer.GetVanaTime();

            if (-1 == workDone)  //error code from FishChat.NewChat() means chat failed
            {
                timer.Stop();
                Reattach();  //start a new instance of FFACETools to recover
                timer.Start();
            }
            else if (0 < workDone)  //some work was done
            {
                UpdateChat();
            }

            UpdateInfo();
        }