Inheritance: MonoBehaviour
Example #1
0
 public void SetValidityPeriod(VP value)
 {
     if (value != VP.Other)
     {
         _vp = (int)value;
     }
 }
Example #2
0
 protected override void OgreControlDisposed()
 {
     if (!DesignMode)
     {
         if (!SplashLoadingWindow)
         {
             if (Ship != null)
             {
                 Ship.DestroyShip();
             }
             if (VP != null)
             {
                 VP.Destroy();
                 VP.Dispose();
                 VP = null;
             }
             if (World != null)
             {
                 World.Destroy();
                 World.Dispose();
                 World = null;
             }
         }
     }
 }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stream"></param>
        private void LoadMetaData(Stream stream)
        {
            stream.Position = 0;
            using (var reader = new StreamReader(stream, Encoding.UTF8))
            {
                string line;
                bool   foundheader = false;
                while ((line = reader.ReadLine()) != null)
                {
                    List <String> items = new List <String>(line.Trim().Split(new string[] { " ", "\t", "," }, StringSplitOptions.RemoveEmptyEntries));
                    if (items[0] != "//")
                    {
                        if (foundheader == false)
                        {
                            //Parse the header

                            float lat;
                            float lon;
                            if (float.TryParse(items[0], out lat))
                            {
                                Latitude = lat;
                            }
                            if (float.TryParse(items[1], out lon))
                            {
                                Longitude = lon;
                            }

                            items.RemoveRange(0, 2);
                            Comments = String.Join(" ", items.ToArray());

                            foundheader = true;
                        }
                        else
                        {
                            if (items.Count() == 8)
                            {
                                var date = DateUtilities.TryParseDate(items[0]);
                                if (date != null)
                                {
                                    if (StartDate == null)
                                    {
                                        StartDate = date;
                                    }
                                    //Parse the met data
                                    EndDate = date;

                                    MaxT.Add(double.Parse(items[2]));
                                    MinT.Add(double.Parse(items[3]));
                                    Rain.Add(double.Parse(items[4]));
                                    PanEvap.Add(double.Parse(items[5]));
                                    Radiation.Add(double.Parse(items[6]));
                                    VP.Add(double.Parse(items[7]));
                                }
                            }
                        }
                    }
                }
            }
        }
Example #4
0
 public bool Equals(ItemRectangle other)
 {
     if (other == null)
     {
         return(false);
     }
     return(VP.Equals(other.VP));
 }
Example #5
0
        public void TestColor()
        {
            Action      action = VP.Create().Sign(color: Color.Red);
            SignCommand sign   = action.Create.GetCommandOfType <SignCommand>();

            Assert.IsNotNull(sign);
            Assert.IsTrue(sign.ForeColor.Equals(System.Drawing.Color.Red));
        }
 protected override void SpawnEntities()
 {
     PUActor     = World.CreateActor("PUActor");
     PUComponent = PUActor.CreatePUSystemComponent("PUSystem", PUSystemName, true);
     PUComponent.PlaySystem();
     distance     = 50;
     zoomdistance = 5;
     VP.SetCameraYawPitchDistance(yaw, pitch, distance);
 }
Example #7
0
 protected override void SpawnEntities()
 {
     Ship = new OgreShip(_DataFile, World);
     Ship.IsShipDataPreviewShip = true;
     distance     = Ship.GetBoundingRadius() * 1.25f;
     zoomdistance = distance * 0.1f;
     VP.SetCameraYawPitchDistance(yaw, pitch, distance);
     Ship.OnShipMainMeshChanged += Ship_OnShipMainMeshChanged;
 }
 protected override void ResetCamera()
 {
     if (PUActor != null)
     {
         distance     = 50;
         zoomdistance = 5;
         yaw          = 0;
         pitch        = 0;
         VP.SetCameraYawPitchDistance(yaw, pitch, distance);
     }
 }
