Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Robert3141/Connectron
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert3141 committed Dec 16, 2019
2 parents 2af191e + e95a22b commit 450b9f5
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 9 deletions.
Binary file added assets/ic_launcher-web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
flutter build appbundle && echo - && echo APP BUNDLE BUILD DONE && echo - && flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi && echo - && echo APK BUILD DONE && echo - && flutter build web && echo - && echo WEB BUILD DONE && echo - && cd ./build/web && del /f web.zip && 7z a -tzip web.zip * && copy web.zip "../app/outputs/apk/release" && cd ../../ && echo - && echo WEB ZIPPED && echo -
flutter build appbundle && echo - && echo APP BUNDLE BUILD DONE && echo - && flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi && echo - && echo APK BUILD DONE && echo - && flutter build web && echo - && echo WEB BUILD DONE && echo - && cd ./build/web && @del /f web.zip && @7z a -tzip web.zip * && @copy /y web.zip "../app/outputs/apk/release" && cd ../../ && echo - && echo WEB ZIPPED && echo -

51 changes: 51 additions & 0 deletions lib/UI/UIMultiplayer-LAN.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import 'package:Connectron/globals.dart' as globals;
import 'package:dynamic_theme/dynamic_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class MultiPlayerPage extends StatefulWidget {
MultiPlayerPage({Key key, this.title}) : super(key: key);

final String title;

@override
_MultiPlayerState createState() => _MultiPlayerState();
}

