Exemple #1
0
        //Result
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            try
            {
                base.OnActivityResult(requestCode, resultCode, data);
                if (requestCode == 2500)
                {
                    HybridController.EvaluateJavascript("Wo_GetNewPosts();");
                }
                else if (requestCode == 3500)
                {
                    string ID   = data.GetStringExtra("PostId");
                    string Text = data.GetStringExtra("PostText");

                    string JavaCode = "$('#post-' + " + ID + ").find('#edit-post').attr('onclick', '{*type*:*edit_post*,*post_id*:*" + ID + "*,*edit_text*:*" + Text + "*}');";
                    string Decode   = JavaCode.Replace("*", """);

                    HybridController.EvaluateJavascript(Decode);
                    HybridController.EvaluateJavascript("$('#post-' + " + ID + ").find('.post-description p').html('" + Text + "');");
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Exemple #2
0
    void Start()
    {
        if (userStudy)
        {
            currentSystem = PlayerPrefs.GetInt("ChosenSystem");
            //targetGroup = PlayerPrefs.GetInt("TargetGroup");
            listsNumber = PlayerPrefs.GetInt("TargetGroup");
        }
        else
        {
            currentSystem = -1;
        }
        //Debug.Log("System "+currentSystem);
        //Debug.Log("TargetList "+listsNumber);


        userstudyUI = (UserStudyUI)gameObject.GetComponent <UserStudyUI>();
        dDAS        = (DDAS)gameObject.GetComponent <DDAS>();

        if (currentSystem == 0)
        {
            SlidARPP.SetActive(true);
            slidARScript = (SlidARPPController)SlidARPP.GetComponent(typeof(SlidARPPController));
            slidARScript.AnnotationIsBeingSelected += EnableEditModeTimer;
            slidARScript.InteractInAuthoringMode   += EnableAuthoringModeTimer;
            slidARScript.SendSelectedAnnotation    += SetCurrentSelectedObject;
        }
        else if (currentSystem == 1)
        {
            Hybrid.SetActive(true);
            hybridScript = (HybridController)Hybrid.GetComponent(typeof(HybridController));
            hybridScript.AnnotationIsBeingSelected += EnableEditModeTimer;
            hybridScript.InteractInAuthoringMode   += EnableAuthoringModeTimer;
            hybridScript.SendSelectedAnnotation    += SetCurrentSelectedObject;
        }
        else
        {
            slidARScript = (SlidARPPController)SlidARPP.GetComponent(typeof(SlidARPPController));
            slidARScript.AnnotationIsBeingSelected += EnableEditModeTimer;
            slidARScript.InteractInAuthoringMode   += EnableAuthoringModeTimer;
            slidARScript.SendSelectedAnnotation    += SetCurrentSelectedObject;

            hybridScript = (HybridController)Hybrid.GetComponent(typeof(HybridController));
            hybridScript.AnnotationIsBeingSelected += EnableEditModeTimer;
            hybridScript.InteractInAuthoringMode   += EnableAuthoringModeTimer;
            hybridScript.SendSelectedAnnotation    += SetCurrentSelectedObject;
        }
        //timer = 0f;
        //TargetWithEvents.OnTargetAlignedWithAnnotation += TargetObjectIsAlignedWithAnnotation;
        //count = 0;

        //targetListsNumber[listsNumber].SetActive(true);
        //dDAS.SetupData(maxNumberOfTarget);
        //StartUserStudy(0);
    }
Exemple #3
0
 private void TimerOnElapsed(object sender, ElapsedEventArgs e)
 {
     try
     {
         HybridController.EvaluateJavascript("Wo_GetNewPosts();");
     }
     catch (Exception exception)
     {
         Crashes.TrackError(exception);
     }
 }
Exemple #4
0
        public MechJebModuleAttitudeController(MechJebCore core)
            : base(core)
        {
            priority = 800;

            controllers.Add(new MJAttitudeController(this));
            controllers.Add(new KosAttitudeController(this));
            controllers.Add(new HybridController(this));


            Controller = new HybridController(this);
        }
Exemple #5
0
    public void Reset()
    {
        // clear list
        sheepList.Clear();

        // get circle radius from N of sheep
        float radius = Mathf.Sqrt(GM.nOfSheep);
        float mid    = GM.fieldSize / 2;

        // spawn
        Vector3    position;
        Vector2    randCirc;
        GameObject newSheep;

        int i = 0;

        while (i < GM.nOfSheep)
        {
            // random position
            randCirc = Random.insideUnitCircle * radius;
            position = new Vector3(mid + randCirc.x, .0f, mid + randCirc.y);

            // instantiate
            newSheep = (GameObject)Instantiate(GM.sheepPrefab, position, Quaternion.identity);

            // find controller, add to list and enable
            HybridController HC = newSheep.GetComponent <HybridController>();

            // set initial state to running
            HC.sheepState = Enums.SheepState.Idle;
            sheepList.Add(HC);
            HC.enabled = true;

            // allocate sheep to cell
            AddSheepToField(HC);

            // link sheep with this HybridManager
            HC.HM = this;

            // set id and add to list
            HC.id = i;
            i++;
            GM.sheepList.Add(newSheep);
        }

        // update flows
        UpdateFlows();
    }
Exemple #6
0
        //Event Refresh Data Page
        private void SwipeRefreshLayoutOnRefresh(object sender, EventArgs e)
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    if (Settings.Show_Story)
                    {
                        StoryAdapter.Clear();
                        Stories_Layout.Visibility = ViewStates.Visible;
                        GetStory_Api();
                    }
                    else
                    {
                        Stories_Layout.Visibility = ViewStates.Gone;
                        Get_Notifications();
                    }

                    switch (Settings.Lang)
                    {
                    case "en":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=english" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ar":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=arabic" + "&type=set_c&c=" + UserDetails.Cookie);
                        Settings.FlowDirection_RightToLeft = true;
                        break;

                    case "de":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=german" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "el":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=greek" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "es":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=spanish" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "fr":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=french" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "it":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=italian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ja":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=japanese" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "nl":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=dutch" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "pt":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=portuguese" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ro":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=romanian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ru":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=russian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "sq":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=albanian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "sr":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=serbian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "tr":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=turkish" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    default:
                        HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Cookie + UserDetails.Cookie);
                        break;
                    }
                }
                else
                {
                    Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
        private void Get_Data_Event()
        {
            try
            {
                _Event_Data = JsonConvert.DeserializeObject <Get_Events_Object.Event>(Intent.GetStringExtra("EventView"));
                if (_Event_Data != null)
                {
                    var CoverSplit     = _Event_Data.cover.Split('/').Last();
                    var getImage_Cover =
                        IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskEvent, CoverSplit);
                    if (getImage_Cover != "File Dont Exists")
                    {
                        ImageServiceLoader.Load_Image(ImageEventCover, "ImagePlacholder.jpg", getImage_Cover);
                    }
                    else
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskEvent,
                                                                      _Event_Data.cover);
                        ImageServiceLoader.Load_Image(ImageEventCover, "ImagePlacholder.jpg", _Event_Data.cover);
                    }

                    Txt_Name.Text = _Event_Data.name;

                    Txt_Going.Text      = _Event_Data.going_count + " " + GetText(Resource.String.Lbl_GoingPeople);
                    Txt_Interested.Text = _Event_Data.interested_count + " " +
                                          GetText(Resource.String.Lbl_InterestedPeople);
                    Txt_Location.Text = _Event_Data.location;

                    Txt_StartDate.Text = _Event_Data.start_date;
                    Txt_EndDate.Text   = _Event_Data.end_date;

                    var Description =
                        IMethods.Fun_String.DecodeString(
                            IMethods.Fun_String.DecodeStringWithEnter(_Event_Data.description));

                    var readMoreOption = new ReadMoreOption.Builder(this)
                                         .TextLength(250)
                                         .MoreLabel(GetText(Resource.String.Lbl_ReadMore))
                                         .LessLabel(GetText(Resource.String.Lbl_ReadLess))
                                         .MoreLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LessLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LabelUnderLine(true)
                                         .Build();
                    readMoreOption.AddReadMoreTo(Txt_Description, Description);

                    if (_Event_Data.is_going)
                    {
                        Btn_Go.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        Btn_Go.SetTextColor(Color.ParseColor("#ffffff"));
                        Btn_Go.Text = GetText(Resource.String.Lbl_Going);
                        Btn_Go.Tag  = "true";
                    }
                    else
                    {
                        Btn_Go.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        Btn_Go.SetTextColor(Color.ParseColor(Settings.MainColor));
                        Btn_Go.Text = GetText(Resource.String.Lbl_Go);
                        Btn_Go.Tag  = "false";
                    }

                    if (_Event_Data.is_interested)
                    {
                        Btn_Intersted.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        Btn_Intersted.SetTextColor(Color.ParseColor("#ffffff"));
                        Btn_Intersted.Text = GetText(Resource.String.Lbl_Interested);
                        Btn_Intersted.Tag  = "true";
                    }
                    else
                    {
                        Btn_Intersted.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        Btn_Intersted.SetTextColor(Color.ParseColor(Settings.MainColor));
                        Btn_Intersted.Text = GetText(Resource.String.Lbl_Interested);
                        Btn_Intersted.Tag  = "false";
                    }

                    //Set WebView and Load url to be rendered on WebView
                    if (!IMethods.CheckConnectivity())
                    {
                        HybirdView.Visibility = ViewStates.Gone;
                        News_Empty.Visibility = ViewStates.Visible;

                        Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News);
                        Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection);
                    }
                    else
                    {
                        HybirdView.Visibility = ViewStates.Visible;
                        News_Empty.Visibility = ViewStates.Gone;

                        if (Settings.ClearCachSystem)
                        {
                            HybridController.HybirdView.ClearCache(true);
                        }

                        if (Settings.FlowDirection_RightToLeft)
                        {
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Event + _Event_Data.id +
                                                     "&lang=arabic");
                        }
                        else
                        {
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Event + _Event_Data.id);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Exemple #8
0
    void AddSheepToField(HybridController HC)
    {
        // add sheep to field
        float hc_x = HC.transform.position.x / binSize;
        float hc_z = HC.transform.position.z / binSize;

        // coordinates
        int x   = Mathf.FloorToInt(hc_x);
        int z   = Mathf.FloorToInt(hc_z);
        int x_0 = x;
        int z_0 = z;

        // add
        HC.currentCell = forceField[x, z];
        forceField[x, z].hcList.Add(HC);
        forceField[x, z].m_sheep++;

        // state count
        if (HC.sheepState == Enums.SheepState.Running && HC.previousSheepState != Enums.SheepState.Running)
        {
            m_torunning++;
        }
        else if (HC.sheepState == Enums.SheepState.Idle && HC.previousSheepState == Enums.SheepState.Running)
        {
            m_toidle++;
        }

        // add also to neighbour fields?
        hc_x = HC.transform.position.x - (x * binSize);
        hc_z = HC.transform.position.z - (z * binSize);

        // TL
        if (hc_x < GM.r_o && x > 0 && hc_z < GM.r_o && z > 0)
        {
            x = x - 1; z = z - 1;
        }
        // BL
        else if (hc_x < GM.r_o && x > 0 && hc_z > (binSize - GM.r_o) && z < (GM.flowPrecision - 1))
        {
            x = x - 1; z = z + 1;
        }
        // TR
        else if (hc_x > (binSize - GM.r_o) && x < (GM.flowPrecision - 1) && hc_z < GM.r_o && z > 0)
        {
            x = x + 1; z = z - 1;
        }
        // BR
        else if (hc_x > (binSize - GM.r_o) && x < (GM.flowPrecision - 1) && hc_z > (binSize - GM.r_o) && z < (GM.flowPrecision - 1))
        {
            x = x + 1; z = z + 1;
        }

        // left and right edge
        if (hc_x < GM.r_o && x > 0)
        {
            x = x - 1;
        }
        else if (hc_x > (binSize - GM.r_o) && x < (GM.flowPrecision - 1))
        {
            x = x + 1;
        }

        // top and bottom edge
        if (hc_z < GM.r_o && z > 0)
        {
            z = z - 1;
        }
        else if (hc_z > (binSize - GM.r_o) && z < (GM.flowPrecision - 1))
        {
            z = z + 1;
        }

        if (x != x_0 || z != z_0)
        {
            forceField[x, z].hcList.Add(HC);
        }
    }