From 78970ef5c3631ea90de6c9478f784547831632ba Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Tue, 8 Nov 2022 15:29:42 +0530 Subject: [PATCH] update for game logic --- .../destination/destination_controller.dart | 10 ++- lib/widgets/bottom_sheet_new.dart | 75 +++++++++---------- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 21d9b5f..713ef1c 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -173,7 +173,7 @@ class DestinationController extends GetxController { 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}----"); chekcs = 2; @@ -244,7 +244,7 @@ class DestinationController extends GetxController { print("--- loc already checked in ${location_already_checked_in} ---"); if(isUser_logged_in && d.cp == -1 && location_already_checked_in){ //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 print("---- in goal -----"); chekcs = 5; @@ -369,11 +369,15 @@ class DestinationController extends GetxController { // } void resetRogaining(){ + currentSelectedDestinations.forEach((element) { + deleteDestination(element); + }); + is_in_checkin.value = false; is_in_rog.value = false; is_at_start.value = false; is_at_goal.value = false; - destinations.clear(); + _start = 0; chekcs = 0; diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index fc30335..0310ee9 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -181,23 +181,6 @@ class BottomSheetNew extends GetView { destinationController.is_photo_shoot.value = true; 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{ destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, ""); @@ -213,6 +196,7 @@ class BottomSheetNew extends GetView { //Get.back(); }, child: Text( + //Checkin indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ? "チェックイン" : @@ -233,6 +217,7 @@ class BottomSheetNew extends GetView { ExternalService().StartRogaining().then((value) => Get.back()); }, child: Text( + // start indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? "ロゲイニングを開始" : @@ -251,6 +236,7 @@ class BottomSheetNew extends GetView { Get.back(); }, child: Text( + //goal indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? "ロゲイニングを終える" : @@ -372,35 +358,44 @@ class BottomSheetNew extends GetView { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Obx(() => - indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ? - Row( - children: [ - ElevatedButton( + Obx(() => + indexController.currentDestinationFeature.isNotEmpty && indexController.currentDestinationFeature[0].cp == -1 && indexController.currentDestinationFeature[0].checkedin == false && destinationController.is_at_start.value == true ? + ElevatedButton( + onPressed: (){ + 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: (){ - if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){ - 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.toNamed(AppPages.CAMERA_PAGE); Get.back(); }, 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(