예제 #1
0
        public async Task <IActionResult> Onboard(string id, string _, CancellationToken cancellationToken)
        {
            if (await DB.Otcs.AnyAsync(x => x.Id == id, cancellationToken))
            {
                return(Prompt(x =>
                {
                    x.Title = SR["Cannot onboard"];
                    x.Details = SR["The token <{0}> is already onboarded", id];
                    x.StatusCode = 400;
                }));
            }

            var token = await DB.Tokens.SingleOrDefaultAsync(x => x.Id == id, cancellationToken);

            if (token == null)
            {
                return(Prompt(x =>
                {
                    x.Title = SR["Token not found"];
                    x.Details = SR["The token <{0}> has not been found in system.", id];
                    x.StatusCode = 404;
                }));
            }

            if (!User.IsInRole("ROOT") && User.Current.Id != token.UserId)
            {
                return(Prompt(x =>
                {
                    x.Title = SR["Permission Denied"];
                    x.Details = SR["You don't have the access to {0}", token.Id];
                    x.StatusCode = 401;
                }));
            }

            var otc = new Otc
            {
                Id     = id,
                Status = Status.Reviewing
            };

            DB.Otcs.Add(otc);
            await DB.SaveChangesAsync();

            return(Prompt(x =>
            {
                x.Title = SR["Onboarded"];
                x.Details = SR["The token has onboarded otc exchange"];
                x.HideBack = true;
                x.RedirectText = SR["Configure"];
                x.RedirectUrl = Url.Action("Manage", new { id = otc.Id });
            }));
        }
예제 #2
0
    public static void Export()
    {
        var p = EditorPrefs.GetString("projectPath");

        if (Directory.Exists(p))
        {
            Terrn.ExportTerrn();
            Terrn.ExportTextures();
            Tobj.Export();
            Otc.ExportMain();
            Otc.ExportPage();
            var root = GameObject.Find("root");
            if (root != null)
            {
                var objectExported = new List <string>();
                var meshesExported = new List <string>();
                foreach (Transform child in root.transform)
                {
                    if (!objectExported.Contains(child.name) && child.tag != "DefaultContent")
                    {
                        objectExported.Add(child.name);
                        Odef.Export(child.gameObject);

                        /*
                         * var m = child.GetComponentsInChildren<MeshFilter>();
                         * var mr = child.GetComponentsInChildren<MeshRenderer>();
                         *
                         *
                         * if (m.Length > 1 && !meshesExported.Contains(m[0].sharedMesh.name))
                         * {
                         *  var combinedMesh = new Mesh();
                         *  var combineIns = new List<CombineInstance>();
                         *  var materials = new List<Material>();
                         *  for (var i = 0; i < m.Length; i++)
                         *  {
                         *      print("combing " + m[i].sharedMesh.name);
                         *      combineIns.Add(new CombineInstance
                         *      {
                         *          mesh = m[i].sharedMesh,
                         *          transform = m[i].transform.worldToLocalMatrix
                         *
                         *      });
                         *      materials.AddRange(mr[i].sharedMaterials);
                         *  }
                         *  combinedMesh.name = m[0].sharedMesh.name;
                         *  materials = materials.Distinct().ToList();
                         *  combinedMesh.CombineMeshes(combineIns.ToArray(), false);
                         *  Meshes.Export(combinedMesh, materials.ToArray());
                         *  Materials.Export(materials.ToArray());
                         *  meshesExported.Add(combinedMesh.name);
                         * }
                         * else if (m.Length == 1 && !meshesExported.Contains(m[0].sharedMesh.name))
                         * {
                         *  Meshes.Export(m[0].sharedMesh, mr[0].sharedMaterials);
                         *  Materials.Export(mr[0].sharedMaterials);
                         *  meshesExported.Add(m[0].sharedMesh.name);
                         * }
                         */
                    }
                }

                var m  = root.GetComponentsInChildren <MeshFilter>();
                var mr = root.GetComponentsInChildren <MeshRenderer>();

                if (m.Length > 0)
                {
                    for (var i = 0; i < m.Length; i++)
                    {
                        if (!meshesExported.Contains(m[i].sharedMesh.name) && m[i].gameObject.tag != "DefaultContent")
                        {
                            Meshes.Export(m[i].sharedMesh, mr[i].sharedMaterials);
                            Materials.Export(mr[i].sharedMaterials);
                            meshesExported.Add(m[i].sharedMesh.name);
                        }
                    }
                }
            }
        }
    }
예제 #3
0
        public Isso(int cIsso, string description, Otc otc, ApplicationType typeApp)
        {
            CIsso       = cIsso;
            Description = description;
            switch (typeApp)
            {
            case ApplicationType.IssoS:
                switch (otc)
                {
                case Otc.NotChanged:
                    Img = new FileImageSource {
                        File = "draw_1.png"
                    };
                    break;

                case Otc.SlightlyWorse:
                    Img = new FileImageSource {
                        File = "draw_2.png"
                    };
                    break;

                case Otc.Worse:
                    Img = new FileImageSource {
                        File = "draw_3.png"
                    };
                    break;

                case Otc.SignificantlyWorse:
                    Img = new FileImageSource {
                        File = "draw_4.png"
                    };
                    break;

                case Otc.Improved:
                    Img = new FileImageSource {
                        File = "draw_5.png"
                    };
                    break;

                case Otc.Crash:
                    Img = new FileImageSource {
                        File = "draw_6.png"
                    };
                    break;

                default:
                    Img = new FileImageSource {
                        File = "draw_0.png"
                    };
                    break;
                }
                break;

            case ApplicationType.IssoI:
                switch (otc)
                {
                case Otc.Emergency:
                    Img = new FileImageSource {
                        File = "emergency.png"
                    };
                    break;

                case Otc.PreEmergency:
                    Img = new FileImageSource {
                        File = "pre_emergency.png"
                    };
                    break;

                case Otc.NonSatisfied:
                    Img = new FileImageSource {
                        File = "non_satisfied.png"
                    };
                    break;

                case Otc.Satisfied:
                    Img = new FileImageSource {
                        File = "satisfied.png"
                    };
                    break;

                case Otc.WellDone:
                    Img = new FileImageSource {
                        File = "well_done.png"
                    };
                    break;

                case Otc.Excellent:
                    Img = new FileImageSource {
                        File = "well_done.png"
                    };
                    break;

                case Otc.NotActual:
                    Img = new FileImageSource {
                        File = "not_actual.png"
                    };
                    break;

                case Otc.EmergencyNotActual:
                    Img = new FileImageSource {
                        File = "emergency_not_actual.png"
                    };
                    break;

                case Otc.PreEmergencyNotActual:
                    Img = new FileImageSource {
                        File = "pre_emergency_not_actual.png"
                    };
                    break;

                case Otc.NonSatisfiedNotActual:
                    Img = new FileImageSource {
                        File = "non_satisfied_not_actual.png"
                    };
                    break;

                case Otc.SatisfiedNotActual:
                    Img = new FileImageSource {
                        File = "satisfied_not_actual.png"
                    };
                    break;

                case Otc.WellDoneNotActual:
                    Img = new FileImageSource {
                        File = "well_done_not_actual.png"
                    };
                    break;
                }
                break;
            }
        }