Example #9
0
 public int CompareTo(ItemRectangle comparePart)
 {
     // A null value means that this object is greater.
     if (comparePart == null)
     {
         return(1);
     }
     else
     {
         return(VP.CompareTo(comparePart.VP));
     }
 }
        public static void RunExample()
        {
            SequenceBuilder builder = new SequenceBuilder("textureChanger");

            builder.Append(VP.Adone().Texture("stone1.jpg", targetName: "myPp01"), TimeSpan.FromSeconds(1));
            builder.Append(VP.Adone().Texture("stone2.jpg", targetName: "myPp01"), TimeSpan.FromSeconds(1));
            builder.Append(VP.Adone().Texture("stone3.jpg", targetName: "myPp01"), TimeSpan.FromSeconds(1));

            foreach (Action action in builder.Build().ToActions())
            {
                Console.WriteLine(action);
            }
        }
        public static void RunExample()
        {
            // build an action using a fluent API
            Action action = VP.Create()
                            .Texture("stone1.jpg")
                            .Bump()
                            .Texture("stone2.jpg", global: true)
                            .Activate()
                            .Texture("stone3.jpg", global: true);

            // output the action as a string
            Console.WriteLine(action);
        }
Example #12
0
 protected override void ResetCamera()
 {
     if (Ship != null)
     {
         if (Ship.ShipActor != null)
         {
             distance     = Ship.ShipActor.GetBoundingRadius() * 1.25f;
             zoomdistance = distance * 0.1f;
             yaw          = 0;
             pitch        = 0;
             VP.SetCameraYawPitchDistance(yaw, pitch, distance);
         }
     }
 }
        static void Main(string[] args)
        {
            decimal MDC, MDV, VP;
            decimal d1 = 0.12m, d2 = 0.15m, d3 = 0.20m;

            Console.WriteLine("Ingrese el monto de la compra");
            Console.Write("$");
            MDC = Convert.ToDecimal(Console.ReadLine());

            if (MDC > 0 && MDC <= 100)
            {
                Console.WriteLine("No aplica a desuento");
                Console.WriteLine("El total a pagar por su compra es: {0}", MDC.ToString("C2"));
            }
            else
            {
                if (MDC <= 100.01m && MDC <= 200)
                {
                    Console.WriteLine("Se le aplicara un descuento de 12%");
                    MDV = MDC * d1;
                    VP  = MDC - MDV;
                    Console.WriteLine("El descuento a aplicar a su compra es: {0}", MDV.ToString("C2"));
                    Console.WriteLine("EL total a cancelar es: {0}", VP.ToString("C2"));
                }
                else
                {
                    if (MDC <= 200.01m && MDC <= 500)
                    {
                        Console.WriteLine("Se le aplicara un descuento de 15%");
                        MDV = MDC * d2;
                        VP  = MDC - MDV;
                        Console.WriteLine("El descuento a aplicar a su compra es: {0}", MDV.ToString("C2"));
                        Console.WriteLine("EL total a cancelar es: {0}", VP.ToString("C2"));
                    }
                    else
                    {
                        if (MDC > 500.01m)
                        {
                            Console.WriteLine("Se le aplicara un descuento de 20%");
                            MDV = MDC * d3;
                            VP  = MDC - MDV;
                            Console.WriteLine("El descuento a aplicar a su compra es: {0}", MDV.ToString("C2"));
                            Console.WriteLine("EL total a cancelar es: {0}", VP.ToString("C2"));
                        }
                    }
                }
            }
            Console.ReadKey();
        }
Example #14
0
        public void Run()
        {
            var bryan   = new Director();
            var crystal = new VP();
            var jeff    = new CEO();

            bryan.setSuccessor(crystal);
            crystal.setSuccessor(jeff);

            var request = new Request(RequestType.CONFERENCE, 500);

            bryan.handleRequest(request);

            request = new Request(RequestType.PURCHASE, 1000);
            crystal.handleRequest(request);

            request = new Request(RequestType.PURCHASE, 2000);
            bryan.handleRequest(request);
        }
