public CrateData(BoardPos boardPos, bool[] isDimple, bool doAutoMove, Vector2Int autoMoveDir) { this.boardPos = boardPos; this.isDimple = isDimple; this.doAutoMove = doAutoMove; this.autoMoveDir = autoMoveDir; }
public void GetValidPawnMoves(EChessTeam team, int pos, List <Move> moves) { int FrontPos = -1, LeftFrontPos = -1, RightFrontPos = -1; if (team == EChessTeam.White) { FrontPos = new BoardPos(pos).GetTop(); if (FrontPos > 0) { LeftFrontPos = new BoardPos(FrontPos).GetLeft(); RightFrontPos = new BoardPos(FrontPos).GetRight(); } if (new BoardPos(pos).Y == 1) { AddMoveIfValidSquare(team, pos, new BoardPos(FrontPos).GetTop(), moves, (int)ETeamFlag.None); } } else { FrontPos = new BoardPos(pos).GetBottom(); if (FrontPos > 0) { LeftFrontPos = new BoardPos(FrontPos).GetRight(); RightFrontPos = new BoardPos(FrontPos).GetLeft(); } if (new BoardPos(pos).Y == 6) { AddMoveIfValidSquare(team, pos, new BoardPos(FrontPos).GetBottom(), moves, (int)ETeamFlag.None); } } AddMoveIfValidSquare(team, pos, FrontPos, moves, (int)ETeamFlag.None); AddMoveIfValidSquare(team, pos, LeftFrontPos, moves, (int)ETeamFlag.Enemy); AddMoveIfValidSquare(team, pos, RightFrontPos, moves, (int)ETeamFlag.Enemy); }
// ---------------------------------------------------------------- // Doers // ---------------------------------------------------------------- virtual public void SetColRow(Vector2Int _colRow, Vector2Int _moveDir) { //RemoveMyFootprint(); PrevMoveDelta = _moveDir; BoardPos = new BoardPos(_colRow, ChirH, ChirV, SideFacing); //AddMyFootprint(); }
public TextBlockData(Guid myGuid, BoardPos boardPos, TileType MySubjectType) { this.MyGuid = myGuid; this.boardPos = boardPos; this.MyType = TileType.TextBlock; // we already know I'm a TextBlock. this.MySubjectType = MySubjectType; }
public CrateGoalData(BoardPos boardPos, int corner, bool doStayOn, bool isOn) { this.boardPos = boardPos; this.corner = corner; this.doStayOn = doStayOn; this.isOn = isOn; }
private bool CanPromotePawn(Move move) { PieceData tmpData = bitBoard.GetPieceFromPos(move.To); if (tmpData.piece == EPieceType.Pawn) { BoardPos pos = new BoardPos(move.To); if (tmpData.team == EChessTeam.Black && pos.Y == 0 || tmpData.team == EChessTeam.White && pos.Y == (BOARD_SIZE - 1)) { return(true); } } return(false); }
protected void btnOK_Click(object sender, EventArgs e) { string position_code = Request.QueryString["position"]; string result = new BoardPos().deleteBoardPos(position_code); if (result == "OK") { divSuccess.Visible = true; divDelete.Visible = false; } else { MsgValidate("ไม่สามารถลบตำแหน่งงานบริหาร กรุณาทำใหม่อีกครั้ง"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { /*=============================*/ if (!Page.IsPostBack) { fail.Visible = false; divSuccess.Visible = false; // ประเภทอาจารย์ ddlLecturerType.Items.Clear(); List <LecturerType> lec_type = new List <LecturerType>(); lec_type = new LecturerType().getLecturerType2(); foreach (LecturerType row in lec_type) { ddlLecturerType.Items.Insert(ddlLecturerType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode)); } //=========== // ตำแหน่ง ddlPosition.Items.Clear(); List <BoardPosData> position_data = new List <BoardPosData>(); position_data = new BoardPos().getBoardPos(); foreach (BoardPosData pos in position_data) { ddlPosition.Items.Insert(ddlPosition.Items.Count, new ListItem(pos.Position_Thai, pos.Position_Code)); } } /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { /*=============================*/ try { if (!Page.IsPostBack) { fail.Visible = false; divSuccess.Visible = false; string position_code = Request.QueryString["position"]; BoardPosData position_data = new BoardPosData(); position_data = new BoardPos().getBoardPos(position_code); txtWork_Position_Thai.Text = position_data.Position_Thai; txtWork_Position_Eng.Text = position_data.Position_Eng; ddlStatus.Items.FindByValue(position_data.Status).Selected = true; } } catch (Exception err) { Session["response"] = err.ToString(); Response.Redirect("err_response.aspx"); } /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
public void GetValidBishopMoves(EChessTeam team, int pos, List <Move> moves) { bool bBreak = false; int TopRightPos = new BoardPos(pos) + new BoardPos(1, 1); while (!bBreak && TopRightPos >= 0 && bitBoard.GetPieceFromPos(TopRightPos).team != team) { AddMoveIfValidSquare(team, pos, TopRightPos, moves); bBreak = bitBoard.GetPieceFromPos(TopRightPos).team != EChessTeam.None; TopRightPos = new BoardPos(TopRightPos) + new BoardPos(1, 1); } bBreak = false; int TopLeftPos = new BoardPos(pos) + new BoardPos(-1, 1); while (!bBreak && TopLeftPos >= 0 && bitBoard.GetPieceFromPos(TopLeftPos).team != team) { AddMoveIfValidSquare(team, pos, TopLeftPos, moves); bBreak = bitBoard.GetPieceFromPos(TopLeftPos).team != EChessTeam.None; TopLeftPos = new BoardPos(TopLeftPos) + new BoardPos(-1, 1); } bBreak = false; int BottomRightPos = new BoardPos(pos) + new BoardPos(1, -1); while (!bBreak && BottomRightPos >= 0 && bitBoard.GetPieceFromPos(BottomRightPos).team != team) { AddMoveIfValidSquare(team, pos, BottomRightPos, moves); bBreak = bitBoard.GetPieceFromPos(BottomRightPos).team != EChessTeam.None; BottomRightPos = new BoardPos(BottomRightPos) + new BoardPos(1, -1); } bBreak = false; int BottomLeftPos = new BoardPos(pos) + new BoardPos(-1, -1); while (!bBreak && BottomLeftPos >= 0 && bitBoard.GetPieceFromPos(BottomLeftPos).team != team) { AddMoveIfValidSquare(team, pos, BottomLeftPos, moves); bBreak = bitBoard.GetPieceFromPos(BottomLeftPos).team != EChessTeam.None; BottomLeftPos = new BoardPos(BottomLeftPos) + new BoardPos(-1, -1); } }
public void GetValidRookMoves(EChessTeam team, int pos, List <Move> moves) { bool bBreak = false; int TopPos = new BoardPos(pos).GetTop(); while (!bBreak && TopPos >= 0 && bitBoard.GetPieceFromPos(TopPos).team != team) { AddMoveIfValidSquare(team, pos, TopPos, moves); bBreak = bitBoard.GetPieceFromPos(TopPos).team != EChessTeam.None; TopPos = new BoardPos(TopPos).GetTop(); } bBreak = false; int BottomPos = new BoardPos(pos).GetBottom(); while (!bBreak && BottomPos >= 0 && bitBoard.GetPieceFromPos(BottomPos).team != team) { AddMoveIfValidSquare(team, pos, BottomPos, moves); bBreak = bitBoard.GetPieceFromPos(BottomPos).team != EChessTeam.None; BottomPos = new BoardPos(BottomPos).GetBottom(); } bBreak = false; int LeftPos = new BoardPos(pos).GetLeft(); while (!bBreak && LeftPos >= 0 && bitBoard.GetPieceFromPos(LeftPos).team != team) { AddMoveIfValidSquare(team, pos, LeftPos, moves); bBreak = bitBoard.GetPieceFromPos(LeftPos).team != EChessTeam.None; LeftPos = new BoardPos(LeftPos).GetLeft(); } bBreak = false; int RightPos = new BoardPos(pos).GetRight(); while (!bBreak && RightPos >= 0 && bitBoard.GetPieceFromPos(RightPos).team != team) { AddMoveIfValidSquare(team, pos, RightPos, moves); bBreak = bitBoard.GetPieceFromPos(RightPos).team != EChessTeam.None; RightPos = new BoardPos(RightPos).GetRight(); } }
protected void btnSAVE_Click(object sender, EventArgs e) { utility utlObj = new utility(); txtWork_Position_Thai.Text = utlObj.removeAllQuotes(txtWork_Position_Thai.Text); txtWork_Position_Eng.Text = utlObj.removeAllQuotes(txtWork_Position_Eng.Text); if (txtWork_Position_Thai.Text.Length <= 0 || txtWork_Position_Thai.Text.Length > 50) { MsgValidate("โปรดระบุ ชื่อตำแหน่งาน (ภาษาไทย)"); } else if (txtWork_Position_Eng.Text.Length <= 0 || txtWork_Position_Eng.Text.Length > 50) { MsgValidate("โปรดระบุ ชื่อตำแหน่งาน (ภาษาอังกฤษ)"); } else { BoardPosData update_data = new BoardPosData(); update_data.Position_Thai = txtWork_Position_Thai.Text; update_data.Position_Eng = txtWork_Position_Eng.Text; update_data.Status = ddlStatus.SelectedValue; update_data.Position_Code = Request.QueryString["position"]; string result = new BoardPos().updateBoardPos(update_data); if (result == "OK") { divSuccess.Visible = true; showDiv.Visible = false; } else { MsgValidate("ไม่สามารถตำแหน่งงานบริหาร กรุณาทำใหม่อีกครั้ง"); } } }
public void GetValidPawnMoves(EChessTeam team, int pos, List <Move> moves) { int FrontPos = -1, LeftFrontPos = -1, RightFrontPos = -1; if (team == EChessTeam.White) { FrontPos = new BoardPos(pos).GetTop(); if (FrontPos != -1) { LeftFrontPos = new BoardPos(FrontPos).GetLeft(); RightFrontPos = new BoardPos(FrontPos).GetRight(); } if (new BoardPos(pos).Y == 1 && bitBoard.GetPieceFromPos(pos + BOARD_SIZE).piece == EPieceType.None) { AddMoveIfValidSquare(team, pos, new BoardPos(FrontPos).GetTop(), moves, (int)ETeamFlag.None); } } else { FrontPos = new BoardPos(pos).GetBottom(); if (FrontPos != -1) { RightFrontPos = new BoardPos(FrontPos).GetLeft(); LeftFrontPos = new BoardPos(FrontPos).GetRight(); } if (new BoardPos(pos).Y == 6 && bitBoard.GetPieceFromPos(pos - BOARD_SIZE).piece == EPieceType.None) { AddMoveIfValidSquare(team, pos, new BoardPos(FrontPos).GetBottom(), moves, (int)ETeamFlag.None); } } AddMoveIfValidSquare(team, pos, FrontPos, moves, (int)ETeamFlag.None); AddMoveIfValidSquare(team, pos, LeftFrontPos, moves, (int)ETeamFlag.Enemy); AddMoveIfValidSquare(team, pos, RightFrontPos, moves, (int)ETeamFlag.Enemy); }
public BeamSourceData(BoardPos boardPos, bool isMovable, int channelID) { this.boardPos = boardPos; this.isMovable = isMovable; this.channelID = channelID; }
public ExitSpotData(BoardPos boardPos) { this.boardPos = boardPos; }
public GenericTileData(Guid myGuid, TileType myType, BoardPos boardPos) { this.MyGuid = myGuid; this.MyType = myType; this.boardPos = boardPos; }
public PlayerData(BoardPos boardPos, bool isDead) { this.boardPos = boardPos; this.isDead = isDead; }
// ---------------------------------------------------------------- // Doers // ---------------------------------------------------------------- protected void SetPosFromBoardPos(BoardPos boardPos) { pos = new Vector3(boardPos.col * UnitSize, boardPos.row * UnitSize); }
private void SetSideFacing(int _sideFacing) { BoardPos = new BoardPos(ColRow, ChirH, ChirV, _sideFacing); //BoardPos.SideFacing = sideFacing; OnSetSideFacing(); }
public VoydData(BoardPos boardPos, bool isOn, bool doTogFromUsage) { this.boardPos = boardPos; this.isOn = isOn; this.doTogFromUsage = doTogFromUsage; }
public void ChangeChirality(int deltaH, int deltaV) { BoardPos = new BoardPos(ColRow, ChirH * deltaH, ChirV * deltaV, SideFacing); }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty)) { /*=============================*/ if (!Page.IsPostBack) { fail.Visible = false; divSuccess.Visible = false; // ประเภทอาจารย์ ddlLecturerType.Items.Clear(); List <LecturerType> lec_type = new List <LecturerType>(); lec_type = new LecturerType().getLecturerType2(); foreach (LecturerType row in lec_type) { ddlLecturerType.Items.Insert(ddlLecturerType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode)); } //=========== // ตำแหน่ง ddlPosition.Items.Clear(); List <BoardPosData> position_data = new List <BoardPosData>(); position_data = new BoardPos().getBoardPos(); foreach (BoardPosData pos in position_data) { ddlPosition.Items.Insert(ddlPosition.Items.Count, new ListItem(pos.Position_Thai, pos.Position_Code)); } try { string lecturer_type = Request.QueryString["type"]; string lecturer_position = Request.QueryString["position"]; WorkLoadConfigData workload_data = new WorkLoadConfigData(); workload_data = new WorkLoadConfig().getWorkLoadConfig(lecturer_type, lecturer_position); ddlLecturerType.Items.FindByValue(lecturer_type).Selected = true; ddlPosition.Items.FindByValue(lecturer_position).Selected = true; txtWorkloadValue.Text = workload_data.HourReference.ToString(); txtMaxWorkloadValue.Text = workload_data.TotalCredit.ToString(); ddlLecturerType.Enabled = false; ddlPosition.Enabled = false; } catch (Exception err) { Session["response"] = err.ToString(); Response.Redirect("err_response.aspx"); } } /*=============================*/ } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("err_response.aspx"); } } }
public float DistanceTo(BoardPos to) { return(Mathf.Sqrt(Mathf.Pow(x - to.x, 2) + Mathf.Pow(y - to.y, 2))); }
public bool Equals(BoardPos obj) { return(obj.x == x && obj.y == y); }
protected void Page_Load(object sender, EventArgs e) { if (Session["login_data"] == null) { Response.Redirect("../index.aspx"); } else { //ตรวจสอบสิทธิ์ login_data = (UserLoginData)Session["login_data"]; if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { // ======== Process =========== if (!Page.IsPostBack) { prefix = new Prefix().getPrefix(); foreach (PrefixData row in prefix) { ddlTITLE_THAINAME.Items.Insert(ddlTITLE_THAINAME.Items.Count, new ListItem(row.Prefix_Thai, row.Prefix_Code)); ddlTITLE_ENGNAME.Items.Insert(ddlTITLE_ENGNAME.Items.Count, new ListItem(row.Prefix_Eng, row.Prefix_Code)); } academicPosition = new AcademicPosition().getAcademicPosition(); foreach (AcademicPosition row in academicPosition) { ddlACADEMIC_POSITION.Items.Insert(ddlACADEMIC_POSITION.Items.Count, new ListItem(row.AcademicPositionThName, row.AcademicPositionCode)); } province = new TQF.Province().getProvince(); foreach (TQF.Province row in province) { ddlBirthProvince.Items.Insert(ddlBirthProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode)); ddlHomeProvince.Items.Insert(ddlHomeProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode)); ddlOfficeProvince.Items.Insert(ddlOfficeProvince.Items.Count, new ListItem(row.ProvinceThai, row.ProvinceCode)); } lecturerType = new LecturerType().getLecturerType(); foreach (LecturerType row in lecturerType) { ddlLECTURER_CAT.Items.Insert(ddlLECTURER_CAT.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode)); } List <LecturerType> lectuere_type_Data = new List <LecturerType>(); lectuere_type_Data = new LecturerType().getLecturerType2(); foreach (LecturerType row in lectuere_type_Data) { ddlLectuereType.Items.Insert(ddlLectuereType.Items.Count, new ListItem(row.LecturerTypeName, row.LecturerTypeCode)); } List <BoardPosData> position_Data = new List <BoardPosData>(); position_Data = new BoardPos().getBoardPos(); foreach (BoardPosData row in position_Data) { ddlLectuerePosition.Items.Insert(ddlLectuerePosition.Items.Count, new ListItem(row.Position_Thai, row.Position_Code)); } country = new Country().getCountry(); foreach (CountryData row in country) { ddlCountry.Items.Insert(ddlCountry.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code)); ddlEthnicity.Items.Insert(ddlEthnicity.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code)); ddlNationality.Items.Insert(ddlNationality.Items.Count, new ListItem(row.Country_ThaiName, row.Country_Code)); } ddlCountry.Items.FindByValue("066").Selected = true; ddlEthnicity.Items.FindByValue("066").Selected = true; ddlNationality.Items.FindByValue("066").Selected = true; occupation = new Occupation().getOccupation(); foreach (OccupationData row in occupation) { ddlOccupation.Items.Insert(ddlOccupation.Items.Count, new ListItem(row.Occupation_Thai, row.Occupation_Code)); } marital = new Marital().getMarital(); foreach (MaritalData row in marital) { ddlMarital.Items.Insert(ddlMarital.Items.Count, new ListItem(row.Marital_Thai, row.Marital_Code)); } religion = new Religion().getReligion(); foreach (ReligionData row in religion) { ddlReligion.Items.Insert(ddlReligion.Items.Count, new ListItem(row.Religion_ThaiName, row.Religion_Code)); } bank = new BankCode().getBankCode(); foreach (BankCodeData row in bank) { ddlBank.Items.Insert(ddlBank.Items.Count, new ListItem(row.Bank_ThaiName, row.Bank_Code)); } try { ddlBank.Items.FindByValue("002").Selected = true; } catch { } //วิชาการคณะ if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty)) { List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty); // คณะ facultyData = new Faculty().getFaculty(faculty_authorized); foreach (FacultyData data in facultyData) { ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code)); } departmentData = new Department().getDepartmentWithFaculty(ddlFACULTY.SelectedValue); ddlDEPARTMENT.Items.Clear(); ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem("-- เลือก --", "0000")); foreach (DepartmentData data in departmentData) { ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } } //วิชาการภาค else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department)) { ddlFACULTY.Enabled = false; ddlFACULTY.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC"); List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department); // ภาควิชา departmentData = new Department().getDepartment(department_authorized); ddlDEPARTMENT.Items.Clear(); ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem("-- เลือก --", "0000")); foreach (DepartmentData data in departmentData) { ddlDEPARTMENT.Items.Insert(ddlDEPARTMENT.Items.Count, new ListItem(data.Department_Thai, data.Department_Code)); } // คณะ faculty_data = new Faculty().getFaculty(ddlDEPARTMENT.SelectedValue.Substring(0, 2)); ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code)); } } // End if (!Page.IsPostBack) //============================= } else { HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน"; HttpContext.Current.Response.Redirect("../err_response.aspx"); } } }
public Vector3 LogicPosToVisualPos(BoardPos pos) { return(new Vector3(pos.x, -pos.y, -pos.y)); }