public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
 {
     if( data.choushi_status != 3 ) {
         data.choushi_status = 2;
     }
     return data;
 }
 public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
 {
     if( (int)data.zyumyou - 5 <= 0 ) {
         data.zyumyou = 0;
     } else {
         data.zyumyou -= 5 ;
     }
     return data;
 }
 public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
 {
     if( (int)data.choushi - 5 < 0 ) {
         data.choushi = 0;
     } else {
         data.choushi -=5 ;
     }
     return data;
 }
    public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
    {
        if( HRaceData.hirou_MAXVALUE < data.hirou + 5 ) {
            data.hirou = HRaceData.hirou_MAXVALUE;
        } else {
            data.hirou += 5;
        }

        return data;
    }
    public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
    {
        var max = (uint)( 100 + data.seigen );

        if( data.seichou + 5 > max ) {
            data.seichou = max;
        } else {
            data.seichou += 5;
        }
        return data;
    }
    public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
    {
        var abl_data = new HAblData();

        wp.HAblTable.GetData( data.abl_num, ref abl_data );

        if( abl_data.kisyou < 4 ) {
            abl_data.kisyou += 1;
        }
        wp.HAblTable.SetData( data.abl_num, ref abl_data );
        wp.HAblTable.Commit( data.abl_num );

        return data;
    }
    public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
    {
        var abl_data = new HAblData();

        wp.HAblTable.GetData( data.abl_num, ref abl_data );

        if( abl_data.komawari_X != 0 ) {
            abl_data.komawari_X = 0;
            wp.HAblTable.SetData( data.abl_num, ref abl_data );
            wp.HAblTable.Commit( data.abl_num );
        }
        data.migimawari_X   = 0;
        data.hidarimawari_X = 0;
        data.weak_point_1   = 0;
        data.weak_point_2   = 0;
        data.weak_point_3   = 0;

        return data;
    }
Exemplo n.º 8
0
        private Boolean IsViewRecord( WP7 wp, UInt32 horse_num, ref HRaceData data )
        {
            if( this.ListViewConfig.WatchHorse ) {
                return data.kansen == 1;
            }

            switch( data.age )
            {
            case 0:
                if( !this.ListViewConfig.Age_2 )
                    return false;
                break;
            case 1:
                if( !this.ListViewConfig.Age_3 )
                    return false;
                break;
            default:
                if( !this.ListViewConfig.Age_ETC )
                    return false;
                break;
            }

            switch( horse_num <= 0xb3f ? Enums.CountryType.JAPAN : horse_num <= 0xe4b ? Enums.CountryType.USA : Enums.CountryType.EURO )
            {
            case Enums.CountryType.JAPAN:
                if( !this.ListViewConfig.Country_JAPAN )
                    return false;
                break;
            case Enums.CountryType.USA:
                if( !this.ListViewConfig.Country_USA )
                    return false;
                break;
            case Enums.CountryType.EURO:
                if( !this.ListViewConfig.Country_EURO )
                    return false;
                break;
            default:
                throw new Exception("[BUG]");
            }

            switch( data.intai )
            {
            case 0:
                if( !this.ListViewConfig.Status_Geneki ) {
                    return false;
                }
                break;
            default:
                if( !this.ListViewConfig.Status_Intai )
                    return false;
                break;
            }

            if( this.ListViewConfig.OwnerHorse || this.ListViewConfig.ClubHorse || this.ListViewConfig.WatchHorse ) {
                switch( data.owner )
                {
                case 41:
                    if( !this.ListViewConfig.OwnerHorse )
                        return false;
                    break;
                case 42:
                    if( !this.ListViewConfig.ClubHorse )
                        return false;
                    break;
                default:
                    return false;
                }
            }
            return true;
        }
Exemplo n.º 9
0
        private UInt32 GetRaceString( ref WP7 wp, ref HRaceData data, ref String zisou_race_name, ref String zisou_sort_string )
        {
            if( data.nyuukyuu == 0 ) {
                zisou_race_name = "入厩前";
                zisou_sort_string = String.Format( "Y-00-00" );
                return 0;
            } else if( data.houbokuchuu > 0 ) {
                zisou_sort_string = String.Format( "Z-{0:D2}-{1:D2}", data.houbokuchuu, data.houboku_len );
            //				zisou_race_name = String.Format( "{0}放牧中(残り{1}週) {2}", data.houbokuchuu.放牧理由(), data.houboku_len, zisou_sort_string );
                zisou_race_name = String.Format( "{0}放牧中(残り{1}週)", data.houbokuchuu.放牧理由(), data.houboku_len );
                return 0;
            }

            if( data.rase_next_week > wp.Config.YearWeekLength ) {
                zisou_race_name = "不明なレース(1)";
                zisou_sort_string = String.Format( "X-00-00" );
                return 0;
            }
            var week = wp.RProgramTable[ data.rase_next_week ];
            var pos = 0u;

            if( data.rase_next_location != 3 ) {
                pos += data.rase_next_location * 22;
                pos += data.rase_next_sunday == 0u ? 0u : 11u;
                pos += data.rase_next_num;
            } else {
                pos += 22 * 3;
                pos += (uint)( data.rase_next_sunday == 1 || data.rase_next_num > 13 ? 14 : 0 );
                pos += data.rase_next_num;
            }

            if( pos > (wp.Config.RaceProgramTable.RecordSize / 2) ) {
                zisou_race_name = "不明なレース(2)";
                zisou_sort_string = String.Format( "W-00-00" );
                return 0;
            }

            var race_num = week[pos];
            var str = String.Empty;
            var race_data = new KOEI.WP7_2012.Datastruct.RRaceData();

            if( race_num == wp.Config.NullRaceProgramNumber ) {
                str = "不明なレース";
            } else {
                wp.RDataTable.GetData( race_num, ref race_data );
                str = wp.RNameTable[ (int)race_data.race_name_num ].ShortName;
            }

            zisou_sort_string = String.Format( "{0}-{1:D2}-{2:D2}",
                ( data.race_next_age == data.age ? "A" : "B" ), data.rase_next_week, pos
            );

            //			zisou_race_name = String.Format( "{0} - {1}({2})", wp.月週( data.rase_next_week ), str, zisou_sort_string );
            zisou_race_name = String.Format( "{0} - {1}", wp.月週( data.rase_next_week ), str );

            return race_data.distance;
        }
