Пример #1
0
        private void NewFragment_Dismissed(object sender, DialogEventArgs args)
        {
            Tasky.GlobalEntities.courseHoleByNumberListList = HoleManager.GetCourseHolesByHole(CourseID);
            var updatedCourseHoles      = HoleManager.GetCourseHolesByHole(CourseID);
            List <CourseTeeHole> chList = new List <CourseTeeHole>();

            foreach (var courseHole in updatedCourseHoles.CourseHoleDataLists[currentHoleNumber - 1].CourseHoles)
            {
                chList.Add(courseHole);
            }
            _listView.Adapter = new HoleDetails_GridView_HoleInfo_Adapter(this, chList);
        }
Пример #2
0
 public void SpawnMoles(HoleManager holeManager, LevelStats i_stats)
 {
     for (int i = 0; i < i_stats.moles.Count; i++)
     {
         GameObject moleObj = GameObject.Instantiate(i_stats.moles[i].molePrefab);
         moleObj.name = "Mole #" + i.ToString();
         moleObj.transform.SetParent(holeManager.transform);
         Mole mole = moleObj.AddComponent <Mole>();
         mole.behaviour = GameObject.Instantiate(i_stats.moles[i]);
         mole.StartMoleCycle(holeManager);
     }
 }
Пример #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var courseHoleByNumberList = JsonConvert.DeserializeObject <Tasky.CourseHoleByNumberList>(Arguments.GetString("holesByNumber"));

            View view = inflater.Inflate(Resource.Layout.HoleDetailsFragment_Layout2, container, false);

            Context context = Android.App.Application.Context;

            List <CourseTeeHole> chList = new List <CourseTeeHole>();
            var zzz = HoleManager.GetCourseHolesByHole(CourseID).CourseHoleDataLists.Where(x => x.HoleNumber == courseHoleByNumberList.HoleNumber).FirstOrDefault().CourseHoles;

            foreach (var courseHole in courseHoleByNumberList.CourseHoles)
            {
                chList.Add(courseHole);
            }

            _listView = view.FindViewById <ListView>(Resource.Id.HoleDetails_ListView);
            //_listView.Adapter = new HoleDetails_GridView_HoleInfo_Adapter(this, chList);
            _listView.Adapter = new HoleDetails_GridView_HoleInfo_Adapter(this, zzz);

            _listView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs e)
            {
                var   selected = courseHoleByNumberList.CourseHoles[e.Position];
                Toast toast    = Toast.MakeText(this.Context, "Item click " + selected.TeeName.ToString()
                                                + " hn " + selected.HoleNumber
                                                + " ctID " + selected.CourseTeeID, Android.Widget.ToastLength.Short);
                toast.Show();
            };

            _listView.ItemLongClick += delegate(object sender, AdapterView.ItemLongClickEventArgs e)
            {
                var selected = courseHoleByNumberList.CourseHoles[e.Position];     //list[e.Position];

                currentHoleNumber = courseHoleByNumberList.HoleNumber;
                FragmentTransaction ft = FragmentManager.BeginTransaction();
                //Remove fragment else it will crash as it is already added to backstack
                Fragment prev = FragmentManager.FindFragmentByTag("dialog");
                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);
                // Create and show the dialog.
                HoleDetails_DialogFragment newFragment = HoleDetails_DialogFragment.NewInstance(null, selected.CourseTeeID, currentHoleNumber, selected.ActualYardage, selected.Par);           //(null);
                newFragment.Dismissed += NewFragment_Dismissed;                                                                                                                                 //Add fragment
                newFragment.Show(ft, "dialog");
            };



            return(view);
        }
Пример #4
0
    private void Start()
    {
        network = NetworkManager.instance;

        if (!network)
        {
            return;
        }

        _myID = network.GetId();

        holeManager = GameObject.FindGameObjectWithTag("HoleManager")?.GetComponent <HoleManager>();
    }
