2019-11-26 00:08:27 UNSELECTED

Unknown type code

Copy Copied! Full
function KomaPermission(fn_put_flg, fn_bl_wh, fn_put_num) local permission_bl_wh if fn_bl_wh == 0 then permission_bl_wh = 1 else permission_bl_wh = 0 end --横 local syou = math.floor((fn_put_num - 1) / 8) + 1 local amari = (fn_put_num - 1) % 8 + 1 local flg = false for i = 1, 7 do if (i + amari) <= 8 then if fn_put_flg[fn_put_num + i] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end flg = false for i = 1, 7 do if (amari - i) >= 1 then if fn_put_flg[fn_put_num - i] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end --縦 flg = false for i = 1, 7 do if (i + syou) <= 8 then if fn_put_flg[fn_put_num + i * 8] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i * 8] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end flg = false for i = 1, 7 do if (syou - i) >= 1 then if fn_put_flg[fn_put_num - i * 8] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i * 8] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end --ななめ flg = false for i = 1, 7 do if (i + amari) <= 8 and (syou + i) <= 8 then if fn_put_flg[fn_put_num + i * 9] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i * 9] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end flg = false for i = 1, 7 do if (amari - i) >= 1 and (syou - i) >= 1 then if fn_put_flg[fn_put_num - i * 9] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i * 9] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end flg = false for i = 1, 7 do if (i + amari) <= 8 and (syou - i) >= 1 then if fn_put_flg[fn_put_num - i * 7] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i * 7] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end flg = false for i = 1, 7 do if (amari - i) >= 1 and (syou + i) <= 8 then if fn_put_flg[fn_put_num + i * 7] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i * 7] == permission_bl_wh then flg = true else if flg then return true else break end end end else break end end return false end function KomaReverse(fn_put_flg, fn_bl_wh, fn_put_num) local ret_data = TableCreate(fn_put_flg) local permission_bl_wh if fn_bl_wh == 0 then permission_bl_wh = 1 else permission_bl_wh = 0 end --横 local syou = math.floor((fn_put_num - 1) / 8) + 1 local amari = (fn_put_num - 1) % 8 + 1 local flg = false local num = 0 for i = 1, 7 do if (i + amari) <= 8 then if fn_put_flg[fn_put_num + i] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num + i] = fn_bl_wh end else break end end end else break end end num = 0 flg = false for i = 1, 7 do if (amari - i) >= 1 then if fn_put_flg[fn_put_num - i] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num - i] = fn_bl_wh end else break end end end else break end end --縦 flg = false num = 0 for i = 1, 7 do if (i + syou) <= 8 then if fn_put_flg[fn_put_num + i * 8] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i * 8] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num + i * 8] = fn_bl_wh end else break end end end else break end end num = 0 flg = false for i = 1, 7 do if (syou - i) >= 1 then if fn_put_flg[fn_put_num - i * 8] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i * 8] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num - i * 8] = fn_bl_wh end else break end end end else break end end --ななめ flg = false num = 0 for i = 1, 7 do if (i + amari) <= 8 and (syou + i) <= 8 then if fn_put_flg[fn_put_num + i * 9] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i * 9] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num + i * 9] = fn_bl_wh end else break end end end else break end end num = 0 flg = false for i = 1, 7 do if (amari - i) >= 1 and (syou - i) >= 1 then if fn_put_flg[fn_put_num - i * 9] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i * 9] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num - i * 9] = fn_bl_wh end else break end end end else break end end num = 0 flg = false for i = 1, 7 do if (i + amari) <= 8 and (syou - i) >= 1 then if fn_put_flg[fn_put_num - i * 7] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num - i * 7] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num - i * 7] = fn_bl_wh end else break end end end else break end end num = 0 flg = false for i = 1, 7 do if (amari - i) >= 1 and (syou + i) <= 8 then if fn_put_flg[fn_put_num + i * 7] == 2 then break else --自分の色でない if fn_put_flg[fn_put_num + i * 7] == permission_bl_wh then flg = true num = num + 1 else if flg then for i = 1, num do ret_data[fn_put_num + i * 7] = fn_bl_wh end else break end end end else break end end return ret_data end function BanPut(fn_stone_num, fn_put_x, fn_put_y, fn_put_z) local ban = REVERSE_GAME.str_subitem[REVERSE_GAME.ban_num] --Rot_LocalQuat_Euler(ban, 10, 10, 10) local ban_pos = ban.GetLocalPosition() local ban_ang = ban.GetLocalRotation().eulerAngles --print("x:" .. ban_ang.x .. "y:" .. ban_ang.y .. "z:" .. ban_ang.z) local stone = REVERSE_GAME.str_stone_subitem[fn_stone_num] local a = fn_put_x local b = fn_put_y local c = fn_put_z ban_ang.x = -ban_ang.x ban_ang.y = -ban_ang.y ban_ang.z = -ban_ang.z local fn1 = math.cos(ban_ang.y / 180 * math.pi) * math.cos(ban_ang.z / 180 * math.pi) - math.sin(ban_ang.x / 180 * math.pi) * math.sin(ban_ang.y / 180 * math.pi) * math.sin(ban_ang.z / 180 * math.pi) local fn2 = -math.cos(ban_ang.x / 180 * math.pi) * math.sin(ban_ang.z / 180 * math.pi) local fn3 = math.sin(ban_ang.y / 180 * math.pi) * math.cos(ban_ang.z / 180 * math.pi) + math.sin(ban_ang.x / 180 * math.pi) * math.cos(ban_ang.y / 180 * math.pi) * math.sin(ban_ang.z / 180 * math.pi) local fn4 = math.cos(ban_ang.y / 180 * math.pi) * math.sin(ban_ang.z / 180 * math.pi) + math.sin(ban_ang.x / 180 * math.pi) * math.sin(ban_ang.y / 180 * math.pi) * math.cos(ban_ang.z / 180 * math.pi) local fn5 = math.cos(ban_ang.x / 180 * math.pi) * math.cos(ban_ang.z / 180 * math.pi) local fn6 = math.sin(ban_ang.y / 180 * math.pi) * math.sin(ban_ang.z / 180 * math.pi) - math.sin(ban_ang.x / 180 * math.pi) * math.cos(ban_ang.y / 180 * math.pi) * math.cos(ban_ang.z / 180 * math.pi) local fn7 = -math.cos(ban_ang.x / 180 * math.pi) * math.sin(ban_ang.y / 180 * math.pi) local fn8 = math.sin(ban_ang.x / 180 * math.pi) local fn9 = math.cos(ban_ang.x / 180 * math.pi) * math.cos(ban_ang.y / 180 * math.pi) local x2 = a * fn1 + b * fn4 + c * fn7 -- print("x:" .. fn1 .. "y:" .. fn4 .. "z:" .. fn7 .. "x2=" .. x2) local y2 = a * fn2 + b * fn5 + c * fn8 local z2 = a * fn3 + b * fn6 + c * fn9 local stone_pos = ban_pos stone_pos.z = ban_pos.z + z2 stone_pos.x = ban_pos.x + x2 stone_pos.y = ban_pos.y + y2 --print("x:" .. x2 .. "y:" .. y2 .. "z:" .. z2) if fn_stone_num ~= 0 then stone.SetLocalPosition(stone_pos) end stone_pos.z = z2 stone_pos.x = x2 stone_pos.y = y2 return stone_pos end function Koma_PL_Use(sender, name, message) if ASSET.IsMine then if message == 1 then if koma_first == 2 or koma_first == 1 then if min_num1 > 0 then local flg_data = {} flg_data = TableCreate(REVERSE_GAME.put_flg) if KomaPermission(flg_data, 0, min_num1) then if not cpu_flg or (auto_permission_flg == 0 or (cpu_flg and (0 ~= cpu_bl_flg))) then return_data = TableCreate(REVERSE_GAME.put_flg) koma_first = 0 REVERSE_GAME.put_flg = KomaReverse(flg_data, 0, min_num1) REVERSE_GAME.put_flg[min_num1] = 0 vci.message.Emit(REVERSE_GAME.str_stone .. "Scale", 1) if auto_permission_flg == 0 then auto_permission_flg = 1 end min_num1 = 0 min_num2 = 0 grab_flg = 1 end end end end elseif message == 2 then if koma_first == 2 or koma_first == 0 then if min_num2 > 0 then koma_first = 1 local flg_data = {} flg_data = TableCreate(REVERSE_GAME.put_flg) if KomaPermission(flg_data, 1, min_num2) then if not cpu_flg or (auto_permission_flg == 0 or (cpu_flg and (1 ~= cpu_bl_flg))) then return_data = TableCreate(REVERSE_GAME.put_flg) REVERSE_GAME.put_flg = KomaReverse(flg_data, 1, min_num2) REVERSE_GAME.put_flg[min_num2] = 1 vci.message.Emit(REVERSE_GAME.str_stone .. "Scale", 2) if auto_permission_flg == 0 then auto_permission_flg = 1 end min_num1 = 0 min_num2 = 0 grab_flg = 2 end end end end end end end function Koma_PL_Scale(sender, name, message) min_num1 = 0 min_num2 = 0 if message == 1 then local stone = REVERSE_GAME.str_stone_subitem[REVERSE_GAME.stone_PL[1]] if stone.IsMine then stone.SetLocalScale(Vector3.__new(0, 0, 0)) end elseif message == 2 then local stone = REVERSE_GAME.str_stone_subitem[REVERSE_GAME.stone_PL[2]] if stone.IsMine then stone.SetLocalScale(Vector3.__new(0, 0, 0)) end end end function FirstMessage(sender, name, message) FirstDataInput() end function ReturnMessage(sender, name, message) if ASSET.IsMine and return_data ~= nil then REVERSE_GAME.put_flg = return_data return_data = nil if koma_first == 0 then koma_first = 1 else koma_first = 0 end for i = 1, #REVERSE_GAME.str_stone_subitem do local stone = REVERSE_GAME.str_stone_subitem[i] local pos = Vector3.__new(0, 10000000, 0) stone.SetPosition(pos) end end end function CPUMessage(sender, name, message) if ASSET.IsMine then cpu_flg = not cpu_flg if auto_permission_flg == 1 then auto_permission_flg = 0 end end end function Bl_WhMessage(sender, name, message) if ASSET.IsMine then if cpu_bl_flg == 0 then cpu_bl_flg = 1 else cpu_bl_flg = 0 end end end function AutoPermissionMessage(sender, name, message) if ASSET.IsMine then if auto_permission_flg < 2 then auto_permission_flg = 2 else auto_permission_flg = 0 end end end --subitemをEuler角の値に変更 function Rot_Quat_Euler(subitem, x, y, z) subitem.SetRotation(Quaternion.Euler(x, y, z)) end --subitemをEuler角の値に変更 function Rot_LocalQuat_Euler(subitem, x, y, z) subitem.SetLocalRotation(Quaternion.Euler(x, y, z)) end vci.message.On(REVERSE_GAME.str_stone, Koma_PL_Use) vci.message.On(REVERSE_GAME.str_stone .. "Scale", Koma_PL_Scale) vci.message.On(REVERSE_GAME.str[REVERSE_GAME.first_num], FirstMessage) vci.message.On(REVERSE_GAME.str[REVERSE_GAME.return_num], ReturnMessage) vci.message.On(REVERSE_GAME.str[REVERSE_GAME.cpu_num], CPUMessage) vci.message.On(REVERSE_GAME.str[REVERSE_GAME.bl_wh_num], Bl_WhMessage) vci.message.On(REVERSE_GAME.str[REVERSE_GAME.auto_permission_num], AutoPermissionMessage)
RECOMMEND