class _MultiPlayerState extends State<MultiPlayerPage> {

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
actions: <Widget>[
IconButton(
icon: Icon(Icons.brightness_3),
onPressed: () {
DynamicTheme.of(context).setBrightness(
Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark
);
},
),
IconButton(
icon: Icon(Icons.help),
onPressed: () {
//TODO: Add main page help
},
)
],
),
body: Container(
padding: EdgeInsets.all(globals.defaultPadding),
child: ListView(
children: [

],
),
),
);
}
}
8 changes: 5 additions & 3 deletions lib/UI/UIgame.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _GamePageState extends State<GamePage> {
setState(() {
showDialog<String>(
context: context,
barrierDismissible: false,
barrierDismissible: true,
builder: (BuildContext context) => AlertDialog(
title: Text(messageTitle),
content: Text(message),
Expand Down Expand Up @@ -195,6 +195,7 @@ class _GamePageState extends State<GamePage> {
globals.outputMsgOverall +
globals.playerNames[overallWinner],
true);
//user can't play anymore so running continues
} else {
//output winner
msgBox(globals.outputTitleWin,
Expand All @@ -205,9 +206,10 @@ class _GamePageState extends State<GamePage> {
globals.mainBoard = new List<List<int>>.generate(globals.boardSize,
(i) => List<int>.generate(globals.boardSize, (j) => 0));
globals.playerNumber = 1;
//end running
globals.running = false;
}
//end running
globals.running = false;

}

void onColumnPressed(int columnNumber, bool bombPlayed) async {
Expand Down
67 changes: 67 additions & 0 deletions lib/UI/UIhome.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@


import 'dart:ui';

import 'package:Connectron/UI/UIMultiplayer-LAN.dart';
import 'package:Connectron/UI/UIsettings.dart';
import 'package:Connectron/globals.dart' as globals;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class HomeAppPage extends StatefulWidget {
HomeAppPage({Key key, this.title}) : super(key: key);

final String title;

@override
_HomeAppState createState() => _HomeAppState();
}

class _HomeAppState extends State<HomeAppPage> {

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
padding: EdgeInsets.all(globals.defaultPadding),
child: ListView(
children: [
Container(
width: 200,//TODO: set as global const
height: 200,//TODO: set as global const
alignment: Alignment.center,
child: Image(image: AssetImage('assets/ic_launcher-web.png')),//TODO: set as global const
),

RaisedButton(
child: Text("Play Game"),//TODO: set as global const
color: Theme.of(context).primaryColor,
textTheme: ButtonTextTheme.primary,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SettingsPage(title: globals.titleSettings),
)
);
},
),
RaisedButton(
child: Text("LAN Multiplayer"),//TODO: set as global const
color: Theme.of(context).primaryColor,
textTheme: ButtonTextTheme.primary,
onPressed: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MultiPlayerPage(title: "Multiplayer"),//TODO: set as global const
)
);
},
),
],
),
),
);
}
}
3 changes: 2 additions & 1 deletion lib/UI/UIsettings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ class _SettingsState extends State<SettingsPage> {
DynamicTheme.of(context).setBrightness(
Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark);
: Brightness.dark
);
},
),
IconButton(
Expand Down
6 changes: 3 additions & 3 deletions lib/globals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const String lblBoardSize = "Board Size ($boardMin-$boardMax)";
const String lblAmountOfPlayers = "Amount of players ($playerMin-$playerMax)";
const String lblLineLength = "Line Length ($lineMin-$lineMax)";
const String lblRoundNum = "Number of rounds ($roundMin-$roundMax)";
const String lblRecursion = "CPU Level ($recursionMin-$recursionMax)";
const String lblRecursion = "Difficulty Level ($recursionMin-$recursionMax)";
const String lblBombCounter = "Use bomb counter";
const String lblRunGame = "Run Game";
const String errorTitleError = "Error";
Expand All @@ -61,8 +61,8 @@ const String errorMsgInputLineLengthLarge = "The line length is too large. It sh
const String errorMsgInputLineLengthProblem = "The line length is larger than the board!";
const String errorMsgInputRoundSmall = "The round number is too small. It should be $roundMin-$roundMax";
const String errorMsgInputRoundLarge = "The round number is too large. It should be $roundMin-$roundMax";
const String errorMsgInputRecursionSmall = "The CPU level is too small. It should be $recursionMin-$recursionMax";
const String errorMsgInputRecursionLarge = "The CPU level is too large. It should be $recursionMin-$recursionMax";
const String errorMsgInputRecursionSmall = "The Difficulty level is too small. It should be $recursionMin-$recursionMax";
const String errorMsgInputRecursionLarge = "The Difficulty level is too large. It should be $recursionMin-$recursionMax";
const String helpTitleHelp = "Help";
const String helpMsgHelpMain = "Connectron is a Connect 4 style game played by $playerMin-$playerMax. Use the presets to select a game for players or delve into the fine tuning for precise setup";
const String helpOptionalPresets = "Premade settings for the game (good for most use cases)";
Expand Down
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:Connectron/UI/UIhome.dart';
import 'package:Connectron/globals.dart' as globals;
import 'package:flutter/material.dart';
import 'package:Connectron/UI/UIsettings.dart';
Expand Down Expand Up @@ -25,7 +26,7 @@ class MyApp extends StatelessWidget {
primaryColor: globals.playerColors[1],
brightness: Brightness.dark,
),
home: SettingsPage(title: globals.titleSettings),
home: HomeAppPage(title: "Main",),//TODO: set as global const
);
},
);
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ flutter:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- assets/

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
Expand Down
7 changes: 7 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<!DOCTYPE html>

<html>

<head>
<link rel="icon" href="ic_launcher-web.png" sizes="16x16">
<meta charset="UTF-8">

<link id="loadStyle" rel="stylesheet" type="text/css" href="loading.css">

<title>Connectron</title>
<style>
body {background-color: red}
</style>
</head>

<body>
<img src="ic_launcher-web.png" style="display: block; margin-left:auto; margin-right:auto; margin-top: auto; margin-bottom: auto">
<script src="main.dart.js" type="application/javascript"></script>
</body>

</html>
20 changes: 20 additions & 0 deletions web/loading.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
body, html {
height: 100%;
margin: 0px;
}

#loader {
z-index: 0;
height: 100%;
width: 100%;
background-color: #C62828;
}


#icon {
width: 100px;
height: 100px;
top: 50%;
left: 50%;
position: relative;
}

0 comments on commit 450b9f5

Please sign in to comment.