Esempio n. 1
0
    // レコードの追加
    public void AddRecord(int category, ServerDataDefine.PacketStructPresent data)
    {
        var contex = new PresentRecordListItemContex();

        // 共通
        contex.FixId         = data.serial_id;
        contex.CaptionText00 = MainMenuUtil.GetPresentCount(data).ToString();
        contex.CaptionText01 = data.message;
        contex.NoticeText    = "";
        contex.NoticeEnable  = false;
        if ((MasterDataDefineLabel.PresentType)data.present_type == MasterDataDefineLabel.PresentType.NOTICE)
        {
            string[] notice = data.message.Split(new String[] { message_split_text }, StringSplitOptions.None);
            if (notice.Length >= 2)
            {
                contex.CaptionText00 = "1";
                contex.CaptionText01 = notice[0];
                contex.NoticeText    = notice[1];
                contex.NoticeEnable  = true;
            }
        }
        contex.Category = category;

        // 画像はカテゴリ別に差し替え可能にする
        image(data, sprite => { contex.IconImage = sprite; });

        // ボタンフィードバック
        contex.DidSelectItem += OnClickedRecordButton;

        // 枠色変更
        contex.IconColor  = IconColor[contex.Category];
        contex.FrameColor = FrameColor[contex.Category];

        // レコードの追加先を指定
        switch ((Category)contex.Category)
        {
        case Category.Present:
            // アイテム受領期間までの残り時間
            if (data.delete_timing == 1)
            {
                // 無期限
                //contex.CaptionText02 = "ENDLESS";
            }
            else
            {
                DateTime date = TimeUtil.ConvertServerTimeToLocalTime((ulong)data.delete_timing);
                contex.CaptionText02 = contex.TimeLeftText(date);
            }
            contex.Caption01_H = 110;

            Records0.Add(contex);
            break;

        case Category.PresentLog:
            contex.CaptionText02 = "";
            contex.Caption01_H   = 80;
            Records1.Add(contex);
            break;
        }
    }
Esempio n. 2
0
    private uint getFixId(ServerDataDefine.PacketStructPresent data)
    {
        uint fix_id;

        // present_type で引き数の意味が異なる
        switch ((MasterDataDefineLabel.PresentType)data.present_type)
        {
        case MasterDataDefineLabel.PresentType.UNIT:
        case MasterDataDefineLabel.PresentType.SCRATCH:
        case MasterDataDefineLabel.PresentType.ITEM:
        case MasterDataDefineLabel.PresentType.QUEST_KEY:
            fix_id = data.present_value0;
            break;

        default:
            fix_id = 0;
            break;
        }
        return(fix_id);
    }