public override void InitDialog(DataBundle datas = null)
 {
     if (datas != null)
     {
         var title = datas.ContainsKey("title") ? (string)datas.GetData("title") : "";
         titleText.SetText(title);
         var message = datas.ContainsKey("message") ? (string)datas.GetData("message") : "";
         messageText.SetText(message);
     }
 }
Esempio n. 2
0
 public override void InitPanel(DataBundle datas = null)
 {
     LoadConfig();
     PVPModel = (bool)datas.GetData("pvpModel");
     if (PVPModel)
     {
         OpenBluetoothPanel();
     }
     else
     {
         OpenNewOkDialog();
     }
 }
Esempio n. 3
0
 public override void OnPanelResult(int?resultCode, DataBundle datas)
 {
     switch (resultCode)
     {
     case (int)ResultCode.ExitDialog:
         bool confirm = (bool)datas.GetData("confirm");
         if (confirm)
         {
             Application.Quit();
         }
         break;
     }
 }
Esempio n. 4
0
    public override void OnPanelResult(int?resultCode, DataBundle datas)
    {
        switch (resultCode)
        {
        case (int)ResultCode.BluetoothPanael:
            if (datas == null)
            {
                Finish();
            }
            else
            {
                IsHost = (bool)datas.GetData("isHost");
                InitBluetoothModel();
            }
            break;

        case (int)ResultCode.NewDialog:
            var confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                OpenNewOkDialog();
            }
            break;

        case (int)ResultCode.NewOkDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                var myColor     = (bool)datas.GetData("initiative") ? PieceColor.Red : PieceColor.Black;
                var fusionModel = (bool)datas.GetData("fusionModel");
                var hiddenModel = (bool)datas.GetData("hiddenModel");
                OnNew(myColor, fusionModel, hiddenModel);
            }
            else
            {
                Finish();
            }
            break;

        case (int)ResultCode.RegretDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                OnRegret();
            }
            break;

        case (int)ResultCode.RegretOkDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                Bluetooth.Send("regretOk");
                var regretColor = !GameController.MyColor;
                OnRegretOk(regretColor);
            }
            else
            {
                Bluetooth.Send("regretNot");
            }
            break;

        case (int)ResultCode.ResignDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                OnResign();
            }
            break;

        case (int)ResultCode.DrawDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                OnDraw();
            }
            break;

        case (int)ResultCode.DrawOkDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                Bluetooth.Send("drawOk");
                OnDrawOk();
            }
            else
            {
                Bluetooth.Send("drawNot");
            }
            break;

        case (int)ResultCode.SettingsDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                var oldSlectFlag = SelectFlag;
                AnimeFlag  = (bool)datas.GetData("animeFlag");
                SelectFlag = (bool)datas.GetData("selectFlag");
                if (oldSlectFlag != SelectFlag)
                {
                    GameController.UpdateSelects();
                }
            }
            break;

        case (int)ResultCode.BackDialog:
            confirm = (bool)datas.GetData("confirm");
            if (confirm)
            {
                OnBack();
            }
            break;
        }
    }