コード例 #1
0
        public override void OnUpdateStyle(object obj)
        {
            base.OnUpdateStyle(obj);
            var text = obj as Text;

            if (text == null)
            {
                return;
            }
            if (Font == null || Font.Value == null)
            {
                Font = new SFont(Resources.GetBuiltinResource <Font>("Arial.ttf"));
            }

            Font.SetTargetValue(f => text.font                 = f);
            FontStyle.SetTargetValue(fs => text.fontStyle      = fs);
            FontSize.SetTargetValue(fs => text.fontSize        = fs);
            LineSpace.SetTargetValue(ls => text.lineSpacing    = ls);
            RichText.SetTargetValue(rt => text.supportRichText = rt);

            Alignment.SetTargetValue(a => text.alignment = a);
            AlignByGeometry.SetTargetValue(abg => text.alignByGeometry      = abg);
            HorizontalOverflow.SetTargetValue(hw => text.horizontalOverflow = hw);
            VerticalOverflow.SetTargetValue(vw => text.verticalOverflow     = vw);
            BestFit.SetTargetValue(bf => text.resizeTextForBestFit          = bf);
        }
コード例 #2
0
        public ActionBattleStart(int start_wait)
        {
            //ox = 0; oy = 0;
            this.timer_start_wait = start_wait;

            font = new SFont(GameMain.main_font_name_b, 45, 0, SFont.Antialiasing.Normal, 2);
        }
コード例 #3
0
ファイル: DrawEffect.cs プロジェクト: pogin503/TOL_SRPG
 public _Font(string font_family_name, int size, int frame_size)
 {
     //: base( font_name, size, thick, Antialiasing.Normal, edge_size )
     sfont       = new SFont(font_family_name, size, 0, SFont.Antialiasing.Normal, frame_size);
     main_color  = new Color(255, 255, 255, 255);
     frame_color = new Color(255, 255, 255, 255);
 }
コード例 #4
0
ファイル: UserInterface.cs プロジェクト: pogin503/TOL_SRPG
        Unit status_target_unit; //

        public UserInterface()
        {
            font_ui_text              = new SFont(GameMain.main_font_name_r, 22, 0, SFont.Antialiasing.Normal, 0);
            font_handle_status_name   = new SFont(GameMain.main_font_name_b, 18, 1, SFont.Antialiasing.Normal, 2);
            font_handle_status_detail = new SFont(GameMain.main_font_name_b, 18, 1, SFont.Antialiasing.Normal, 0);

            face_image = DX.LoadGraph("data/face_sammple.png");
        }
コード例 #5
0
ファイル: Action.cs プロジェクト: pogin503/TOL_SRPG
        public bool is_unable_to_fight = false; // 戦闘不能


        public ActionDamage(int start_wait, int x, int y, int damage_value, Unit target_unit)
        {
            ox = x; oy = y;
            this.timer_start_wait = start_wait;
            this.damage_value     = damage_value;
            this.target_unit      = target_unit;

            font = new SFont(GameMain.main_font_name_b, 21, 0, SFont.Antialiasing.Normal, 2);
        }
コード例 #6
0
 public UIBoxString(int x, int y, int w, int h, string view_text, SFont font_view_text)
 {
     this.ox             = x;
     this.oy             = y;
     this.w              = w;
     this.h              = h;
     this.view_text      = view_text;
     this.font_view_text = font_view_text;
 }
