Skip to content

Instantly share code, notes, and snippets.

var postUrl = "https://hooks.slack.com/services/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";
var postChannel = "#pj-mjd-dev";
var userName = "アリシアたん";
var message = "リポジトリが更新されたよ!";
var iconURL = "https://i.imgur.com/UjhNHon.png";
function myFunction() {
// 未読の指定ラベル を検索
var threads = GmailApp.search("has:nouserlabels is:unread");
// ゲームオーバー確認 ゲームオーバーの遷移はここで行っている
void CheckGameOver()
{
   // 0がマスにあったら終了
    for (int x = 0; x <= 3; x++)
      for (int y = 0; y <= 3; y++)
         if (board[x, y] == 0)
             return;
   // 前後左右に同じ数字のマスがないか探索 あったら終了
// 数字の大きさを桁数に応じて変更
public void ChangeScaleText()
{
   foreach (var cell in textList)
   {
      var value = int.Parse(cell.text);// 桁数を取得
      switch (Digit(value))
      {
         case 0:
            break;
// 画面を更新
void UpdateDisplay()
{
   int counterX = 0;
   int counterY = 0;
   foreach (var value in textList)//変数Boardを画面の数字テキストに全て反映させる
   {
      value.text = board[counterX, counterY].ToString();
      counterX++;
      if (counterX > 3)
// 数字を生成
void GenerateNumber()
{
   int counter = 0;
   int randNumX = Random.Range(0, 4);// ランダムに0~4の数字を生成
   int randNumY = Random.Range(0, 4);// ランダムに0~4の数字を生成
   // 生成できない場合は合いているマスを探索する
   while (counter <= 15)
   {
// スコア更新のアニメーションを再生
void PlayScoreUpAnimation()
{
   if(scoreUpAnim)// scoreUpAnimがアタッチされていたら実行
      scoreUpAnim.Play("ScoreUp", 0, 0.0f);
}
// 数字を移動させる
void MoveBoard()
{
// 盤面を移動
    for (int i = 0; i < 3; i++)
    {
       for (int x = 0; x <= 3; x++)
       {
          for (int y = 0; y <= 3; y++)
          {
// リセットボタン用
public void Reset()
{
  if(gameOverText)// gameOverTextがアタッチされていてたら実行
      gameOverText.text = "";
   scoreText.text = "0";
   socre = 0;
   for (int x = 0; x <= 3; x++)
      for (int y = 0; y <= 3; y++)
// 初期化
void Initilize()
{
   isPlay = false;
   isUpdate = false;
   isCalculation = false;
   upScore = 0;
}
// キー入力を管理するEnum
enum MoveAngle
{
   Right,
   Left,
   Up,
   Down
}