Exemplo n.º 10
0
        private String GetDispName( WP7 wp, out String father_name, out String mother_name, ref HRaceData data, ref HAblData abl_data, ref HBloodData father_blood_data, ref HBloodData mother_blood_data )
        {
            var name_type = Helper.GetCountryByBokuzyouNum( abl_data.bokuzyou ) == Enums.CountryType.JAPAN
                ? WP7_2012ULV.Enums.NameType.KANA
                : WP7_2012ULV.Enums.NameType.ENGLISH;

            if( this.ListViewConfig.DispNameType == WP7_2012ULV.Enums.NameType.KANA ) {
                name_type = WP7_2012ULV.Enums.NameType.KANA;
            }

            if( father_blood_data.display == 1 && name_type == WP7_2012ULV.Enums.NameType.ENGLISH ) {
                father_name = wp.馬名( WP7_2012ULV.Enums.NameType.ENGLISH, father_blood_data.name_left, father_blood_data.name_right );
            } else {
                father_name = wp.馬名( WP7_2012ULV.Enums.NameType.KANA, father_blood_data.name_left, father_blood_data.name_right );
            }

            if( mother_blood_data.display == 1 && name_type == WP7_2012ULV.Enums.NameType.ENGLISH ) {
                mother_name = wp.馬名( WP7_2012ULV.Enums.NameType.ENGLISH, mother_blood_data.name_left, mother_blood_data.name_right );
            } else {
                mother_name = wp.馬名( WP7_2012ULV.Enums.NameType.KANA, mother_blood_data.name_left, mother_blood_data.name_right );
            }

            var name = wp.馬名( name_type, data.name_left, data.name_right );

            return name;
        }
