public IActionResult reversiPlay([FromQuery(Name = "func")] string func, [FromQuery(Name = "y")] int y, [FromQuery(Name = "x")] int x)
        {
            ReversiPlay rvPlay = this.getReversiPlay();

            rvPlay.reversiPlay(y, x);
            return(Content(this.getResJson(rvPlay), "application/json"));
        }
        public IActionResult reset([FromQuery(Name = "func")] string func)
        {
            ReversiPlay rvPlay = this.getReversiPlay();

            rvPlay.reset();
            return(Content(this.getResJson(rvPlay), "application/json"));
        }
Exemplo n.º 3
0
        private Size oldSize;                                                                                   //!< リサイズ前のサイズ

        ////////////////////////////////////////////////////////////////////////////////
        ///	@brief			コンストラクタ
        ///	@fn				FormMain()
        ///	@return			ありません
        ///	@author			Yuta Yoshinaga
        ///	@date			2017.10.20
        ///
        ////////////////////////////////////////////////////////////////////////////////
        public Reversi()
        {
            InitializeComponent();
            oldSize.Width  = 0;
            oldSize.Height = 0;

            System.IO.Directory.CreateDirectory(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Y.Y Magic\\Reversi4ColorForm");
            string setPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Y.Y Magic\\Reversi4ColorForm\\" + "AppSetting.xml";

            try
            {
                this.m_AppSettings = this.LoadSettingXml(setPath);
                if (this.m_AppSettings == null)
                {
                    this.m_AppSettings = new ReversiSetting();
                    this.SaveSettingXml(setPath, ref this.m_AppSettings);
                }
                this.m_ReversiPlay            = new ReversiPlay();
                this.m_ReversiPlay.mSetting   = this.m_AppSettings;
                this.m_ReversiPlay.viewMsgDlg = this.ViewMsgDlg;
                this.m_ReversiPlay.drawSingle = this.DrawSingle;
                this.m_ReversiPlay.curColMsg  = this.CurColMsg;
                this.m_ReversiPlay.curStsMsg  = this.CurStsMsg;
                this.appInit();
                Task newTask = new Task(() => { this.m_ReversiPlay.reset(); });
                newTask.Start();
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("FormMain(1) : " + ex.Message);
                System.Console.WriteLine("FormMain(1) : " + ex.StackTrace);
            }
        }
        public IActionResult setSetting([FromQuery(Name = "func")] string func, [FromQuery(Name = "para")] string para)
        {
            ReversiPlay rvPlay = this.getReversiPlay();

            rvPlay.mSetting = JsonConvert.DeserializeObject <ReversiSetting>(para);
            rvPlay.reset();
            return(Content(this.getResJson(rvPlay), "application/json"));
        }
        public string getResJson(ReversiPlay rvPlay)
        {
            ResJson resJson = new ResJson();

            resJson.auth      = "[SUCCESS]";
            resJson.callbacks = rvPlay.mCallbacks;
            HttpContext.Session.Set <ReversiPlay>(SessionKey, rvPlay);
            return(Newtonsoft.Json.JsonConvert.SerializeObject(resJson));
        }
        public ReversiPlay getReversiPlay()
        {
            ReversiPlay rvPlay = new ReversiPlay();

            if (HttpContext.Session.Get <ReversiPlay>(SessionKey) == default)
            {
                HttpContext.Session.Set <ReversiPlay>(SessionKey, rvPlay);
            }
            else
            {
                rvPlay = HttpContext.Session.Get <ReversiPlay>(SessionKey);
            }
            rvPlay.mCallbacks = new CallbacksJson();
            rvPlay.viewMsgDlg = this.ViewMsgDlg;
            rvPlay.drawSingle = this.DrawSingle;
            rvPlay.curColMsg  = this.CurColMsg;
            rvPlay.curStsMsg  = this.CurStsMsg;
            rvPlay.wait       = this.Wait;
            return(rvPlay);
        }