Пример #5
0
 /// <summary>
 /// Sets up the mole for use, has to be called for the cycle of animations to start (pop up, go down, delay, etc).
 /// </summary>
 public void Setup(Mole i_mole, HoleManager i_holeManager)
 {
     moleParent = i_mole;
     SwitchVisible(false);
     holeManager = i_holeManager;
     currentHP   = hp;
     Renderer[] renderers = moleParent.GetComponentsInChildren <Renderer>();
     for (int i = 0; i < renderers.Length; i++)
     {
         mats.Add(renderers[i].material);
         startCol.Add(renderers[i].material.color);
     }
     currentAnimation = moleParent.StartCoroutine(DelayAndGoUp());
 }
Пример #6
0
    private void Start()
    {
        lightBeam   = gameObject.transform.parent.parent.GetChild(1).gameObject.GetComponent <Renderer>();
        flagPole    = gameObject.transform.parent.GetChild(1).gameObject;
        network     = NetworkManager.instance;
        nStoredData = NetworkStoredData.instance;

        holeManager = GameObject.FindGameObjectWithTag("HoleManager").GetComponent <HoleManager>();

        if (isActive)
        {
            ActivateHole();
        }
    }
Пример #7
0
    void Start()
    {
        //親ブジェクトのHoleManagerを取得
        manager = transform.parent.GetComponent <HoleManager>();

        //初期値
        invincible     = false;
        Infection      = false;
        MaxHp          = manager.MaxHP;
        hp             = MaxHp;
        decreaseHP     = manager.DecreaseHP;
        flashTime      = manager.FlashTime;
        invincibleTime = manager.InvincibleTime;
        nextColor      = manager.NextColor;
        defaultColor   = gameObject.GetComponent <Renderer>().material;
    }
Пример #8
0
        void Save()
        {
            int x = 0;

            if (Int32.TryParse(yardsEditText.Text, out x))
            {
                courseTee.CourseReportedYardage = x;
            }

            courseTee.TeeID = selectedTee.ID;

            int result     = CourseTeeManager.SaveCourseTee(courseTee);
            var courseTees = CourseTeeManager.GetCourseTees(course.ID);

            var singleCourseTee = courseTees.Where(xx => xx.CourseID == course.ID).Where(yy => yy.TeeID == courseTee.TeeID).FirstOrDefault();

            result = HoleManager.CreateCourseHolesForTee(singleCourseTee.ID, numberOfHoles);

            Finish();
        }
Пример #9
0
    // Start is called before the first frame update

    private void Awake()
    {
        HoleManagerSystem = this;
    }
Пример #10
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View view = inflater.Inflate(Resource.Layout.HoleDetails_DialogFragmentLayout, container, false);

            view.SetBackgroundColor(new Color(0x00, 0x65, 0x00));

            Button saveButton   = view.FindViewById <Button>(Resource.Id.HoleDetails_DialogFragment_Save_Button);
            Button cancelButton = view.FindViewById <Button>(Resource.Id.HoleDetails_DialogFragment_Cancel_Button);

            yardsEntered = view.FindViewById <EditText>(Resource.Id.HoleDetails_DialogFragment_Yards_EditText);
            TextView holeNumber = view.FindViewById <TextView>(Resource.Id.HoleDetails_DialogFragment_HoleNumber_TextView_Value);

            holeNumber.Text = HoleNumber.ToString();


            yardsEntered.KeyPress += (object sender, View.KeyEventArgs e) =>
            {
                e.Handled = false;
                if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
                {
                    //add your logic here
                    e.Handled = true;

                    int yards = 0;
                    Int32.TryParse(yardsEntered.Text, out yards);

                    HoleManager.UpdateCourseTeeHole(CourseTeeID, HoleNumber, yards);

                    if (null != Dismissed)
                    {
                        Dismissed(this, new DialogEventArgs {
                            Text = "Saved"
                        });
                    }

                    Dismiss();
                }
            };

            saveButton.Click += delegate {
                int yards = 0;
                Int32.TryParse(yardsEntered.Text, out yards);

                HoleManager.UpdateCourseTeeHole(CourseTeeID, HoleNumber, yards);

                //Toast.MakeText(Activity, "Hole info saved!" + " " + yards.ToString(), ToastLength.Long).Show();
                if (null != Dismissed)
                {
                    Dismissed(this, new DialogEventArgs {
                        Text = "Saved"
                    });
                }


                Dismiss();
            };

            cancelButton.Click += delegate {
                Dismiss();
            };


            return(view);
        }
