Example #1
0
 public PermissionItem(Guid permissionItemGuid, int permissionItemValue, Guid createUserGuid, UserTypes createUserType, Logics isFreeAwayCreator)
 {
     this.permissionKey = GuidHelper.NewGuid();
     this.permissionItemGuid = permissionItemGuid;
     this.permissionItemValue = permissionItemValue;
     this.createUserGuid = createUserGuid;
     this.createUserType = createUserType;
     this.isFreeAwayCreator = isFreeAwayCreator;
 }
Example #2
0
 public static String getLogicString(Logics logic)
 {
     switch (logic)
     {
         case Logics.AND:
             return "AND";
         case Logics.OR:
             return "OR";
     }
     return null;
 }
Example #3
0
        public ActionResult Profile(string username, int page = 1)
        {
            ApplicationUser user;

            if (UserManager.IsUserNameExistWithValidation(username, out user))
            {
                var algorithms = new Logics();
                ViewBag.Title    = username + "'s apps collection";
                ViewBag.Meta     = "Mobile apps, apps review, apple apps, android apps, " + ViewBag.Title;
                ViewBag.Keywords = ViewBag.Meta;

                if (user != null)
                {
                    var apps = algorithms.GetViewableApps(db)
                               .Where(n => n.PostedByUserID == user.UserID)
                               .Include(n => n.User)
                               .OrderByDescending(n => n.AppID);

                    var pageInfo = new PaginationInfo {
                        ItemsInPage = AppConfig.Setting.PageItems,
                        PageNumber  = page,
                        PagesExists = -1
                    };
                    var appsForThisPage =
                        apps.GetPageData(pageInfo, CacheNames.ProfilePaginationDataForSpecificProfile, true)
                        .ToList();
                    algorithms.GetEmbedImagesWithApp(appsForThisPage, db, (int)pageInfo.ItemsInPage,
                                                     GalleryCategoryIDs.SearchIcon);
                    ViewBag.Apps = appsForThisPage;
                    var eachUrl = "/profiles/" + user.UserName + "?page=@page";
                    ViewBag.paginationHtml = new HtmlString(Pagination.GetList(pageInfo, eachUrl, "",
                                                                               maxNumbersOfPagesShow: MaxNumbersOfPagesShow));
                    ViewBag.breadcrumbs = algorithms.GetBredcrumbsBasedOnCurrentUrl();
                    return(View(user));
                }
            }
            ViewBag.Reason = "User not found.";
            return(View("_404"));
        }
