Example #1
0
    // List更新系

    /*
     *  public static void addPlayer(string iRegDate, Transform trsPrefab = null) {			// 新規の選手情報のList追加と同時に対戦リストも追加
     *          MemberManager.posMemberOfRegDate (iRegDate);
     *          GameManager.initPlayer ();
     *          GameManager.regDate = MemberManager.regDate;
     *          GameManager.nameKaji_family = MemberManager.nameKaji_family;
     *          GameManager.nameKaji_first = MemberManager.nameKaji_first;
     *          GameManager.nameKana_family = MemberManager.nameKana_family;
     *          GameManager.nameKana_first = MemberManager.nameKana_first;
     *          GameManager.gender = MemberManager.gender;
     *          GameManager.idxPriority = MemberManager.idxRec + 1;
     *          GameManager.placeStat = GameManager.PLACE_WAIT;
     *          GameManager.flgDelete = 0;
     *
     *          DateTime dtMem = DateTime.Parse (MemberManager.saveDate);
     *          DateTime dtGam = DateTime.Parse (GameManager.saveDate);
     *          if (dtMem > dtGam) {
     *                  int gameAjt = 0;		// 試合途中参加のGame数補正
     *                  if (GameList.Instance.playerList.Count != 0 && SettingManager.joinInit == 1)	{					// 既存選手のgame数+補正の最小値に合わせる
     *                          gameAjt = GameList.Instance.playerList.Select (p => p.game+p.gameAjust).Min ();		// 連続追加でgame数が減少しつづけるため最小-1はしない
     *                  }
     *                  GameManager.gameAjust = gameAjt;
     *          }
     *          GameList.Instance.playerList.Add (_player);
     *
     *          List<_Match> ml = new List<_Match>();
     *          _Match m0 = new _Match ();
     *          m0.myRegDate = _player.regDate;		//最初の自分対自分は2人目でデータ作成時にRegDateを取り出すためだけに必要
     *          m0.youRegDate = _player.regDate;
     *          ml.Add (m0);
     *
     *          _TrsPlayer ts = new _TrsPlayer ();
     *          ts.regDate = MemberManager.regDate;
     *          ts.trsPlayer = trsPrefab;
     *          TrsPlayer.Instance.trsPlayerList.Add (ts);
     *
     *          var q = GameList.Instance.matchList.Select(m => m.myRegDate).Distinct();
     *          foreach (string qRegDate in q)  {
     *                  _Match m1 = new _Match ();
     *                  m1.myRegDate = _player.regDate;
     *                  m1.youRegDate = qRegDate;
     *                  ml.Add (m1);
     *                  _Match m2 = new _Match ();
     *                  m2.myRegDate = qRegDate;
     *                  m2.youRegDate = _player.regDate;
     *                  ml.Add (m2);
     *          }
     *
     *          foreach (_Match m in ml) {
     *                  GameList.Instance.matchList.Add (m);
     *          }
     *  }
     */
    public static void addPlayer(string iRegDate, bool flgAdd)           // 新規の選手情報のList追加と同時に対戦リストも追加 (iMatchup専用)
    {
        MemberManager.posMemberOfRegDate(iRegDate);
        GameManager.initPlayer();
        GameManager.regDate         = MemberManager.regDate;
        GameManager.nameKaji_family = MemberManager.nameKaji_family;
        GameManager.nameKaji_first  = MemberManager.nameKaji_first;
        GameManager.nameKana_family = MemberManager.nameKana_family;
        GameManager.nameKana_first  = MemberManager.nameKana_first;
        GameManager.gender          = MemberManager.gender;
        GameManager.idxPriority     = MemberManager.idxRec + 1;
        GameManager.placeStat       = GameManager.PLACE_WAIT;
        GameManager.flgDelete       = 0;

        if (flgAdd)
        {
            int gameAjt = 0;                                                                        // 試合途中参加のGame数補正
            if (GameList.Instance.playerList.Count != 0 && SettingManager.joinInit == 1)            // 既存選手のgame数+補正の最小値に合わせる
            {
                gameAjt = GameList.Instance.playerList.Select(p => p.game + p.gameAjust).Min() - 1; // 連続追加でgame数から最小-1する
            }
            GameManager.gameAjust = gameAjt;
        }
        GameList.Instance.playerList.Add(_player);

        List <_Match> ml = new List <_Match>();
        _Match        m0 = new _Match();

        m0.myRegDate  = _player.regDate;    //最初の自分対自分は2人目でデータ作成時にRegDateを取り出すためだけに必要
        m0.youRegDate = _player.regDate;
        ml.Add(m0);

        var q = GameList.Instance.matchList.Select(m => m.myRegDate).Distinct();

        foreach (string qRegDate in q)
        {
            _Match m1 = new _Match();
            m1.myRegDate  = _player.regDate;
            m1.youRegDate = qRegDate;
            ml.Add(m1);
            _Match m2 = new _Match();
            m2.myRegDate  = qRegDate;
            m2.youRegDate = _player.regDate;
            ml.Add(m2);
        }

        foreach (_Match m in ml)
        {
            GameList.Instance.matchList.Add(m);
        }
    }
Example #2
0
        public static P EndMatch <T, P>(this _Match <T, P> poSwitch)
        {
            if (poSwitch == null)
            {
                return(default(P));
            }

            if (poSwitch.HasValue)
            {
                return(poSwitch.Value);
            }

            return(poSwitch.DefaultValue);
        }
Example #3
0
        public static P EndMatch <T, P>(this _Match <T, P> poSwitch, Func <T, P, P> poAction)
        {
            if (poSwitch == null)
            {
                return(default(P));
            }

            if (poSwitch.HasValue)
            {
                return(poSwitch.Value);
            }

            return(poAction(poSwitch.Contents, poSwitch.DefaultValue));
        }
Example #4
0
        public static _Match <T, P> Case <T, P>(this _Match <T, P> poSwitch, Func <T, Boolean> poPredicate, Func <T, P> poAction)
        {
            if (poSwitch == null)
            {
                return(null);
            }

            if (!poSwitch.HasValue)
            {
                if (poPredicate(poSwitch.Contents))
                {
                    poSwitch.Value = poAction(poSwitch.Contents);
                }
            }

            return(poSwitch);
        }
Example #5
0
 public static _Match <T, P> Case <T, P>(this _Match <T, P> poSwitch, Func <T, Boolean> poPredicate, P poReturnValue)
 {
     return(poSwitch.Case(poPredicate, o => poReturnValue));
 }
Example #6
0
 public static _Match <T, P> Case <T, P>(this _Match <T, P> poSwitch, T poValue, P poReturnValue)
 {
     return(poSwitch.Case(o => o == null ? poValue == null : o.Equals(poValue), poReturnValue));
 }
Example #7
0
 public static _Match <T, P> Case <T, P>(this _Match <T, P> poSwitch, T poValue, Func <T, P> poAction)
 {
     return(poSwitch.Case(o => o == null ? poValue == null : o.Equals(poValue), poAction));
 }
Example #8
0
 // -- function --
 public static void initPlayer()                                                                     // ワークの初期化生成
 {
     _player = new _Player();
     _match  = new _Match();
 }