Example #15
0
        static void Main(string[] args)
        {
            float HE, HS, HT, VP, DEMAIS;

            Console.Write("Insira a hora de entrada:");
            HE = float.Parse(Console.ReadLine());
            Console.Write("Insira a hora de saida:");
            HS = float.Parse(Console.ReadLine());

            HT = HS - HE;

            if (HT > 2)
            {
                VP     = (5 * HT);
                DEMAIS = (VP + 8);

                Console.WriteLine("Pemanencia de ");
                Console.WriteLine(HT.ToString("horas"));
                Console.WriteLine("O valor a ser pago sera R$:");
                Console.WriteLine(DEMAIS.ToString());
                Console.ReadLine();
            }

            else if (HT == 2)
            {
                VP = 9;
                Console.WriteLine("Pemanencia de" + HT + "horas");
                Console.Write(VP.ToString("O valor a ser pago sera R$:"));
                Console.WriteLine(VP.ToString());
                Console.ReadLine();
            }

            else
            {
                VP = 8;
                Console.WriteLine("Pemanencia de" + HT + "hora");
                Console.Write("O valor a ser pago sera R$:");
                Console.WriteLine(VP.ToString());
                Console.ReadLine();
            }
        }
Example #16
0
 private void Ship_OnShipMainMeshChanged(object sender, EventArgs e)
 {
     distance     = Ship.GetBoundingRadius() * 1.25f;
     zoomdistance = distance * 0.1f;
     VP.SetCameraYawPitchDistance(yaw, pitch, distance);
 }