Example #4
0
        async Task UpdateAsync()
        {
            while (true)
            {
                _state = await UpdateState();

                if (_state == null)
                {
                    await Task.Delay(500);

                    continue;
                }
                var result = Logics.TryGetResult(_state);
                if (result != null)
                {
                    End(result);
                    return;
                }
                if (_state.GetTurnOwner() != _playerName)
                {
                    await Task.Delay(500);

                    continue;
                }
                while (true)
                {
                    DrawField();
                    DrawTurnInfo();
                    var intent = AskForIntent();
                    if (intent != null)
                    {
                        await SendIntentAsync(intent);

                        break;
                    }
                }
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Task 10.1.12");
            bool            ansOpen   = ConsoleUtility.AnswerOpen();
            List <Triangle> Matrix    = new List <Triangle>();
            List <Triangle> newMatrix = new List <Triangle>();

            if (ansOpen == true)
            {
                Matrix = ConsoleUtility.MatrixRead();
                Console.WriteLine("Генерирум список трекгольников...");
                ConsoleUtility.OutputMatrix(Matrix);
            }
            else
            {
                Console.WriteLine("Введите размерность матрицы");

                int row = ConsoleUtility.InputRowAndColumn("Кол-во строк в матрице: ");
                Console.WriteLine("Генерирум список трекгольников...");
                Matrix = GVUtility.CreateRandomMatrix(row);
                ConsoleUtility.OutputMatrix(Matrix);
            }
            Logics log = new Logics(Matrix);

            newMatrix = log.TriangleIn4Part();
            if (newMatrix.Count == 0)
            {
                Console.WriteLine("Ни один из данных треугольников не может лежать сразу в 4 четвертях");
            }
            else
            {
                Console.WriteLine("Эти треугольники лежат в 4 четвертях на координатной сетке:");
                ConsoleUtility.OutputMatrix(newMatrix);
                ConsoleUtility.WriteMatrix(newMatrix);
            }

            Console.ReadKey();
        }
Example #6
0
 public ActionResult Specific(string platformName, int page = 1)
 {
     if (!string.IsNullOrWhiteSpace(platformName))
     {
         var alg      = new Logics();
         var pageInfo = new PaginationInfo {
             ItemsInPage = AppConfig.Setting.PageItems,
             PageNumber  = page
         };
         var platform = alg.GetPlatformPageApps(platformName,
                                                pageInfo,
                                                CacheNames.PlatformPageSpecificPagesCount + "-" + platformName);
         if (platform != null)
         {
             var eachUrl = "/Apps/Mobile/Platforms/" + platform.PlatformName + "/@page";
             ViewBag.paginationHtml = Pagination.GetList(pageInfo, eachUrl, "",
                                                         maxNumbersOfPagesShow: MaxNumbersOfPagesShow);
             return(View(platform));
         }
     }
     ViewBag.Reason = "Platform not found. Please try /Android or /Apple";
     return(View("_404"));
 }
Example #7
0
        /// <summary>
        /// 判断某人员在某企业是否为首次回款
        /// </summary>
        /// <param name="enterpriseKey"></param>
        /// <param name="laborKey"></param>
        /// <param name="excudeSalarySummaryKey">排除在外的工资摘要Key</param>
        /// <returns></returns>
        public Logics IsFirstCash(string enterpriseKey, string laborKey, string excudeSalarySummaryKey = "")
        {
            Logics result    = Logics.False;
            string sqlClause = string.Format("select count(*) from XQYCSalarySummary where EnterpriseKey='{0}' AND LaborKey='{1}' ", enterpriseKey, laborKey);

            if (string.IsNullOrWhiteSpace(excudeSalarySummaryKey) == false)
            {
                sqlClause += string.Format(" AND SalarySummaryGuid !='{0}' ", excudeSalarySummaryKey);
            }

            int valueCount = Convert.ToInt32(base.GetScalar(sqlClause));

            if (valueCount > 0)
            {
                result = Logics.False;
            }
            else
            {
                result = Logics.True;
            }

            return(result);
        }
Example #8
0
        /// <summary>
        ///     Called specifically from Post save or edit save
        ///     not from AdditionNeccessaryFields
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="uploadGuid"></param>
        /// <param name="tagString">Given tag list as comma separated value.</param>
        private void ManageTagsInDatabase(long appId, Guid uploadGuid, string tagString)
        {
            new Thread(() => {
                if (!string.IsNullOrWhiteSpace(tagString))
                {
                    using (var db2 = new ReviewAppsEntities()) {
                        // remove any previous tag relation with this app.
                        // remove all previous tag relation-ship with this app.
                        db2.Database.ExecuteSqlCommand("DELETE FROM TagAppRelation WHERE AppID=@p0", appId);
                        var tagsList = tagString.Split(";,".ToCharArray());
                        foreach (var tag in tagsList)
                        {
                            string tagDisplay   = Logics.GetAllUpperCaseTitle(tag);
                            var tagFromDatabase = db2.Tags.FirstOrDefault(n => n.TagDisplay == tagDisplay);
                            if (tagFromDatabase == null)
                            {
                                // creating tag
                                // if tag not exist in the database then create one.
                                tagFromDatabase = new Tag {
                                    TagDisplay = Logics.GetAllUpperCaseTitle(tagDisplay)
                                };
                                db2.Tags.Add(tagFromDatabase);
                            }

                            //db2.SaveChanges(); //remove this for testing if works

                            // add tag relation with this app
                            var newTagRel = new TagAppRelation();
                            //newTagRel.TagID = tagFromDatabase.TagID; // may not need to bind the tags id because it will be done by EF
                            newTagRel.AppID = appId;
                            tagFromDatabase.TagAppRelations.Add(newTagRel);
                            db2.SaveChanges();
                        }
                    }
                }
            }).Start();
        }
Example #9
0
        public void NoIntentsAfterWin()
        {
            var state = CheckWin(_horizontalWin, "X");

            Assert.False(Logics.IsIntentValid(state, new Intent("O", 2, 0)));
        }
Example #10
0
        private bool IsExcuted()
        {
            Logics logic = BusinessLogBLL.Instance.GetLogStatus(TaskNameInConfig, DateTime.Today);

            return(Converter.ToBoolean(logic));
        }
Example #11
0
 public ListofItems()
 {
     logicsData = Logics.Instance;
     this.InitializeComponent();
     allItemsListView.ItemsSource = logicsData.GetAllLibraryItems();
 }
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Hello strategic tic-tac-toe demo!");
            Console.WriteLine();

            bool aiStep         = true;
            var  externalLogics = new Logics();
            bool success        = false;

            while (!success)
            {
                Console.WriteLine("First move settings: [a] ai or [h] human");
                string settings = Console.ReadLine();
                if (settings == "a")
                {
                    aiStep = true;
                    externalLogics.IsInverted = false;
                    success = true;
                }
                else if (settings == "h")
                {
                    aiStep = false;
                    externalLogics.IsInverted = true;
                    success = true;
                }
            }

            var            solverConfiguration = new SolverConfiguration();
            var            solverFactory       = new SolverFactory <Position, Cell>(externalLogics, solverConfiguration, SolverLog);
            ISolver <Cell> solver = solverFactory.Create();

            Position     position = new Position();
            IList <Cell> history  = new List <Cell>();

            while (!position.IsEnded)
            {
                PrintPosition(position);
                Cell     next;
                Position copy = new Position(position.History);

                if (aiStep)
                {
                    while (true)
                    {
                        try
                        {
                            solver = solverFactory.Create();
                            next   = AiStep(history, solver);
                            copy.Do(next);
                            break;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }
                }
                else
                {
                    while (true)
                    {
                        try
                        {
                            next = HumanStep();
                            copy.Do(next);
                            break;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }
                }
                position.Do(next);
                history.Add(next);
                aiStep = !aiStep;
            }
            if (!position.HasWinner)
            {
                Console.WriteLine("Game over, DRAW!");
            }
            else
            {
                Console.WriteLine(string.Format("Game over, {0} WON!", aiStep ? "human" : "ai"));
            }

            PrintPosition(position);

            Console.ReadKey();
        }
Example #13
0
 public void ThrowOnInvaldIntent()
 {
     Assert.False(Logics.IsIntentValid(null, null));
     Assert.Throws <ArgumentException>(() => Logics.ExecuteIntent(null, null));
 }
Example #14
0
 public void InvalidState()
 {
     Assert.False(Logics.IsIntentValid(null, new Intent("X", 0, 0)));
 }
Example #15
0
        /// <summary>
        /// 按照类别获取公式集合
        /// </summary>
        /// <param name="costKind"></param>
        /// <param name="costType"></param>
        /// <param name="onlyDisplayUsable"></param>
        /// <param name="whereClause"></param>
        /// <param name="paras"></param>
        /// <returns></returns>
        public List <CostFormularEntity> GetList(CostKinds costKind, CostTypes costType, Logics onlyDisplayUsable, string whereClause, params IDbDataParameter[] paras)
        {
            if (string.IsNullOrEmpty(whereClause))
            {
                whereClause = " 1=1 ";
            }

            whereClause += string.Format(" AND CostKind={0} AND CostType={1} ", (int)costKind, (int)costType);

            return(base.GetList(onlyDisplayUsable, whereClause, 0, string.Empty, paras));
        }
    public static MeshData PointCloudFromRaycasts(int resolution, int seed, Vector2 sampleCenter, WorldData worldData, PlantProfile profile)
    {
        #region Variables

        Random.State initialState = Random.state;
        Random.InitState(seed);

        int   verticesPerLine   = resolution;
        float spaceBetweenGrass = (float)Statics.terrainDataDetailResolution / verticesPerLine;
        float noise             = spaceBetweenGrass * 0.25f;

        float maxAltitude = Statics.maximumGlobalHeight + 1;
        float minAltitude = Statics.minimumGlobalHeight - 1;

        float elevation;

        Ray        ray;
        RaycastHit hit;
        float      distance      = maxAltitude - minAltitude;
        LayerMask  collisionMask = Statics.groundLayer;
        LayerMask  obstacleMask  = Statics.noGrowZone;

        Vector3 vertexPosition;
        Vector2 uvPercent;
        Vector3 normalDirection;
        Color   color;
        int     index = 0;

        MeshData meshData = new MeshData(true);

        #endregion

        for (int z = 0; z < verticesPerLine; z++)
        {
            for (int x = 0; x < verticesPerLine; x++)
            {
                float realX = x * spaceBetweenGrass;
                float realZ = z * spaceBetweenGrass;

                Vector2 noiseOffset  = new Vector2(Random.Range(-noise, noise), Random.Range(-noise, noise));
                Vector2 sampleOffset = new Vector2(realX - (verticesPerLine * 0.5f), realZ - (verticesPerLine * 0.5f));
                Vector3 origin       = new Vector3(sampleCenter.x + sampleOffset.x + noiseOffset.x, maxAltitude, sampleCenter.y + sampleOffset.y + noiseOffset.y);

                if (profile.density < Statics.hash.SampleHashAbs(origin))
                {
                    continue;
                }

                elevation = Logics.SampleDataSet(origin.z, origin.x, worldData.elevation);

                if (profile.habitat == PlantHabitat.Terrestrial)
                {
                    if (elevation < (Statics.minimumGrowthHeight + 1f) / Statics.maximumGlobalHeight)
                    {
                        continue;
                    }
                    if (elevation > (Statics.maximumGrowthHeight - 1f) / Statics.maximumGlobalHeight)
                    {
                        continue;
                    }
                }
                else if (profile.habitat == PlantHabitat.Marine)
                {
                    if (elevation > (Statics.minimumGrowthHeight + 1f) / Statics.maximumGlobalHeight)
                    {
                        continue;
                    }
                    if (elevation < Statics.seaLevel - 0.002f)
                    {
                        continue;
                    }
                }
                else if (profile.habitat == PlantHabitat.Aquatic)
                {
                    if (elevation > Statics.seaLevel - 0.002f)
                    {
                        continue;
                    }
                }

                ray = new Ray(origin, -Vector3.up);
                if (Physics.Raycast(origin + (Vector3.up * (1000 - maxAltitude)), -Vector3.up, out hit, distance + 1001, obstacleMask, QueryTriggerInteraction.Collide))
                {
                    continue;
                }

                if (Physics.Raycast(ray, out hit, distance, collisionMask, QueryTriggerInteraction.Collide))
                {
                    vertexPosition = new Vector3(hit.point.x - sampleCenter.x, hit.point.y - 0.01f, hit.point.z - sampleCenter.y);
                    uvPercent      = new Vector2((realX + noiseOffset.x) / verticesPerLine, (realZ + noiseOffset.y) / verticesPerLine);

                    float perlin = Statics.hash.SamplePerlin(vertexPosition);

                    normalDirection = hit.normal * Maths.Map(perlin, 0.25f, 0.75f, 0.5f, 1.25f);
                    if (perlin <= profile.diseasePrevalence)
                    {
                        color = Color.Lerp(profile.unhealthyDark, profile.unhealthyBright, Statics.hash.SampleHashAbs(vertexPosition));
                    }
                    else
                    {
                        color = Color.Lerp(profile.healthyDark, profile.healthyBright, Statics.hash.SampleHashAbs(vertexPosition));
                    }

                    meshData.AddPoint(index, vertexPosition, uvPercent, normalDirection, color);
                    index++;
                }
            }
        }

        Random.state = initialState;
        return(meshData);
    }
Example #17
0
        public override void InitState()
        {
            base.InitState();
            MenuSongSrc   = new VSoundSource("Foom/Song/intro1.mp3");
            MenuSongSound = MenuSongSrc.Play2D(true);

            var img = new ImageForm().Set(300, 800, 300, 300, "").SetImage(new Texture2D("Foom/Img/Intro/img1.jpg", LoadMethod.Single, true));

            UI.BootAlpha = 0.0f;
            int tc = 0;

            void ImgUp1()
            {
                img.Y = img.Y - 3;
            }

            bool ImgUpR()
            {
                if (img.Y < 200)
                {
                    return(true);
                }
                return(false);
            }

            void Img1Text()
            {
            }

            bool Img1TextD()
            {
                if (Environment.TickCount > (tc + 3000))
                {
                    return(true);
                }
                return(false);
            }

            //int tc = 0;


            void FadeUi1()
            {
            }

            void UI3()
            {
            }

            bool UI3D()
            {
                if (Environment.TickCount > (tc + 3500))
                {
                    return(true);
                }
                return(false);
            }

            void UI4S()
            {
                SUI.Root.Forms.Clear();

                var img1 = new ImageForm().Set(50, 50, 600, 600).SetImage(new Texture2D("Foom/Img/Intro/img3.jpg", LoadMethod.Single, false));
                var tex1 = new ImageForm().Set(100, 300, 600, 250).SetImage(new Texture2D("Foom/Img/Intro/text2.png", LoadMethod.Single, true));

                SUI.Root.Forms.Add(img1);
                SUI.Root.Add(img1);
                img1.Add(tex1);
                UI.TarAlpha = 1.0f;
            }

            bool FadeDone1()
            {
                if (Environment.TickCount > (tc + 3500))
                {
                    UI.TarAlpha = 0.0f;
                    if (UI.BootAlpha < 0.01f)
                    {
                        UI.TarAlpha = 1.0f;
                        return(true);
                    }
                }
                return(false);
            }

            void UI3S()
            {
                tc = Environment.TickCount;
                SUI.Root.Forms.Clear();

                var img2 = new ImageForm().Set(100, 100, 400, 400).SetImage(new Texture2D("Foom/Img/Intro/img2.jpg", LoadMethod.Single, true));

                SUI.Root.Add(img2);
                var log1 = new ImageForm().Set(220, 350, 500, 250).SetImage(new Texture2D("Foom/Img/Intro/text1.png", LoadMethod.Single, true));

                SUI.Root.Add(log1);
                Logics.When(FadeDone1, UI4S);

                UI.TarAlpha = 1.0f;
                Logics.Do(UI3, UI3D);
            }

            // bool UI3D()
            // {
            //    return false;
            //}


            bool FadeUID()
            {
                if (UI.BootAlpha < 0.01f)
                {
                    return(true);
                }
                return(false);
            }

            void FadeUI()
            {
                UI.TarAlpha = 0.0f;
                Logics.Do(FadeUi1, FadeUID, UI3S);
                //    UI.BootAlpha += (0.0f - UI.BootAlpha) * 0.1f;
            }

            void NextImg()
            {
                tc = Environment.TickCount;
                Logics.Do(Img1Text, Img1TextD, FadeUI);

                var text = new LabelForm().Set(600, 250, 200, 80, "The Dawn Of Hell...");

                SUI.Root.Forms.Add(text);
            }

            Logics.Do(ImgUp1, ImgUpR, NextImg);



            SUI = new UI();

            SUI.Root.Add(img);
        }
 public Login()
 {
     logicsData = Logics.Instance;
     this.InitializeComponent();
 }
Example #19
0
        /// Apply the preferences to the Scenario
        /// </summary>
        /// <param name="prefs"></param>
        private void SetPreferences(Logics.Preferences.FormPrefs prefs)
        {
            if (prefs == null || Scenario == null)
            {
                return;
            }

            Scenario.SetPositionInfo(prefs.PosX, prefs.PosY, prefs.Width, prefs.Height, prefs.Properties);
        }
Example #20
0
 /// <summary>
 /// 获取所有的角色
 /// </summary>
 /// <returns></returns>
 public static List<BusinessRole> GetList(Logics onlyDisplayUsable, string whereClause)
 {
     string cacheKey = CoreCacheKeys.GetRoleListKey(onlyDisplayUsable, whereClause);
     return CacheHelper.Access<Logics, string, List<BusinessRole>>(cacheKey, CacheHelper.AFewTime, DALSave.GetList, onlyDisplayUsable, whereClause);
 }
Example #21
0
 public void Add(LogicFlowModel[] logics)
 {
     Logics.AddRange(logics);
 }
    public static List <TreeData> TreeCloudFromRaycasts(int seed, Vector2 sampleCenter, WorldData worldData, PlantProfile profile)
    {
        #region Variables

        Random.State initialState = Random.state;
        Random.InitState(seed);

        List <TreeData> treeCloud = new List <TreeData>();
        Vector3         position;
        Quaternion      rotation;
        Vector3         scale;

        int   density     = Mathf.RoundToInt((Statics.terrainDataResolution * 0.5f) * profile.density);
        float maxAltitude = Statics.maximumGlobalHeight + 1;
        float minAltitude = Statics.minimumGlobalHeight - 1;
        float noise       = 0.5f;

        Ray        ray;
        RaycastHit hit;
        float      distance      = maxAltitude - minAltitude;
        LayerMask  collisionMask = Statics.groundLayer;
        LayerMask  obstacleMask  = Statics.obstacleLayer;

        float elevation;

        #endregion

        for (int i = 0; i < density; i++)
        {
            Vector3 origin = new Vector3(sampleCenter.x, 0, sampleCenter.y);
            origin.y  = maxAltitude;
            origin.x += Statics.terrainDataResolution * Random.Range(-0.5f, 0.5f);
            origin.z += Statics.terrainDataResolution * Random.Range(-0.5f, 0.5f);

            elevation = Logics.SampleDataSet(origin.z, origin.x, worldData.elevation);

            if (profile.habitat == PlantHabitat.Terrestrial)
            {
                if (elevation < (Statics.minimumGrowthHeight + 2.5f) / Statics.maximumGlobalHeight)
                {
                    continue;
                }
                if (elevation > (Statics.maximumGrowthHeight - 2.5f) / Statics.maximumGlobalHeight)
                {
                    continue;
                }
            }
            else if (profile.habitat == PlantHabitat.Marine)
            {
                if (elevation > (Statics.minimumGrowthHeight + 2.5f) / Statics.maximumGlobalHeight)
                {
                    continue;
                }
                if (elevation < Statics.seaLevel - 0.002f)
                {
                    continue;
                }
            }
            else if (profile.habitat == PlantHabitat.Aquatic)
            {
                if (elevation > Statics.seaLevel - 0.002f)
                {
                    continue;
                }
            }

            ray = new Ray(origin, -Vector3.up);

            if (Physics.Raycast(origin + (Vector3.up * (1000 - maxAltitude)), -Vector3.up, out hit, distance + 1001, obstacleMask, QueryTriggerInteraction.Collide))
            {
                continue;
            }

            if (Physics.Raycast(ray, out hit, distance, collisionMask, QueryTriggerInteraction.Collide))
            {
                position = hit.point - Vector3.up * Random.Range(1f, 2f);
                rotation = Quaternion.Euler(
                    (Vector3.right * Random.Range(-noise, noise)) +
                    (Vector3.up * Random.Range(0, 360)) +
                    (Vector3.forward * Random.Range(-noise, noise))
                    );
                scale = Vector3.one * Random.Range(1 - noise, 1 + noise);

                GameObject newTree = Instantiate(profile.model, Statics.treesParent, true);
                newTree.name = profile.name + " (" + i + ")";

                newTree.transform.position   = position;
                newTree.transform.rotation   = rotation;
                newTree.transform.localScale = scale;

                treeCloud.Add(new TreeData(position, rotation, scale));
            }
        }

        Random.state = initialState;
        return(treeCloud);
    }
 public ClusteredMapRenderer()
 {
     Logics.Remove(Logics.OfType <PinLogic>().First());
     Logics.Add(new ClusterLogic(Config.ImageFactory,
                                 OnMarkerCreating, OnMarkerCreated, OnMarkerDeleting, OnMarkerDeleted));
 }
Example #24
0
 public void Remove(int seq)
 {
     Logics.RemoveAll(x => x.Seq == seq);
 }
Example #25
0
        public override void InitState()
        {
            Console.WriteLine("Loading logo tex.");
            LogoTex = new StarEngine.Texture.VTex2D("Data\\2D\\Logo\\DarkArtLogo.png", LoadMethod.Single);
            PresTex = new VTex2D("Data\\2D\\Logo\\Presents.png", LoadMethod.Single);
            GameTex = new VTex2D("Data\\2D\\Logo\\ArenaLogo.png", LoadMethod.Single);
            Console.WriteLine("Loaded.");

            ms = StarSoundSys.Play2DFile("Data\\Music\\Logo\\LogoTheme1.wav");

            VPen.SetProj(0, 0, StarApp.W, StarApp.H);

            bool AlphaUp()
            {
                LogoAlpha = LogoAlpha + 0.015f;
                if (LogoAlpha > 1.0f)
                {
                    return(true);
                }
                return(false);
            }

            int waitStart = 0;

            void WaitInit()
            {
                waitStart = Environment.TickCount;
            }

            bool WaitABit()
            {
                if (Environment.TickCount > waitStart + 2000)
                {
                    return(true);
                }
                return(false);
            }

            bool logoDone = false;

            bool AlphaDown()
            {
                LogoAlpha -= 0.01f;
                if (LogoAlpha < 0.0f)
                {
                    logoDone  = true;
                    LogoAlpha = 0.0f;
                    return(true);
                }
                return(false);
            }

            void TestDo()
            {
            }

            void DoPresent()
            {
                LogoAlpha   = 0.0f;
                PresentLogo = true;
            }

            void DoGame()
            {
                LogoAlpha = 0.0f;
                GameLogo  = true;
            }

            void Done()
            {
                ms.Stop();
                ToMenu = true;
            }

            Logics.Flow(null, AlphaUp);
            Logics.Flow(WaitInit, WaitABit);
            Logics.Flow(null, AlphaDown, DoPresent);
            Logics.Flow(null, AlphaUp);
            Logics.Flow(WaitInit, WaitABit);
            Logics.Flow(null, AlphaDown, DoGame);
            Logics.Flow(null, AlphaUp);
            Logics.Flow(WaitInit, WaitABit);
            Logics.Flow(null, AlphaDown, Done);


            bool StateDone()
            {
                return(logoDone);
            }

            void NextState()
            {
                ms.Stop();
                PresentLogo = true;
            }

            bool UnlessMusic()
            {
                return(ms.Playing);
            }

            Logics.When(StateDone, NextState, UnlessMusic);
        }
Example #26
0
 public static string GetAreaListKey(string parentAreaCode, Logics onlyDisplayUsable)
 {
     return string.Format("{0}ParentAreaCode{1}_CanUsable{2}", GetAreaListPrefixKey(), parentAreaCode, (int)onlyDisplayUsable);
 }
Example #27
0
 public void InvalidIntent()
 {
     Assert.False(Logics.IsIntentValid(new GameState(3, "X", "O"), null));
 }
Example #28
0
 public void Add(LogicFlowModel logic)
 {
     Logics.Add(logic);
 }
 public MenuAdmin()
 {
     logicsData = Logics.Instance;
     this.InitializeComponent();
     ShowOption();
 }
Example #30
0
 public void Remove(LogicFlowModel logic)
 {
     Logics.Remove(logic);
 }
    public static WorldData GenerateWorldData(TerrainData terrainData, TerrainSurfaceData[] surfaceData, bool climateData = false)
    {
        #region Variables

        Statics.maximumGlobalHeight = terrainData.bounds.max.y;
        Statics.minimumGlobalHeight = 0;

        Statics.maximumGrowthHeight = Statics.maximumGlobalHeight * surfaceData[3].startingHeight;
        Statics.minimumGrowthHeight = Statics.maximumGlobalHeight * surfaceData[2].startingHeight;

        Statics.seaLevel   = Mathf.Lerp(surfaceData[1].startingHeight, surfaceData[2].startingHeight, 0.9f);
        Statics.cloudLevel = Statics.maximumGlobalHeight * 1.1f;

        int width  = Statics.terrainDataResolution;
        int length = Statics.terrainDataResolution;
        int depth  = surfaceData.Length;

        float[,] elevation   = new float[width, length];
        float[,] temperature = new float[width, length];
        float[,] moisture    = new float[width, length];
        int[,] surface       = new int[width, length];
        float[,,] splatMap   = new float[width, length, depth];

        float[] surfaceValues;

        float minimumGrowthHeight = Statics.minimumGrowthHeight / Statics.maximumGlobalHeight;
        float maximumGrowthHeight = Statics.maximumGrowthHeight / Statics.maximumGlobalHeight;

        #endregion

        for (int y = 0; y < length; y++)
        {
            for (int x = 0; x < width; x++)
            {
                #region Elevation

                elevation[x, y] = terrainData.GetHeight(y, x) / Statics.maximumGlobalHeight;

                #endregion

                #region Temperature

                if (elevation[x, y] >= maximumGrowthHeight)
                {
                    temperature[x, y] = Maths.Map(elevation[x, y], maximumGrowthHeight, 1.0f, 0.25f, 0.0f);
                }
                else if (elevation[x, y] <= minimumGrowthHeight)
                {
                    temperature[x, y] = Maths.Map(elevation[x, y], 0.0f, minimumGrowthHeight, 0.0f, 0.25f);
                }
                else
                {
                    temperature[x, y] = Maths.MapToCenter(elevation[x, y], Statics.seaLevel, minimumGrowthHeight, maximumGrowthHeight, 0.25f, 0.75f);
                }

                #endregion

                #region Moisture

                if (elevation[x, y] >= maximumGrowthHeight)
                {
                    moisture[x, y] = 0;
                }
                else if (elevation[x, y] <= Statics.seaLevel)
                {
                    moisture[x, y] = 1;
                }
                else if (elevation[x, y] > Statics.seaLevel && elevation[x, y] < minimumGrowthHeight)
                {
                    moisture[x, y] = Maths.Map(elevation[x, y], Statics.seaLevel, minimumGrowthHeight, 1.0f, 0.75f);
                }
                else
                {
                    moisture[x, y] = Maths.Map(elevation[x, y], minimumGrowthHeight, maximumGrowthHeight, 0.75f, 0.0f);
                }

                #endregion

                #region Surface

                surfaceValues = new float[depth];

                for (int i = 0; i < depth; i++)
                {
                    if (i == depth - 1 && elevation[x, y] >= surfaceData[i].startingHeight)
                    {
                        surfaceValues[i] = 1;
                        surface[x, y]    = i;
                    }
                    else if (elevation[x, y] >= surfaceData[i].startingHeight && elevation[x, y] < surfaceData[i + 1].startingHeight)
                    {
                        surfaceValues[i] = 1;
                        surface[x, y]    = i;
                    }
                }

                for (int i = 0; i < depth; i++)
                {
                    splatMap[x, y, i] = surfaceValues[i];
                }

                #endregion
            }
        }

        #region Smoothing

        for (int i = 0; i < 3; i++)
        {
            splatMap = Logics.Smooth(splatMap, i);
        }

        #endregion

        return(new WorldData(elevation, temperature, moisture, surface, splatMap));
    }
Example #32
0
 protected override void OnValidIntentCreated(Intent intent)
 {
     _state = Logics.ExecuteIntent(_state, intent);
     OnStateUpdated();
 }
Example #33
0
 public static string GetRoleListKey(Logics onlyDisplayUsable, string whereClause)
 {
     return string.Format("{0}onlyDisplayUsable:{1}-whereClause:{2}", GetRoleListPrefixKey(), onlyDisplayUsable, whereClause);
 }
Example #34
0
 static void Main(string[] args)
 {
     Logics logs = new Logics();
 }
Example #35
0
 public SignUpPage()
 {
     logicsData = Logics.Instance;
     this.InitializeComponent();
     userTypeCmbBx.ItemsSource = Enum.GetValues(typeof(UserType));
 }
Example #36
0
 public AddItemPage()
 {
     logicsData = Logics.Instance;
     this.InitializeComponent();
 }