update for game logic

This commit is contained in:
Mohamed Nouffer
2022-11-08 15:29:42 +05:30
parent 991c6694c2
commit 78970ef5c3
2 changed files with 42 additions and 43 deletions

View File

@ -173,7 +173,7 @@ class DestinationController extends GetxController {
is_in_checkin.value = false; is_in_checkin.value = false;
}); });
} }
else if(is_in_rog.value == true) else if(is_in_rog.value == true && indexController.rog_mode == 1)
{ {
print("----- in location popup checkin cp - ${d.cp}----"); print("----- in location popup checkin cp - ${d.cp}----");
chekcs = 2; chekcs = 2;
@ -244,7 +244,7 @@ class DestinationController extends GetxController {
print("--- loc already checked in ${location_already_checked_in} ---"); print("--- loc already checked in ${location_already_checked_in} ---");
if(isUser_logged_in && d.cp == -1 && location_already_checked_in){ if(isUser_logged_in && d.cp == -1 && location_already_checked_in){
//check for rogaining //check for rogaining
if(is_at_goal.value == false && rogaining_counted.value && indexController.rog_mode == 1){ if(is_at_goal.value == false && rogaining_counted.value){
//goal //goal
print("---- in goal -----"); print("---- in goal -----");
chekcs = 5; chekcs = 5;
@ -369,11 +369,15 @@ class DestinationController extends GetxController {
// } // }
void resetRogaining(){ void resetRogaining(){
currentSelectedDestinations.forEach((element) {
deleteDestination(element);
});
is_in_checkin.value = false; is_in_checkin.value = false;
is_in_rog.value = false; is_in_rog.value = false;
is_at_start.value = false; is_at_start.value = false;
is_at_goal.value = false; is_at_goal.value = false;
destinations.clear();
_start = 0; _start = 0;
chekcs = 0; chekcs = 0;

View File

@ -181,23 +181,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
destinationController.is_photo_shoot.value = true; destinationController.is_photo_shoot.value = true;
Get.back(); Get.back();
// showMaterialModalBottomSheet(
// expand: true,
// context: Get.context!,
// backgroundColor: Colors.transparent,
// builder: (context) => BottomSheetNew()
// ).whenComplete(() {
// });
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
// //builder:((context) => CameraPage())
// builder:((context) => Container(child: Text("model"),))
// ).whenComplete((){
// // destinationController.makeCheckin(indexController.currentDestinationFeature[0], true);
// // if(indexController.currentDestinationFeature[0].cp != -1){
// // destinationController.rogaining_counted.value =true;
// // }
// });
} }
else{ else{
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, ""); destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, "");
@ -213,6 +196,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
//Get.back(); //Get.back();
}, },
child: Text( child: Text(
//Checkin
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ? indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
"チェックイン" "チェックイン"
: :
@ -233,6 +217,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
ExternalService().StartRogaining().then((value) => Get.back()); ExternalService().StartRogaining().then((value) => Get.back());
}, },
child: Text( child: Text(
// start
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"ロゲイニングを開始" "ロゲイニングを開始"
: :
@ -251,6 +236,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Get.back(); Get.back();
}, },
child: Text( child: Text(
//goal
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"ロゲイニングを終える" "ロゲイニングを終える"
: :
@ -372,35 +358,44 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Obx(() => Obx(() =>
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ? indexController.currentDestinationFeature.isNotEmpty && indexController.currentDestinationFeature[0].cp == -1 && indexController.currentDestinationFeature[0].checkedin == false && destinationController.is_at_start.value == true ?
Row( ElevatedButton(
children: [ onPressed: (){
ElevatedButton( destinationController.is_in_rog.value = true;
destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!);
ExternalService().StartRogaining().then((value) => Get.back());
},
child: Text(
// start
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"ロゲイニングを開始"
:
"間違った目的地..."
)
)
:
Container(),
),
Obx(() =>
destinationController.is_at_goal.value == true && destinationController.rogaining_counted ==true ?
ElevatedButton(
onPressed: (){ onPressed: (){
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){ Get.toNamed(AppPages.CAMERA_PAGE);
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, "");
if(indexController.currentDestinationFeature[0].cp != -1){
destinationController.rogaining_counted.value =true;
}
}
else{
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false, "");
}
Get.back(); Get.back();
}, },
child: Text( child: Text(
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ? //goal
"チェックイン" indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"ロゲイニングを終える"
: :
"チェックアウト" "間違った目的地 ..."
) )
), )
], :
) Container(),
: ),
Container(),
),
], ],
), ),
Row( Row(