Example #17
0
    // Start is called before the first frame update
    IEnumerator LoadAll()
    {
        string[] charDirs;
        string   modsDir;

        //Identify mods and character directories
        if (Application.platform != RuntimePlatform.Android)
        {
            modsDir  = Application.dataPath + "/../mods/";
            charDirs = Directory.GetDirectories(modsDir, "CHAR_*");
            if (!Directory.Exists(modsDir + "/../logs"))
            {
                Directory.CreateDirectory(modsDir + "/../logs");
            }
            logFile = modsDir + "../logs/" + DateTime.Now.ToString("ddMMyy_HHmmss") + ".txt";
        }
        else
        {
            if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageWrite) && !Permission.HasUserAuthorizedPermission(Permission.ExternalStorageRead))
            {
                // Ask for permission or proceed without the functionality enabled.
                Permission.RequestUserPermission(Permission.ExternalStorageRead);
                Permission.RequestUserPermission(Permission.ExternalStorageWrite);
            }

            if (!Directory.Exists(GetAndroidInternalFilesDir() + "/.4PUnity"))
            {
                Directory.CreateDirectory(GetAndroidInternalFilesDir() + "/.4PUnity");
                File.Create(GetAndroidInternalFilesDir() + "/.4PUnity/.nomedia");
            }
            if (!Directory.Exists(GetAndroidInternalFilesDir() + "/.4PUnity/music"))
            {
                Directory.CreateDirectory(GetAndroidInternalFilesDir() + "/.4PUnity/music");
            }
            if (!Directory.Exists(GetAndroidInternalFilesDir() + "/.4PUnity/logs"))
            {
                Directory.CreateDirectory(GetAndroidInternalFilesDir() + "/.4PUnity/logs");
            }
            modsDir  = GetAndroidInternalFilesDir() + "/.4PUnity/";
            charDirs = Directory.GetDirectories(modsDir, "CHAR_*");
            logFile  = modsDir + "logs/" + DateTime.Now.ToString("ddMMyy_HHmmss") + ".txt";
        }

        //Load music
        List <string> musicFiles = new List <string>(Directory.GetFiles(modsDir + "music", "*.ogg"));

        musicFiles.AddRange(Directory.GetFiles(modsDir + "music", "*.mp3"));

        Dropdown      mdd     = GameObject.Find("MusicDropdown").GetComponent <Dropdown>();
        List <string> options = new List <string>();

        foreach (string track in musicFiles)
        {
            string          track2 = track.Replace('\\', '/');
            UnityWebRequest rq     = UnityWebRequestMultimedia.GetAudioClip("file://" + track2, AudioType.OGGVORBIS);
            rq.SendWebRequest();
            while (rq.downloadProgress < 1)
            {
                ;
            }
            yield return(rq);

            string trackName = track2.Substring(track2.LastIndexOf("/") + 1);
            trackName = trackName.Substring(0, trackName.Length - 4);
            music.Add(((DownloadHandlerAudioClip)rq.downloadHandler).audioClip);
            options.Add(trackName);
        }
        mdd.ClearOptions();
        mdd.AddOptions(options);
        mdd.onValueChanged.AddListener((int a) => { GameObject.Find("EventSystem").GetComponent <UI>().MusicChange(a); });

        GameObject cam = GameObject.Find("MainCam");

        cam.GetComponent <AudioSource>().clip = music[0];
        cam.GetComponent <AudioSource>().loop = true;

        GameObject canvas = GameObject.Find("CharContent");

        DefaultControls.Resources uiResources = new DefaultControls.Resources();
        var i = 0;

        VP vpClass = GameObject.Find("EventSystem").GetComponent <VP>();

        foreach (string ch in charDirs)
        {
            string     charName   = ch.Replace('\\', '/').Substring(ch.LastIndexOf('_') + 1);
            GameObject charButton = DefaultControls.CreateButton(uiResources);
            charButton.name = charName;
            charButton.transform.SetParent(canvas.transform);
            canvas.GetComponent <RectTransform>().offsetMin            = new Vector2(canvas.GetComponent <RectTransform>().offsetMin.x, canvas.GetComponent <RectTransform>().offsetMin.y + 200);
            charButton.GetComponent <RectTransform>().anchorMax        = new Vector2(0.5f, 0);
            charButton.GetComponent <RectTransform>().anchorMin        = new Vector2(0.5f, 0);
            charButton.GetComponent <RectTransform>().anchoredPosition = new Vector3(0, -100 - i * 200, 0);
            charButton.GetComponent <RectTransform>().sizeDelta        = new Vector2(200, 200);
            Destroy(charButton.transform.GetChild(0).gameObject);
            Debug.Log(Directory.GetFiles(ch, charName + ".png")[0]);
            charButton.GetComponent <Image>().sprite = LoadNewSprite(Directory.GetFiles(ch, charName + ".png")[0]);
            charButton.GetComponent <Button>().onClick.AddListener(() => { vpClass.PoseSwitch(charName, vpClass.curAnim); });
            charButton.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
            i++;
            List <string> files = new List <string>(Directory.GetFiles(ch, "*.mp4"));
            files.Sort();
            charMods.Add(charName, files);
        }

        GameObject camera = GameObject.Find("MainCam");

        bool firstVp = true;

        foreach (KeyValuePair <string, List <string> > charAnims in ModLoader.charMods)
        {
            List <VideoPlayer> players = new List <VideoPlayer>();
            foreach (string file in charAnims.Value)
            {
                //VideoPlayer vp = camera.AddComponent<VideoPlayer>();
                //vp.waitForFirstFrame = true;
                //vp.isLooping = true;
                //vp.aspectRatio = VideoAspectRatio.FitVertically;
                //vp.loopPointReached += vpClass.Looped;
                //vp.prepareCompleted += vpClass.Prepared;
                //vp.audioOutputMode = VideoAudioOutputMode.Direct;
                //vp.SetDirectAudioVolume(0, 1);
                //vp.url = file;
                //vp.Prepare();
                //while (!vp.isPrepared) yield return null;
                //loadedMods++;
                //currentLoaded -= fraction;
                //loadingBar.offsetMax = new Vector2(-currentLoaded, 10f);
                //loadingText.text = loadedMods + "/" + totalMods;
                //players.Add(vp);
                if (firstVp)
                {
                    firstVp         = false;
                    vpClass.curChar = charAnims.Key;
                    vpClass.curAnim = 0;
                }
            }
            VP.vps.Add(charAnims.Key, players);
            VP.charList.Add(charAnims.Key);
            Debug.Log(VP.vps);
        }

        Application.logMessageReceived += LogHandler;
        loaded = true;
    }
