示例#1
0
        public void CanBeautify()
        {
            string minid, code = "if(test==0){alert(1);}";

            minid = Beautify.js_beautify(code);

            minid.Length.Should().Be.InRange(code.Length, int.MaxValue);
        }
 public ActionResult BeautifyInNewPage(Beautify beautify)
 {
     if (beautify.Str == null)
     {
         beautify.Str = "";
     }
     return Content(beautify.Str, "text/xml");
 }
示例#3
0
        private void ToCode()
        {
            globalScopeControl.UpdateScope();
            VCodeToCode vBlockToCode = new VCodeToCode(globalScopeControl.GlobalScope);
            Beautify    beautifier   = new Beautify(vBlockToCode.Code);

            CodeEditor.Text = beautifier.CodeOutput;
        }
        public ActionResult Index(Beautify beautify)
        {
            //burda beautify in dolu gelmesi _ViewImport un oluşturulmasıyla oldu
            var bb = new Beautify();
            bb.Str = beautify.Str;
            bb.BeautifiedStr = _xmlService.Beautify(beautify.Str);
            Session.Add("BeautifiedObject", bb);

            return RedirectToAction("Index");
        }
 private void UpdateUI()
 {
     if (BuildingNameUI != null)
     {
         BuildingNameUI.text = SelectedBuildingBlueprint.BuildingPrefab.Name;
     }
     if (BuildingNameCost != null)
     {
         BuildingNameCost.text = Beautify.GetAmountWithCurrency(SelectedBuildingBlueprint.BuildingPrefab.Cost);
     }
 }
示例#6
0
        public void BeautifyBadCode()
        {
            string minid, code = "----*&;lij;{lo23i41";

            try
            {
                minid = Beautify.js_beautify(code);
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine(ex);
            }
        }
示例#7
0
    // Use this for initialization
    void Awake()
    {
        sceneId = Application.loadedLevelName;
        Debug.LogWarning("当前场景:" + Application.loadedLevelName);
        //每次切换新的区域大地图都需要把静态事件和动态事件合并
        if (StaticAreaEventsMapping == null)
        {
            StaticAreaEventsMapping = new System.Collections.Generic.Dictionary <string, EventData>();
            JObject allEvents = JsonManager.GetInstance().GetJson("AreaEventDatas");
            foreach (var obj in allEvents)
            {
                if (!StaticAreaEventsMapping.ContainsKey(obj.Value["Id"].ToString()))
                {
                    StaticAreaEventsMapping.Add(obj.Value["Id"].ToString(), JsonManager.GetInstance().DeserializeObject <EventData>(obj.Value.ToString()));
                }
            }
        }
        //加载动态事件
        if (ActiveAreaEventsMapping == null)
        {
            ActiveAreaEventsMapping = new Dictionary <string, EventData>();
        }

        //初始化临时禁用事件集合
        if (DisableEventIdMapping == null)
        {
            DisableEventIdMapping = new Dictionary <string, EventData>();
        }

        follow             = GetComponent <tk2dTileMapDemoFollowCam>();
        follow.followSpeed = 30;
        map                  = GameObject.Find("TileMap").GetComponent <tk2dTileMap>();
        areaTarget           = Statics.GetPrefabClone("Prefabs/AreaTarget").GetComponent <AreaTarget>();
        areaTarget.Map       = map;
        follow.target        = areaTarget.transform;
        myCamera             = GetComponent <Camera>();
        myCamera.cullingMask = 1 << LayerMask.NameToLayer("Role") | 1 << LayerMask.NameToLayer("Ground") | 1 << LayerMask.NameToLayer("Target");
        myBeatuify           = GetComponent <Beautify>();
        if (myBeatuify == null)
        {
            myBeatuify = gameObject.AddComponent <Beautify>();
        }
        myBeatuify.quality           = BEAUTIFY_QUALITY.Mobile;
        myBeatuify.preset            = BEAUTIFY_PRESET.Medium;
        myBeatuify.sharpenRelaxation = 0;
        myBeatuify.brightness        = 1f;
    }
        public JsonResult BeautifyInNewPage(Beautify beautify)
        {
            object a;

            if (beautify.Str == null)
            {
                beautify.Str = "";
            }
            try
            {
                a = new JavaScriptSerializer().DeserializeObject(beautify.Str);
            }
            catch
            {
                a = _jsonService.Beautify(beautify.Str);
            }
            return(Json(a, JsonRequestBehavior.AllowGet));
        }
 // Start is called before the first frame update
 void Start()
 {
     if (BuildingPrefab != null)
     {
         if (BuildingName != null)
         {
             BuildingName.text = BuildingPrefab.Name;
         }
         if (Image != null)
         {
             Image.sprite = BuildingPrefab.Image;
         }
         if (BuildingDescription != null)
         {
             BuildingDescription.text = BuildingPrefab.Description;
         }
         if (BuildingCost != null)
         {
             BuildingCost.text = Beautify.GetAmountWithCurrency(BuildingPrefab.Cost);
         }
     }
 }