コード例 #7
0
        public ScenePreBattle(string script_path, string next_battle_setup_script_path)
        {
            this.next_battle_setup_script_path = next_battle_setup_script_path;
            var game_main = GameMain.GetInstance();

            game_main.g3d_map    = new BattleMap(game_main.game_base);
            game_main.g3d_camera = new G3DCamera();

            int[] map_data = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };

            game_main.g3d_map.map_w = 5;
            game_main.g3d_map.map_h = 3;
            game_main.g3d_map.Setup(map_data);

            setup_script = new Script("data/script/pre_battle.nst", _ScriptLineAnalyze);
            setup_script.Run("Setup");

            game_main.g3d_camera.SetDirectPosAndRot(DX.VGet(-8.257049f, 0f, 63.04372f), DX.VGet(0.6088442f, 0f, 0.793291f));
            game_main.g3d_camera._NotToFixHard();

            font_unit_list   = new SFont(GameMain.main_font_name_r, 22, 0, SFont.Antialiasing.Normal, 0);
            font_side_button = new SFont(GameMain.main_font_name_b, 22, 0, SFont.Antialiasing.Normal, 0);

            game_main.g3d_map.is_draw_cursor_turn_owner = true;

            // ユニット一覧をボタンとして作成
            var ox = GameMain.WindowSizeW - (240 + 16);
            var oy = 30 + 16 * 2;
            var w  = 240;
            var h  = 30;
            var i  = 0;

            foreach (var ums in game_main.unit_manager.units)
            {
                var box = new UIBoxString(ox, oy + h * i, w, h, ums.unit.name, font_unit_list);
                ui_unit_names.Add(box);
                i++;
            }

            //
            {
                UIBoxString box;
                box = new UIBoxString(GameMain.WindowSizeW - (80 + 16), 16, 80, h, "完了", font_side_button);
                ui_side_button.Add(box);
                box = new UIBoxString(GameMain.WindowSizeW - (80 + 16 + 140), 16, 130, h, "ステータス", font_side_button);
                ui_side_button.Add(box);
            }
        }
コード例 #8
0
ファイル: GameMain.cs プロジェクト: pogin503/TOL_SRPG
        public GameMain(GameBase game_base)
        {
            // 根本的な初期化(ここを先にしておかないと差し支えるもの)
            static_main         = this;
            game_base.game_main = this;
            this.game_base      = game_base;

            SFont.Load("data/font/migmix-1p-20150712/migmix-1p-bold.ttf");
            SFont.Load("data/font/migmix-2p-20150712/migmix-2p-regular.ttf");
            //

            // その他の初期化、基本部分
            sound_manager       = new SoundManager();
            model_manager       = new ModelManager();
            action_data_manager = new ActionDataManager();

            // シーン生成
            scene = new SceneSetup("data/script/start.nst");

            // キー入力初期化
            game_base.input.SetupKeyInput((int)KeyCode.DebugView, DX.KEY_INPUT_F3);

            user_interface = new UserInterface();


            DX.SetUseZBufferFlag(DX.TRUE);   // Zバッファを有効にする
            DX.SetWriteZBufferFlag(DX.TRUE);
            //DX.SetUseLighting(DX.FALSE); // ライトを無効にする ライトの調整が難しいので・・・
            DX.SetUseLighting(DX.TRUE);

            //BGM テスト
            //var sound = DX.LoadSoundMem("data/sound/Battle_Boss_01.ogg");
            //DX.PlaySoundMem(sound, DX.DX_PLAYTYPE_LOOP);

            if (is_use_shadowmap)
            {
                // シャドウマップ初期化
                int shadow_map_size = 1024;
                ShadowMapHandle = DX.MakeShadowMap(shadow_map_size, shadow_map_size);
            }
        }
コード例 #9
0
ファイル: SceneEndBattle.cs プロジェクト: pogin503/TOL_SRPG
        public SceneEndBattle(string mode_name, string script_path)
        {
            font           = new SFont(GameMain.main_font_name_b, 80, 0, SFont.Antialiasing.Normal, 4);
            this.mode_name = mode_name;

            var game_main = GameMain.GetInstance();

            game_main.user_interface.SetStatusUnit(null);
            game_main.g3d_map.is_draw_cursor_turn_owner = false;

            var font_ui = new SFont(GameMain.main_font_name_r, 22, 0, SFont.Antialiasing.Normal, 0);

            ui_box_restart = new UIBoxString(GameMain.WindowSizeW / 2, GameMain.WindowSizeH / 2 + 80, 200, 32, "Restart", font_ui);
            ui_box_restart.SetCenter(true, true);

            switch (mode_name)
            {
            case "Game Over":
                mode_title = "Game Over";
                edge_color = DX.GetColor(255, 0, 0);


                break;

            case "Stage Clear":
                mode_title = "Stage Clear";
                edge_color = DX.GetColor(0, 0, 255);

                break;

            default:
                mode_title = mode_name;
                edge_color = DX.GetColor(0, 0, 255);
                break;
            }
        }