Пример #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            int courseID = Intent.GetIntExtra("CourseID", 0);

            if (courseID > 0)
            {
                //courseName = Intent.GetStringExtra("CourseName") ?? "No data, why";
                course = CourseManager.GetCourse(courseID);
            }
            else
            {
            }

            // set our layout to be the home screen
            SetContentView(Resource.Layout.CourseDetailsView_Layout);



            // find all our controls
            courseNameValue     = FindViewById <TextView>(Resource.Id.CourseDetailsView_TextView_Name);
            courseParValue      = FindViewById <TextView>(Resource.Id.CourseDetailsView_TextView_Par);
            courseHolesValue    = FindViewById <TextView>(Resource.Id.CourseDetailsView_TextView_Holes);
            courseTees_ListView = FindViewById <ListView>(Resource.Id.CourseDetailsView_ListView_TeeSummary);
            addTeeButton        = FindViewById <Button>(Resource.Id.CourseDetailsView_Button_AddTee);
            linearLayout_CourseNameBasicInfo = FindViewById <LinearLayout>(Resource.Id.CourseDetailsView_LinearLayout_CourseNameBasicInfo);

            courseNameValue.Text  = course.CourseName;
            courseHolesValue.Text = course.Holes.ToString();
            courseParValue.Text   = course.Par.ToString();


            if (addTeeButton != null)
            {
                addTeeButton.Click += delegate {
                    var activity2 = new Intent(this, typeof(CourseTeeDetails_Code));
                    activity2.PutExtra("CourseName", courseNameValue.Text);
                    activity2.PutExtra("CourseID", course.ID);
                    StartActivity(activity2);
                };
            }


            Tasky.GlobalEntities.courseHoleByNumberListList    = HoleManager.GetCourseHolesByHole(course.ID);
            Tasky.GlobalEntities.courseHoleParByNumberListList = CourseHoleParManager.GetCourseHoleParsByHole(courseID);

            holesViewPager = FindViewById <ViewPager>(Resource.Id.CourseDetailsView_ViewPager_Holes);

            holesViewPager.AddOnPageChangeListener(this);

            pts            = FindViewById <PagerTitleStrip>(Resource.Id.CourseDetailsView_PagerTitleStrip);
            pts.LongClick += Pts_LongClick;



            //List<Tasky.CourseHoleByNumberList> chbnl = new List<Tasky.CourseHoleByNumberList>();
            chbnl = new List <Tasky.CourseHoleByNumberList>();

            foreach (Tasky.CourseHoleByNumberList chb in Tasky.GlobalEntities.courseHoleByNumberListList.CourseHoleDataLists)
            {
                chbnl.Add(chb);
            }

            //HoleDetailsAdapter hdAdapter = new HoleDetailsAdapter(SupportFragmentManager, chbnl, courseID);
            hdAdapter = new HoleDetailsAdapter(SupportFragmentManager, chbnl, courseID);
            holesViewPager.Adapter = hdAdapter;


            ImageView backgroundImage = (ImageView)FindViewById <ImageView>(Resource.Id.CourseDetailsView_BackgroundImage);

            backgroundImage.SetBackgroundResource(Resource.Drawable.Screenshot_20170225_142830);

            courseTees_ListView.SetBackgroundColor(new Color(0x00, 0x65, 0x00));
            addTeeButton.SetBackgroundColor(new Color(0x00, 0x65, 0x00));
            linearLayout_CourseNameBasicInfo.SetBackgroundColor(new Color(0x00, 0x65, 0x00));
        }
Пример #12
0
 private void Start()
 {
     // on start, set the hole to the hole and hole manager to its hole manager component
     hole = GameObject.FindGameObjectWithTag("Hole");
     hm   = hole.GetComponent <HoleManager>();
 }
Пример #13
0
 void Start()
 {
     CatapultModel.GetComponent <Animator>().enabled = false;
     manager = GetComponent <HoleManager>();  // set manager to HoleManager component
 }
Пример #14
0
 public void StartMoleCycle(HoleManager holeManager)
 {
     behaviour.Setup(this, holeManager);
     LevelManager.LevelEndsEvent += OnEndLevel;
 }