Example #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="entityName"></param>
        /// <param name="dataMsg"></param>
        /// <returns></returns>
        public Message SaveLookup(WebOperationContext ctx, string entityName, Message dataMsg)
        {
            Message responseMsg = null;
            string  jsonData    = JSON.GetPayload(dataMsg);

            try
            {
                switch (entityName)
                {
                case "EntityLinks":
                    EntityLinks entityLinks = this.SaveLookup <EntityLinks>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <EntityLinks>(ctx, entityLinks, this.timer);
                    break;

                case "EventLogging":
                    EventLogger eventLogger = this.SaveLookup <EventLogger>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <EventLogger>(ctx, eventLogger, this.timer);
                    break;

                case "KPAdmins":
                    Admin kpAdmin = this.SaveLookup <Admin>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <Admin>(ctx, kpAdmin, this.timer);
                    break;

                case "KPCategoryL1":
                    CategoryL1 kpCatL1 = this.SaveLookup <CategoryL1>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <CategoryL1>(ctx, kpCatL1, this.timer);
                    break;

                case "KPCategoryL2":
                    CategoryL2 kpCatL2 = this.SaveLookup <CategoryL2>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <CategoryL2>(ctx, kpCatL2, this.timer);
                    break;

                case "KPConfigList":
                    ConfigList kpConfigList = this.SaveLookup <ConfigList>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <ConfigList>(ctx, kpConfigList, this.timer);
                    break;

                //case "KPCountry":
                //    Country kpCountry = this.SaveLookup<Country>(entityName, jsonData);
                //    responseMsg = ctx.CreateJsonResponse<Country>(kpCountry);
                //    break;
                case "KPCustomers":
                    Customer kpCustomers = this.SaveLookup <Customer>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <Customer>(ctx, kpCustomers, this.timer);
                    break;

                //case "KPEffortInstances":
                //    EffortInstance kpEffortInstances = this.SaveLookup<EffortInstance>(entityName, jsonData);
                //    responseMsg = ctx.CreateJsonResponse<EffortInstance>(kpEffortInstances);
                //    break;
                //case "KPEfforts":
                //    Effort kpEfforts = this.SaveLookup<Effort>(entityName, jsonData);
                //    responseMsg = ctx.CreateJsonResponse<Effort>(kpEfforts);
                //    break;
                case "KPGoalSetLocks":
                    GoalSetLock kpGoalSetLock = this.SaveLookup <GoalSetLock>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <GoalSetLock>(ctx, kpGoalSetLock, this.timer);
                    break;

                case "KPGoalSets":
                    GoalSet kpGoalSet = this.SaveLookup <GoalSet>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <GoalSet>(ctx, kpGoalSet, this.timer);
                    break;

                //case "KPPerspectives":
                //    Perspective kpPerspective = this.SaveLookup<Perspective>(entityName, jsonData);
                //    responseMsg = ctx.CreateJsonResponse<Perspective>(kpPerspective);
                //    break;
                case "KPPerspectiveInstances":
                    PerspectiveInstance kpPerspectiveInstance = this.SaveLookup <PerspectiveInstance>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <PerspectiveInstance>(ctx, kpPerspectiveInstance, this.timer);
                    break;

                case "KingpinLockdown":
                    KingpinLockdown lockdown = this.SaveLookup <KingpinLockdown>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <KingpinLockdown>(ctx, lockdown, this.timer);
                    break;

                case "Announcements":
                    Announcement announcement = this.SaveLookup <Announcement>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <Announcement>(ctx, announcement, this.timer);
                    break;

                case "KPTeams":
                    Team kpTeam = this.SaveLookup <Team>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <Team>(ctx, kpTeam, this.timer);
                    break;

                case "KPVPs":
                    VP kpVP = this.SaveLookup <VP>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <VP>(ctx, kpVP, this.timer);
                    break;

                case "OneOffConfigurations":
                    OneOffConfiguration oneOffConfiguration = this.SaveLookup <OneOffConfiguration>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <OneOffConfiguration>(ctx, oneOffConfiguration, this.timer);
                    break;

                case "UserEventLogging":
                    UserLogging userEvent = this.SaveLookup <UserLogging>(entityName, jsonData);
                    responseMsg = HttpUtilities.GenerateResponse <UserLogging>(ctx, userEvent, this.timer);
                    break;

                default:
                    string errMsg = string.Format("Error: No lookup list found with the name: {0}", entityName);
                    responseMsg = HttpUtilities.GenerateExceptionResponse(ctx, new Exception(errMsg), "POST/PUT", HttpStatusCode.BadRequest);
                    break;
                }
            }
            catch (Exception ex)
            {
                responseMsg = HttpUtilities.GenerateExceptionResponse(ctx, ex, "POST/PUT", HttpStatusCode.InternalServerError);
            }

            this.timer.Stop();
            return(responseMsg);
        }