コード例 #10
0
    public void UpdateFont(Sprite t_fontSprite, float t_pixelsToUnits, string t_text, string t_fontSet, int t_fontWidth, int t_fontHeight, float t_fontSpacing, SFont.HorzAlignment t_horizontalAlignment, SFont.VertAlignment t_verticalAlignment, Color t_colorTint, int t_orderInLayer = 0, string t_sortingLayer = "", bool isNotPrefab = true, int t_fontSets = 0)
    {
        _fontSprite          = t_fontSprite;
        _pixelsToUnits       = t_pixelsToUnits;
        _text                = t_text;
        _fontSet             = t_fontSet;
        _fontWidth           = t_fontWidth;
        _fontHeight          = t_fontHeight;
        _fontSpacing         = t_fontSpacing;
        _horizontalAlignment = t_horizontalAlignment;
        _verticalAlignment   = t_verticalAlignment;
        _orderInLayer        = t_orderInLayer;
        _sortingLayer        = t_sortingLayer;
        _fontSets            = t_fontSets;
        _colorTint           = t_colorTint;

        if (SFConstants.FontSetsArray[_fontSets] != "Custom Value")
        {
            if (_fontSets < SFConstants.fsArray.Length)
            {
                _fontSet = SFConstants.fsArray[_fontSets];
            }
        }

        if (!(_fontSprite == null))
        {
            //check if the fontsprite ends with the fontHeight and fontWidth
            int lastIndexOfX = _fontSprite.name.LastIndexOf("x");
            int lastIndexOf_ = _fontSprite.name.LastIndexOf("_");
            if (_fontHeight == 0)
            {
                if (lastIndexOfX > -1 && lastIndexOf_ > -1)
                {
                    string heightStr   = _fontSprite.name.Substring(lastIndexOfX + 1, _fontSprite.name.Length - (lastIndexOfX + 1));
                    int    iFontHeight = 0;
                    if (int.TryParse(heightStr, out iFontHeight))
                    {
                        _fontHeight = iFontHeight;
                    }
                }
            }
            if (_fontWidth == 0)
            {
                if (lastIndexOfX > -1 && lastIndexOf_ > -1)
                {
                    string widthStr   = _fontSprite.name.Substring(lastIndexOf_ + 1, lastIndexOfX - (lastIndexOf_ + 1));
                    int    iFontWidth = 0;
                    if (int.TryParse(widthStr, out iFontWidth))
                    {
                        _fontWidth = iFontWidth;
                    }
                }
            }
        }

        if (_pixelsToUnits < 0)
        {
            _pixelsToUnits *= -1.0f;
        }
        else if (Mathf.Approximately(_pixelsToUnits, 0.0f))
        {
            _pixelsToUnits = 1.0f;
        }
        _fontSet = _fontSet.Trim();
        if (_fontWidth < 0)
        {
            _fontWidth *= -1;
        }
        if (_fontHeight < 0)
        {
            _fontHeight *= -1;
        }

        if (_isVisible && isNotPrefab)
        {
            if (_sFont == null)
            {
                _sFont = ScriptableObject.CreateInstance <SFont>();
                _sFont.parentTransform = transform;
                _sFont.hideFlags       = HideFlags.DontSave;
            }

            _sFont.UpdateFont(_fontSprite, _pixelsToUnits, _text, _fontSet, _fontWidth, _fontHeight, _fontSpacing, _horizontalAlignment, _verticalAlignment, _orderInLayer, _sortingLayer, _colorTint);
        }
    }