Exemplo n.º 11
0
        /// <summary>
        /// スポイラーライクな編集を行う
        /// このままだとプログラミングミスが起きそうなのでコードを整理したい
        /// </summary>
        /// <param name="item_index">リストビューのアイテムインデックス</param>
        protected override void SpoilerLikeItemEdit( int item_index )
        {
            var item = this.ListView1.Items[ item_index ];
            var horse_num = (UInt32)((int)item.SubItems["horse_num"].Tag);

            var data = new KOEI.WP7_2012.Datastruct.HRaceData();
            var abl_data = new KOEI.WP7_2012.Datastruct.HAblData();

            this.WP7.HRaceTable.GetData( horse_num, ref data );
            this.WP7.HAblTable.GetData( data.abl_num, ref abl_data );

            var name_type = Helper.GetCountryByBokuzyouNum( abl_data.bokuzyou ) == Enums.CountryType.JAPAN
                ? WP7_2012ULV.Enums.NameType.KANA
                : WP7_2012ULV.Enums.NameType.ENGLISH;

            if( this.ListViewConfig.DispNameType == WP7_2012ULV.Enums.NameType.KANA ) {
                name_type = WP7_2012ULV.Enums.NameType.KANA;
            }

            var form = new SpoilerLikeEditForm() {
                Text = String.Format( "{0} 編集中 - SpoilerALライク編集(β)", this.WP7.馬名( name_type, data.name_left, data.name_right ) ),
                Size = new System.Drawing.Size( 700, 800 ),
            };

            // 競走馬データの編集コントロール
            var data_editor = new SpoilerLikeControls.BitCheckList( this.WP7, HRaceData.Properties, data.Decode() ){
                Dock = DockStyle.Fill,
                ControlsFont = this.ListView1.Font,
                DataChanged = ( new_data )=> {
                    if( this.WP7.TransactionWeekNumber != this.WP7.GetCurrentWeekNumber() ) {
                        var message = String.Format(
                            "データ取得時から週が変わっています({0}→{1})\r\n安全のため書き込みは行いません、再取得してください",
                            this.WP7.TransactionWeekNumber,
                            this.WP7.GetCurrentWeekNumber()
                        );
                        MessageBox.Show( message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error );
                        form.DialogResult = DialogResult.Ignore;
                        return;
                    }
                    var temp_data = new HRaceData();
                    temp_data.Encode( new_data );
                    this.WP7.HRaceTable.SetData( horse_num, ref temp_data );
                    this.WP7.HRaceTable.Commit( horse_num );
                    this.DataUpdateAndRefresh( item_index, horse_num, ref temp_data );
                },
            };

            // 能力データの編集コントロール
            var abl_data_editor = new SpoilerLikeControls.BitCheckList( this.WP7, HAblData.Properties, abl_data.Decode() ) {
                Dock = DockStyle.Fill,
                ControlsFont = this.ListView1.Font,
                DataChanged = ( new_abl_data )=> {
                    if( this.WP7.TransactionWeekNumber != this.WP7.GetCurrentWeekNumber() ) {
                        var message = String.Format(
                            "データ取得時から週が変わっています({0}→{1})\r\n安全のため書き込みは行いません、再取得してください",
                            this.WP7.TransactionWeekNumber,
                            this.WP7.GetCurrentWeekNumber()
                        );
                        MessageBox.Show( message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error );
                        form.DialogResult = DialogResult.Ignore;
                        return;
                    }
                    var temp_data = new HAblData();
                    temp_data.Encode( new_abl_data );
                    this.WP7.HAblTable.SetData( data.abl_num, ref temp_data );
                    this.WP7.HAblTable.Commit( data.abl_num );
                    this.DataUpdateAndRefresh( item_index, horse_num, ref data );
                },
            };

            form.TabPageAdd( "能力データ", new Control[]{ abl_data_editor } );
            form.TabPageAdd( "競走馬データ", new Control[]{ data_editor } );

            if( form.ShowDialog() == DialogResult.Cancel ) {
                if( this.WP7.TransactionWeekNumber == this.WP7.GetCurrentWeekNumber() ) {
                    this.WP7.HRaceTable.SetData( horse_num, ref data );
                    this.WP7.HRaceTable.Commit( horse_num );
                    this.WP7.HAblTable.SetData( data.abl_num, ref abl_data );
                    this.WP7.HAblTable.Commit( data.abl_num );
                    this.DataUpdateAndRefresh( item_index, horse_num, ref data );
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// C#の拡張機能を実行する
        /// </summary>
        /// <param name="method">呼び出すメソッド</param>
        protected override void ExecCSharpExtension( System.Reflection.MethodInfo method, WP7_2012ULV.Setting.ExtensionSetting.Manifest manifest )
        {
            var data = new KOEI.WP7_2012.Datastruct.HRaceData();

            SelectedItemsEach( ( item_index, horse_num ) => {
                this.WP7.HRaceTable.GetData( horse_num, ref data );

                var args = new object[]{
                    this.WP7,
                    horse_num,
                    data
                };
                data = (KOEI.WP7_2012.Datastruct.HRaceData) method.Invoke( null, args );

                if( this.Mode == ReadWriteMode.ReadWrite && manifest.Mode == ReadWriteMode.ReadWrite ) {
                    this.WP7.HRaceTable.SetData( horse_num, ref data );
                    this.WP7.HRaceTable.Commit( horse_num );

                    this.ListView1_VirtualItems[ item_index ] = this.CreateListViewItemByHorseNum( this.WP7, horse_num, ref data );
                }
            });
            this.ListView1.Refresh();
            this.ListView1_OddColor();
        }
Exemplo n.º 13
0
        protected override ListViewItem[] CreateHorseListSub( KOEI.WP7_2012.WP7 wp, object arg )
        {
            this.__subitems_stack__ = new ListViewItem.ListViewSubItem[ DefaultColumnHeaders.Length ];

            var data = new KOEI.WP7_2012.Datastruct.HRaceData();

            this.white_color_horse_ = 0;

            if( this.ListViewConfig.CurrentHorse ) {
                var n = wp.GetCurrentCharacterNumber();
                wp.HRaceTable.GetData( n, ref data );
                var item = CreateListViewItemByHorseNum( wp, n, ref data );
                if( item == null ) {
                    return new ListViewItem[0];
                }
                return new ListViewItem[1] {
                    item,
                };
            }
            var items = new ListViewItem[ wp.Config.HorseRaceTable.RecordMaxLength ];
            var count = 0;

            for( var i=0; i<wp.Config.HorseRaceTable.RecordMaxLength; ++i ) {
                var horse_num = (uint)i;

                wp.HRaceTable.GetData( horse_num, ref data );

                if( !this.IsViewRecord( wp, horse_num, ref data ) ) {
                    continue;
                }
                var item = CreateListViewItemByHorseNum( wp, horse_num, ref data );

                if( item != null ) {
                    items[ count++ ] = item;
                }
            }
            Array.Resize( ref items, count );

            return items;
        }
    public static HRaceData CommandMain( WP7 wp, UInt32 horse_num, HRaceData data )
    {
        data.seichou = 100 + data.seigen;

        return data;
    }