Example #19
0
        /// <summary>
        /// Gets the lookup value for an item field
        /// TODO: Create an IRespository
        /// </summary>
        /// <param name="fieldName"></param>
        /// <param name="fieldValue"></param>
        /// <returns></returns>
        public string GetLookupValue(string fieldName, string fieldValue, string lookupField)
        {
            string value = string.Empty;

            switch (fieldName)
            {
            case "KPTeam":
                Team team = this.spDataAccess.Teams.Find(i => i.Nick == fieldValue || i.Title == fieldValue);
                value = (team != null) ? team.KPID.ToString() : string.Empty;
                break;

            case "GoalSet":
                GoalSet goalSet = this.GoalSetRepository.Items.Find(i => i.Title == fieldValue);
                value = (goalSet != null) ? goalSet.KPID.ToString() : string.Empty;
                break;

            case "KPPrimaryVP":
                VP vp = this.VPRepository.Items.Find(i => i.Nick == fieldValue);
                value = (vp != null) ? vp.KPID.ToString() : string.Empty;
                break;

            case "KPSecondaryVPs":
                // handle multiple
                string[]      values;
                List <string> newValues = new List <string>();
                if (fieldValue.Contains(","))
                {
                    values = fieldValue.Split(',');
                    foreach (string val in values)
                    {
                        VP svp = this.VPRepository.Items.Find(i => i.Nick == val);
                        value = (svp != null) ? svp.KPID.ToString() : string.Empty;
                        // leave loop since we have a value mismatch
                        if (string.IsNullOrEmpty(value))
                        {
                            break;
                        }
                        // otherwise we'll continue adding values
                        newValues.Add(value);
                        value = string.Join(",", newValues.ToArray());
                    }
                }
                else
                {
                    VP svp = this.VPRepository.Items.Find(i => i.Nick == fieldValue);
                    value = (svp != null) ? svp.KPID.ToString() : string.Empty;
                }
                break;

            case "CategoryL1":
                CategoryL1 catL1 = this.CategoryL1Repository.Items.Find(i => i.Title == fieldValue);
                value = (catL1 != null) ? catL1.KPID.ToString() : string.Empty;
                break;

            case "CategoryL2":
                CategoryL2 catL2 = this.CategoryL2Repository.Items.Find(i => i.Title == fieldValue);
                value = (catL2 != null) ? catL2.KPID.ToString() : string.Empty;
                break;
            }

            return(value);
        }