Exemplo n.º 1
0
		//-------------------------------------------------------------------------------------
		#region << Methods >>
		/// <summary>
		/// Распаковывает данные и десериализует их в объект.
		/// </summary>
		/// <param name="obj">Объект-назначение десериализации.</param>
		public void Unpack(GlobalObject obj)
		{
			if(obj == null)
				throw new ArgumentNullException("obj");
			using(MemoryStream ms = new MemoryStream(_data))
			 PulsarSerializer.Deserialize(ms,obj, true);
		}
Exemplo n.º 2
0
	// Use this for initialization
	void Awake ()
	{
		GameObject global = GameObject.Find ("GlobalObject"); 
		if (global != null) {
			globalObj = global.GetComponent<GlobalObject> ();
		}
		if (globalObj != null) {
			switch (globalObj.boardSize) {
			case 0:
				boardSize = 5;
				break;
			case 1:
				boardSize = 7;
				break;
			case 2:
				boardSize = 9;
				break;
			}
		}

		board = new BoardSquare[boardSize + 2, boardSize + 2]; // Add 2 lanes for the outside walkway
		for (int i = 0; i < boardSize + 2; i++) {
			for (int j = 0; j < boardSize + 2; j++) {
				board [i, j] = new BoardSquare ();

			}
		}
		maxBlocks = boardSize * boardSize; 
	}
 /// <summary>
 ///     Initializes a new instance of the <see cref="SelectGlobalObjectEventArgs" /> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="object">The global object.</param>
 /// <param name="modelid">The modelid.</param>
 /// <param name="position">The position.</param>
 public SelectGlobalObjectEventArgs(BasePlayer player, GlobalObject @object, int modelid, Vector3 position)
     : base(position)
 {
     Player = player;
     Object = @object;
     ModelId = modelid;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="EditGlobalObjectEventArgs" /> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="object">The global object.</param>
 /// <param name="response">The response.</param>
 /// <param name="position">The position.</param>
 /// <param name="rotation">The rotation.</param>
 public EditGlobalObjectEventArgs(BasePlayer player, GlobalObject @object, EditObjectResponse response,
     Vector3 position, Vector3 rotation) : base(position)
 {
     Player = player;
     Object = @object;
     EditObjectResponse = response;
     Rotation = rotation;
 }
Exemplo n.º 5
0
    void Start()
    {
        global = GameObject.FindObjectOfType<GlobalObject>();
        global.arf1 = art1;
        global.arf2 = art2;
        global.arf3 = art3;

        global.artefakty();
    }
    public void Awake()
    {
        if (sharedInstance == null) {
            Debug.Log("Awake GlobalObject");

            sharedInstance = this;
            DontDestroyOnLoad(gameObject);
        }

        Debug.Log ("StringParam = " + getInstance().StringParam);
    }
Exemplo n.º 7
0
    public Inventory(int _width, int _height, string _name, bool _isInParty, GlobalObject _globalOwner = null, LocalObject _localOwner = null)
    {
        width = _width;
        height = _height;

        Log.Assert(Size > 0 && Size <= 100, "wrong inventory size");
        for (int i = 0; i < Size; i++) data.Add(i, null);

        globalOwner = _globalOwner;
        localOwner = _localOwner;
        name = _name;
        isInParty = _isInParty;
    }
Exemplo n.º 8
0
	// Use this for initialization
	void Start ()
	{
		globalObj = GameObject.Find ("GlobalObject").GetComponent<GlobalObject> ();

		GameObject.Find ("SizeText").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/Size"); 
		GameObject.Find ("DifficultyText").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/Difficulty");
		GameObject.Find ("StartText").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/PressStart");
		GameObject.Find ("SizeArrow").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/SelectionArrow");

		GameObject.Find ("Size").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/Seven"); 
		GameObject.Find ("Difficulty").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/Medium"); 
		globalObj.boardSize = sizeAt;
		globalObj.difficulty = difficultyAt;
	}
Exemplo n.º 9
0
    public void InitializeWindow(GUIProperties properties)
    {
        this._properties = properties;
        _events = GUIEventManager.Instance;
        _game = GlobalObject.Instance;

        textBoxStyle = new GUIStyle(_properties.UserInterface.label);
        buttonStyle = new GUIStyle(_properties.UserInterface.button);

        menuTexture = _properties.UserInterface.window.normal.background;
        windowHeaderTexture = _properties.UserInterface.label.normal.background;
        menuButtonTexture = _properties.UserInterface.button.normal.background;

        RecalculateRect();
    }
Exemplo n.º 10
0
	// Use this for initialization
	void Start ()
	{
		GameObject globalGameObj = GameObject.Find ("GlobalObject");
		if (globalGameObj != null) {
			globalObj = globalGameObj.GetComponent<GlobalObject> ();
		}
		//	GameObject.Find ("ReachedLevel15").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/ReachedLevel15"); 
		GameObject.Find ("MenuButton").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/MenuButton");
		GameObject.Find ("RetryButton").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/RetryButton");
		GameObject.Find ("RetrySelect").GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/bgSquareTransparent");
		//	GameObject.Find ("RetrySelect").transform.localScale = new Vector3(2.5F, 1.5F, 0); 
		if (globalObj != null) {
			GameObject.Find("Text").GetComponent<Text>().text = "YOU REACHED STAGE " + globalObj.highestStage + "!";
		}

	}
Exemplo n.º 11
0
    void Awake()
    {
        _game = GlobalObject.Instance;
        _events = GUIEventManager.Instance;
        _cameraFade = CameraFading.Instance;
        _effectManager = ScreenEffectManager.Instance;

        _mainMenu.InitializeWindow(_guiproperties);
        _optionsMenu.InitializeWindow(_guiproperties);
        _systemWindow.InitializeWindow(_guiproperties);
        _shopWindowComplex.InitializeWindow(_guiproperties);
        _shopMenuUnchangebleParts.InitializeWindow(_guiproperties);
        _shopMenuWeaponUpgradeZone.InitializeWindow(_guiproperties);
        lastScreenHeight = Screen.height;
        lastScreenWidth = Screen.width;
    }
Exemplo n.º 12
0
    void Awake()
    {
        if (Instance == null)
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }
        fps = GameObject.FindObjectOfType<FirstPersonController>();
        fpsTransform = GameObject.Find("FPSController").transform;


       
    }
Exemplo n.º 13
0
	void Start ()
	{
		playerArr = new bool[4];

		playerRes = Resources.Load<GameObject> ("Prefabs/SelectPlayer");
		q1 = GameObject.Find ("Q1");
		q2 = GameObject.Find ("Q2");
		q3 = GameObject.Find ("Q3");
		q4 = GameObject.Find ("Q4");
		startButton = GameObject.Find ("Start");

		q1.GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/PressA");
		q2.GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/PressA");
		q3.GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/PressA");
		q4.GetComponent<SpriteRenderer> ().sprite = Resources.Load<Sprite> ("Images/PressA");

		globalObj = GameObject.Find ("GlobalObject").GetComponent<GlobalObject> ();
	}
Exemplo n.º 14
0
    public void OnLookEnter()
    {
        Target.GetComponent<pupup>().Napis();
        selected = true;

        if (Input.GetKeyDown(KeyCode.E) && selected)
        {
            global = GameObject.FindObjectOfType<GlobalObject>();
            global.LocalCopyOfData.Art1 = true;
            global.IsBeingLoaded = true;
            global.savedPlayerData.PositionX = 169.39f;
            global.savedPlayerData.PositionY = 19.36f;
            global.savedPlayerData.PositionZ = 124.48f;
            lvl = GameObject.FindObjectOfType<LevelManager>();
            lvl.LoadScene("Las");
            Destroy(gameObject);
        }
    }
Exemplo n.º 15
0
		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Инициализирующий конструктор.
		/// </summary>
		public TransBox(GlobalObject obj, PulsarSerializationParams pars)
		{
			if(obj == null)
				throw new ArgumentNullException("obj");
			if(pars == null)
				throw new ArgumentNullException("obj");
			if(pars.NoStubObjects == null)
			 pars.NoStubObjects = new object[1] { obj };
			else	if(pars.NoStubObjects.Contains(obj) == false)
			{
			 pars.NoStubObjects = new List<object>(pars.NoStubObjects);
				((List<object>)pars.NoStubObjects).Add(obj);
			}
			using(MemoryStream ms = PulsarSerializer.Serialize(obj, pars))
			{
				ms.Position = 0;
				_data = ms.ToArray();
			}
		}
Exemplo n.º 16
0
 public virtual void ProcessCollisions(GlobalObject g)
 {
     //if (MyMath.SamePairs("Morlocks", "Wild Dogs", name, g.name)) { Kill(); g.Kill(); }
 }
Exemplo n.º 17
0
        public void Initialize(GlobalObject obj)
        {

        }
Exemplo n.º 18
0
 public void SetGlobal(GlobalObject obj, bool value)
 {
     string str = obj.GenerateKey();
     for (int i = 0; i < this.globals.Count; i++)
     {
         if (this.globals[i].key.Equals(str))
         {
             GlobalVar var = this.globals[i];
             var.value = true;
             return;
         }
     }
     this.globals.Add(new GlobalVar(str, value));
 }
Exemplo n.º 19
0
        // 获取文章列表
        private string getArticleList()
        {
            pagingJson paging = new pagingJson();

            try
            {
                //获取Datatables发送的参数 必要
                int draw = Int32.Parse(Funcs.Get("draw"));//请求次数 这个值作者会直接返回给前台

                //排序
                string orderColumn = Funcs.Get("order[0][column]"); //那一列排序,从0开始
                string orderDir    = Funcs.Get("order[0][dir]");    //ase desc 升序或者降序

                //搜索
                string sCategory = Funcs.Get("sCategory");                     //文章类型
                string sTitle    = GlobalObject.unescape(Funcs.Get("sTitle")); //标题

                //分页
                int start  = Int32.Parse(Funcs.Get("start"));  //第一条数据的起始位置
                int length = Int32.Parse(Funcs.Get("length")); //每页显示条数

                // where条件,排序条件
                string strWhere = "status!=2", strOrderBy = "";
                if (sCategory != null && sCategory != "")
                {
                    strWhere += " and categoryId =" + sCategory;
                }
                if (sTitle != null && sTitle != "")
                {
                    strWhere += " and title like '%" + Funcs.ToSqlString(sTitle) + "%'";
                }
                if (orderColumn != "" && orderDir != "")
                {
                    strOrderBy = Funcs.Get("columns[" + orderColumn + "][data]") + " " + orderDir;
                }
                string strTB = "(select a.*,c.categoryName from tb_article a left join tb_category c on a.categoryId=c.categoryId)tt";

                SqlParameter[] param = new SqlParameter[] {
                    new SqlParameter("@param_table", SqlDbType.Text)
                    {
                        Value = strTB
                    },
                    new SqlParameter("@param_field", SqlDbType.VarChar)
                    {
                        Value = "*"
                    },
                    new SqlParameter("@param_where", SqlDbType.Text)
                    {
                        Value = strWhere
                    },
                    new SqlParameter("@param_groupBy", SqlDbType.VarChar)
                    {
                        Value = ""
                    },
                    new SqlParameter("@param_orderBy", SqlDbType.VarChar)
                    {
                        Value = strOrderBy
                    },
                    new SqlParameter("@param_pageNumber", SqlDbType.VarChar)
                    {
                        Value = start / length + 1
                    },
                    new SqlParameter("@param_pageSize", SqlDbType.Int)
                    {
                        Value = length
                    },
                    new SqlParameter("@param_isCount", SqlDbType.Int)
                    {
                        Value = 1
                    }
                };

                DataSet ds = Utility.SqlHelper.ExecProcFillDataSet("sp_GetPagingList", param);
                paging.draw            = draw;
                paging.recordsTotal    = Int32.Parse(ds.Tables[1].Rows[0][0].ToString());
                paging.data            = ds.Tables[0];
                paging.recordsFiltered = Int32.Parse(ds.Tables[1].Rows[0][0].ToString());
                return(DateTimeFormat(paging, "yyyy-MM-dd hh:mm"));
            }
            catch (Exception ex)
            {
                paging.error = "获取文章列表失败:" + ex.Message;
                paging.data  = null;
                return(JsonConvert.SerializeObject(paging));
            }
        }
 public static void Gameover()
 {
     print("Gameover");
     GlobalObject.GetOrAddComponent <SwitchLevel>().Reload();
 }
 private void Del_quit()
 {
     GlobalObject.QuitApp();
 }
Exemplo n.º 22
0
 /// <summary>
 ///     Raises the <see cref="ObjectMoved" /> event.
 /// </summary>
 /// <param name="globalObject">The global-object triggering the event.</param>
 /// <param name="e">An <see cref="EventArgs" /> that contains the event data. </param>
 protected virtual void OnObjectMoved(GlobalObject globalObject, EventArgs e)
 {
     ObjectMoved?.Invoke(globalObject, e);
 }
Exemplo n.º 23
0
 protected virtual void Awake()
 {
     log("Awake");
     GlobalObject.initGlobalObject();
 }
Exemplo n.º 24
0
 void Start()
 {
     agent    = GetComponent <NavMeshAgent> ();
     animator = GetComponent <Animator> ();
     Player   = GlobalObject.GetPlayer();
 }
Exemplo n.º 25
0
        public byte[] Write()
        {
            MemoryStream       m  = new MemoryStream();
            EndianBinaryWriter er = new EndianBinaryWriter(m, Endianness.LittleEndian);
            int NrSections        = 0x12;

            Header.SectionOffsets = new UInt32[NrSections];
            Header.Write(er);

            int SectionIdx = 0;

            if (KartPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPoint.Write(er);
                SectionIdx++;
            }
            if (EnemyPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPoint.Write(er);
                SectionIdx++;
            }
            if (EnemyPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPointPath.Write(er);
                SectionIdx++;
            }
            if (ItemPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPoint.Write(er);
                SectionIdx++;
            }
            if (ItemPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPointPath.Write(er);
                SectionIdx++;
            }
            if (CheckPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPoint.Write(er);
                SectionIdx++;
            }
            if (CheckPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPointPath.Write(er);
                SectionIdx++;
            }
            if (GlobalObject != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                GlobalObject.Write(er);
                SectionIdx++;
            }
            if (PointInfo != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                PointInfo.Write(er);
                SectionIdx++;
            }
            if (Area != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Area.Write(er);
                SectionIdx++;
            }
            if (Camera != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Camera.Write(er);
                SectionIdx++;
            }
            if (JugemPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                JugemPoint.Write(er);
                SectionIdx++;
            }
            if (CannonPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CannonPoint.Write(er);
                SectionIdx++;
            }
            if (MissionPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                MissionPoint.Write(er);
                SectionIdx++;
            }
            if (StageInfo != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                StageInfo.Write(er);
                SectionIdx++;
            }
            if (CourseSect != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CourseSect.Write(er);
                SectionIdx++;
            }
            if (GliderPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                GliderPoint.Write(er);
                SectionIdx++;
            }
            if (GliderPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                GliderPointPath.Write(er);
                SectionIdx++;
            }
            WriteHeaderFileSize(er);
            byte[] result = m.ToArray();
            er.Close();
            return(result);
        }
Exemplo n.º 26
0
        protected void BindData()
        {
            IsScript = Common.Util.GetPageParamsAndToInt("isscript") == 1 ? true : false;
            int gnum = Common.Util.GetPageParamsAndToInt("gnum");

            if (gnum == -100)
            {
                return;
            }
            WebSiteUrl = Config.Global.__WebSiteUrl;
            string guidecHeader  = Common.Util.GetPageParams("guidechead");
            string guidecLink    = Common.Util.GetPageParams("guideclink");
            string guidecContent = Common.Util.GetPageParams("guideccontent").Replace("\"", "\\\"");
            string html          = "";

            if (string.IsNullOrEmpty(Common.Util.GetPageParams("article0")))
            {
                html = string.Format("\" + unescape(\"{0}\") + \"<br /><br /><ul>", guidecContent);
            }
            else
            {
                html = string.Format("\" + unescape(\"{0}\") + \"<br /><span style='color:red;'>\" + unescape('" + GlobalObject.escape("就医热点:") + "') + \"</span><ul>", guidecContent);
                for (int i = 0; i < gnum; i++)
                {
                    if (!string.IsNullOrEmpty(Common.Util.GetPageParams("article" + i.ToString())))
                    {
                        html += string.Format("<li style='width:160px;overflow:hidden;float:left;'><a href='{1}' target='_blank'>\" + unescape('{0}') + \"</a></li>", GlobalObject.escape("˙") + Common.Util.GetPageParams("article" + i.ToString()), Common.Util.GetPageParams("articlelink" + i.ToString()));
                    }
                }
            }
            html += "<li style='clear:both;height:0px;line-height:0px;'></li></ul>";
            mess  = string.Format("var msg = new msgbox(\"{3}\",{4});msg.alert(\"{0}\",\"{1}\",\"{2}\")", html, guidecLink, "_blank", "<span='font-family:\" + unescape(\"" + GlobalObject.escape("宋体") + "\") + \";'>\" + unescape(\"" + guidecHeader + "\") + \"</span>", "unescape(\"" + GlobalObject.escape("接受对话") + "\")");
        }
Exemplo n.º 27
0
 private void OnHandle_restart()
 {
     GlobalObject.ReStartGame();
 }
Exemplo n.º 28
0
 public static string unescape(string str)
 {
     return(GlobalObject.unescape(str));
 }
Exemplo n.º 29
0
 /// <summary>
 ///     Raises the <see cref="ObjectMoved" /> event.
 /// </summary>
 /// <param name="globalObject">The global-object triggering the event.</param>
 /// <param name="e">An <see cref="EventArgs" /> that contains the event data. </param>
 protected virtual void OnObjectMoved(GlobalObject globalObject, EventArgs e)
 {
     if (ObjectMoved != null)
         ObjectMoved(globalObject, e);
 }
Exemplo n.º 30
0
        private JsValue Str(string key, ObjectInstance holder)
        {
            var value = holder.Get(key);

            if (value.IsObject())
            {
                var toJson = value.AsObject().Get("toJSON");
                if (toJson.IsObject())
                {
                    var callableToJson = toJson.AsObject() as ICallable;
                    if (callableToJson != null)
                    {
                        value = callableToJson.Call(value, Arguments.From(key));
                    }
                }
            }

            if (_replacerFunction != Undefined.Instance)
            {
                var replacerFunctionCallable = (ICallable)_replacerFunction.AsObject();
                value = replacerFunctionCallable.Call(holder, Arguments.From(key, value));
            }


            if (value.IsObject())
            {
                var valueObj = value.AsObject();
                switch (valueObj.Class)
                {
                case "Number":
                    value = TypeConverter.ToNumber(value);
                    break;

                case "String":
                    value = TypeConverter.ToString(value);
                    break;

                case "Boolean":
                    value = TypeConverter.ToPrimitive(value);
                    break;

                case "Array":
                    value = SerializeArray(value.As <ArrayInstance>());
                    return(value);

                case "Object":
                    value = SerializeObject(value.AsObject());
                    return(value);
                }
            }

            if (value == Null.Instance)
            {
                return("null");
            }

            if (value.IsBoolean() && value.AsBoolean())
            {
                return("true");
            }

            if (value.IsBoolean() && !value.AsBoolean())
            {
                return("false");
            }

            if (value.IsString())
            {
                return(Quote(value.AsString()));
            }

            if (value.IsNumber())
            {
                if (GlobalObject.IsFinite(Undefined.Instance, Arguments.From(value)).AsBoolean())
                {
                    return(TypeConverter.ToString(value));
                }

                return("null");
            }

            var isCallable = value.IsObject() && value.AsObject() is ICallable;

            if (value.IsObject() && isCallable == false)
            {
                if (value.AsObject().Class == "Array")
                {
                    return(SerializeArray(value.As <ArrayInstance>()));
                }

                return(SerializeObject(value.AsObject()));
            }

            return(JsValue.Undefined);
        }
Exemplo n.º 31
0
        void IHttpHandler.ProcessRequest(HttpContext context)
        {
            try
            {
                string           fileName    = "";
                string           reqFilename = Path.GetFileName(context.Request.Url.AbsolutePath).ToLower();
                System.IO.Stream stream      = null;
                if (reqFilename == "headimg.ashx")
                {
                    int  userid = Convert.ToInt32(context.Request.QueryString["user"]);
                    int  size   = Convert.ToInt32(context.Request.QueryString["size"] ?? "0");
                    bool gred   = Convert.ToBoolean(context.Request.QueryString["gred"] ?? "false");

                    AccountInfo userInfo = AccountImpl.Instance.GetUserInfo(userid);

                    string preFileName = "";
                    if (String.IsNullOrEmpty(userInfo.HeadIMG))
                    {
                        preFileName = context.Server.MapPath("~/" + ServerImpl.Instance.ResPath + "/Themes/Default/HeadIMG/user");
                    }
                    else
                    {
                        preFileName = ServerImpl.Instance.MapPath(userInfo.HeadIMG);
                        if (!System.IO.File.Exists(preFileName))
                        {
                            throw new Exception();
                        }
                        ServerImpl.Instance.CheckPermission(context, userInfo.HeadIMG, IOPermission.Read);
                    }
                    fileName = preFileName;
                    if (gred)
                    {
                        fileName += ".gred";
                    }
                    if (size > 0)
                    {
                        fileName += String.Format(".{0}", size);
                    }
                    if (fileName != preFileName)
                    {
                        fileName += ".png";
                        if (!File.Exists(fileName))
                        {
                            fileName = ZoomHeadImage(preFileName, fileName, size, size, gred);
                        }
                    }
                    stream = System.IO.File.Open(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
                }
                else
                {
                    fileName = ServerImpl.Instance.GetFullPath(context, GlobalObject.unescape(context.Request["FileName"]));
                    ServerImpl.Instance.CheckPermission(context, fileName, IOPermission.Read);
                    stream = Core.IO.File.Open(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
                }
                if (stream == null)
                {
                    throw new Exception();
                }
                try
                {
                    string ext = Path.GetExtension(fileName).ToUpper();
                    if (ContentType.ContainsKey(ext))
                    {
                        context.Response.ContentType = ContentType[ext] as string;
                        context.Response.AppendHeader("Content-Disposition", string.Format("filename={0}{1}", UTF8_FileName(Path.GetFileNameWithoutExtension(fileName)), Path.GetExtension(fileName)));
                    }
                    else
                    {
                        context.Response.ContentType = "application/octet-stream";
                        context.Response.AppendHeader("Content-Disposition", string.Format("attachment;filename={0}{1}", UTF8_FileName(Path.GetFileNameWithoutExtension(fileName)), Path.GetExtension(fileName)));
                    }


                    FileSystemInfo fileInfo = new FileInfo(fileName);
                    if (fileInfo != null)
                    {
                        context.Response.AppendHeader("Last-Modified", String.Format("{0:R}", fileInfo.LastWriteTime));
                    }

                    context.Response.AppendHeader("Content-Length", stream.Length.ToString());

                    byte[] buffer = new byte[4 * 1024];
                    while (true)
                    {
                        int c = stream.Read(buffer, 0, buffer.Length);
                        if (c == 0)
                        {
                            break;
                        }
                        context.Response.OutputStream.Write(buffer, 0, c);
                        context.Response.Flush();
                    }
                }
                finally
                {
                    stream.Close();
                }
            }
            catch
            {
                context.Response.StatusCode = 404;
                context.Response.End();
            }
        }
Exemplo n.º 32
0
 void Awake()
 {
     animatorTapa = tapa.GetComponent <Animator> ();
     GlobalObject.CofrePuesto();
 }
Exemplo n.º 33
0
 public static string toUnEscape(this string text)
 {
     return(GlobalObject.unescape(text));
 }
Exemplo n.º 34
0
 public static string DecodeURIComponent(string sValue)
 {
     return(GlobalObject.decodeURIComponent(sValue));
 }
Exemplo n.º 35
0
Arquivo: Player.cs Projeto: mxgmn/GENW
    public override void Move(HexPoint.HexDirection d)
    {
        base.Move(d);

        foreach (LocalObject c in party) c.fatigue.Add(W.map[position.Shift(d)].type.travelTime * c.hp.Max);

        ground.Clear();
        crafting.Clear();

        foreach (ItemShape s in W.map[position].items) if (W.random.Next(50) <= Sum(Skill.Get("Survival")))	ground.Add(s);

        if (barter != null)
        {
            foreach (Item item in toBuy.Items) if (barter.inventory.CanAdd(item)) barter.inventory.Add(item);
            foreach (Item item in toSell.Items) if (inventory.CanAdd(item)) inventory.Add(item);

            toBuy.Clear();
            toSell.Clear();
            barter = null;
        }

        UpdateVisitedLocations();
    }
Exemplo n.º 36
0
 /// <summary>
 ///     Registers types this GlobalObjectController requires the system to use.
 /// </summary>
 public virtual void RegisterTypes()
 {
     GlobalObject.Register <GlobalObject>();
 }
Exemplo n.º 37
0
 public bool CheckGlobal(GlobalObject obj)
 {
     string str = obj.GenerateKey();
     foreach (GlobalVar var in this.globals)
     {
         if (var.key.Equals(str))
         {
             return var.value;
         }
     }
     this.globals.Add(new GlobalVar(str, false));
     return false;
 }
        public Form1()
            : base("http://res.app.local/www/index.html", false)
        {
            InitializeComponent();

            LoadHandler.OnLoadEnd += LoadHandler_OnLoadEnd;

            //register the "my" object
            var myObject = GlobalObject.AddObject("my");

            //add property "name" to my, you should implemnt the getter/setter of name property by using PropertyGet/PropertySet events.
            var nameProp = myObject.AddDynamicProperty("name");

            nameProp.PropertyGet += (prop, args) =>
            {
                // getter - if js code "my.name" executes, it'll get the string "NanUI".
                args.Retval = CfrV8Value.CreateString("NanUI");
                args.SetReturnValue(true);
            };
            nameProp.PropertySet += (prop, args) =>
            {
                // setter's value from js context, here we do nothing, so it will store or igrone by your mind.
                var value = args.Value;
                args.SetReturnValue(true);
            };


            //add a function showCSharpMessageBox
            var showMessageBoxFunc = myObject.AddFunction("showCSharpMessageBox");

            showMessageBoxFunc.Execute += (func, args) =>
            {
                //it will be raised by js code "my.showCSharpMessageBox(`some text`)" executed.
                //get the first string argument in Arguments, it pass by js function.
                var stringArgument = args.Arguments.FirstOrDefault(p => p.IsString);

                if (stringArgument != null)
                {
                    MessageBox.Show(this, stringArgument.StringValue, "C# Messagebox", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            };

            //add a function getArrayFromCSharp, this function has an argument, it will combind C# string array with js array and return to js context.
            var friends = new string[] { "Mr.JSON", "Mr.Lee", "Mr.BONG" };

            var getArrayFromCSFunc = myObject.AddFunction("getArrayFromCSharp");

            getArrayFromCSFunc.Execute += (func, args) =>
            {
                var jsArray = args.Arguments.FirstOrDefault(p => p.IsArray);



                if (jsArray == null)
                {
                    jsArray = CfrV8Value.CreateArray(friends.Length);
                    for (int i = 0; i < friends.Length; i++)
                    {
                        jsArray.SetValue(i, CfrV8Value.CreateString(friends[i]));
                    }
                }
                else
                {
                    var newArray = CfrV8Value.CreateArray(jsArray.ArrayLength + friends.Length);

                    for (int i = 0; i < jsArray.ArrayLength; i++)
                    {
                        newArray.SetValue(i, jsArray.GetValue(i));
                    }

                    var jsArrayLength = jsArray.ArrayLength;

                    for (int i = 0; i < friends.Length; i++)
                    {
                        newArray.SetValue(i + jsArrayLength, CfrV8Value.CreateString(friends[i]));
                    }


                    jsArray = newArray;
                }


                //return the array to js context

                args.SetReturnValue(jsArray);

                //in js context, use code "my.getArrayFromCSharp()" will get an array like ["Mr.JSON", "Mr.Lee", "Mr.BONG"]
            };

            //add a function getObjectFromCSharp, this function has no arguments, but it will return a Object to js context.
            var getObjectFormCSFunc = myObject.AddFunction("getObjectFromCSharp");

            getObjectFormCSFunc.Execute += (func, args) =>
            {
                //create the CfrV8Value object and the accssor of this Object.
                var jsObjectAccessor = new CfrV8Accessor();
                var jsObject         = CfrV8Value.CreateObject(jsObjectAccessor);

                //create a CfrV8Value array
                var jsArray = CfrV8Value.CreateArray(friends.Length);

                for (int i = 0; i < friends.Length; i++)
                {
                    jsArray.SetValue(i, CfrV8Value.CreateString(friends[i]));
                }

                jsObject.SetValue("libName", CfrV8Value.CreateString("NanUI"), CfxV8PropertyAttribute.ReadOnly);
                jsObject.SetValue("friends", jsArray, CfxV8PropertyAttribute.DontDelete);


                args.SetReturnValue(jsObject);

                //in js context, use code "my.getObjectFromCSharp()" will get an object like { friends:["Mr.JSON", "Mr.Lee", "Mr.BONG"], libName:"NanUI" }
            };


            //add a function with callback

            var callbackTestFunc = GlobalObject.AddFunction("callbackTest");

            callbackTestFunc.Execute += (func, args) => {
                var callback = args.Arguments.FirstOrDefault(p => p.IsFunction);
                if (callback != null)
                {
                    var callbackArgs = CfrV8Value.CreateObject(new CfrV8Accessor());
                    callbackArgs.SetValue("success", CfrV8Value.CreateBool(true), CfxV8PropertyAttribute.ReadOnly);
                    callbackArgs.SetValue("text", CfrV8Value.CreateString("Message from C#"), CfxV8PropertyAttribute.ReadOnly);

                    callback.ExecuteFunction(null, new CfrV8Value[] { callbackArgs });
                }
            };


            //add a function with async callback
            var asyncCallbackTestFunc = GlobalObject.AddFunction("asyncCallbackTest");

            asyncCallbackTestFunc.Execute += async(func, args) => {
                //save current context
                var v8Context = CfrV8Context.GetCurrentContext();
                var callback  = args.Arguments.FirstOrDefault(p => p.IsFunction);

                //simulate async methods.
                await Task.Delay(5000);

                if (callback != null)
                {
                    //get render process context
                    var rc = callback.CreateRemoteCallContext();

                    //enter render process
                    rc.Enter();

                    //create render task
                    var task = new CfrTask();
                    task.Execute += (_, taskArgs) =>
                    {
                        //enter saved context
                        v8Context.Enter();

                        //create callback argument
                        var callbackArgs = CfrV8Value.CreateObject(new CfrV8Accessor());
                        callbackArgs.SetValue("success", CfrV8Value.CreateBool(true), CfxV8PropertyAttribute.ReadOnly);
                        callbackArgs.SetValue("text", CfrV8Value.CreateString("Message from C#"), CfxV8PropertyAttribute.ReadOnly);

                        //execute callback
                        callback.ExecuteFunction(null, new CfrV8Value[] { callbackArgs });


                        v8Context.Exit();

                        //lock task from gc
                        lock (task)
                        {
                            Monitor.PulseAll(task);
                        }
                    };

                    lock (task)
                    {
                        //post task to render process
                        v8Context.TaskRunner.PostTask(task);
                    }

                    rc.Exit();

                    GC.KeepAlive(task);
                }
            };
        }
Exemplo n.º 39
0
 private void QuitGame()
 {
     GlobalObject.QuitApp();
 }
Exemplo n.º 40
0
 public void StartBattle(GlobalObject _global)
 {
     global = _global;
     //Load("Custom Mountain");
     Generate();
     MyGame.Instance.battle = true;
 }
Exemplo n.º 41
0
        // 新增或编辑文章
        private string addOrEditArticle()
        {
            myJson my = new myJson();

            try
            {
                var articleId = Funcs.Get("articleId") == "" ? "0" : Funcs.Get("articleId"); //文章Id
                var title     = GlobalObject.unescape(Funcs.Get("title"));                   //标题
                var category  = Funcs.Get("category");                                       //文章类型
                var tags      = GlobalObject.unescape(Funcs.Get("tags"));                    //标签
                var isTop     = Funcs.Get("isTop");                                          //是否置顶
                var img       = Funcs.Get("img");                                            //图片
                var content   = GlobalObject.unescape(Funcs.Get("content"));                 //文章内容

                SqlParameter[] param = new SqlParameter[] {
                    new SqlParameter("@param_articleId", SqlDbType.Int)
                    {
                        Value = articleId
                    },
                    new SqlParameter("@param_title", SqlDbType.VarChar)
                    {
                        Value = title
                    },
                    new SqlParameter("@param_category", SqlDbType.VarChar)
                    {
                        Value = category
                    },
                    new SqlParameter("@param_tags", SqlDbType.VarChar)
                    {
                        Value = tags
                    },
                    new SqlParameter("@param_isTop", SqlDbType.Int)
                    {
                        Value = isTop
                    },
                    new SqlParameter("@param_img", SqlDbType.VarChar)
                    {
                        Value = img
                    },
                    new SqlParameter("@param_content", SqlDbType.Text)
                    {
                        Value = content
                    },
                    new SqlParameter("@param_userId", SqlDbType.Int)
                    {
                        Value = MySession.GetUserID()
                    }
                };

                Utility.SqlHelper.ExecProcNonQuery("sp_AddOrEditArticle", param);

                my.flag = 1;
                my.msg  = "保存成功!";
                return(JsonConvert.SerializeObject(my));
            }
            catch (Exception ex)
            {
                my.flag = 0;
                my.msg  = "保存失败:" + ex.Message;
                return(JsonConvert.SerializeObject(my));
            }
        }
Exemplo n.º 42
0
        protected void BindData()
        {
            int    hasSearch = 0;
            string key       = string.Empty;
            int    siteid    = Common.Util.GetPageParamsAndToInt("siteid");//受访网站编号

            if (siteid == -100)
            {
                return;
            }
            AdvAli.Entity.City city = KeyManage.GetCityFormsSearchEngines(out hasSearch, out key); //获取搜索引擎来的地域名.

            string ranglist = Logic.Consult.GetWebSiteCountryId(siteid);                           //受访网站的地域列表

            this.IpSearchLocal();                                                                  //分析IP数据
            int cityId = Logic.Consult.GetCityId(ipCountry);                                       //客户所在的地域编号

            HtmlCount.VisitAdd(siteid);                                                            //记数器
            if (Common.Util.HasString(ranglist, cityId.ToString(), new char[] { ',' }))            //判断客户所在的地域是否在受访网站选择的地域中.
            {
                citySelect = AdvAli.Logic.CitySelect.LocalDomainCity;
                Response.Clear();
                Response.Write("");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            else if (hasSearch == 2)  //判断客户是否通过搜索引擎进来,并且搜索引擎是否包含地域的关键字
            {
                cityId     = city.Id; //直接将地域转为搜索引擎包含的地域
                citySelect = AdvAli.Logic.CitySelect.SearchEngineCity;
            }
            else if (hasSearch == 1) //通过搜索引擎,但不包括地域关键字
            {
                //if (AdvAli.Keys.KeyManage.GetKeySite(key, cityId.ToString()))
                //    citySelect = AdvAli.Logic.CitySelect.SearchEngineKeyword;
                //else
                //    citySelect = AdvAli.Logic.CitySelect.LocalDomainCity;
                citySelect = AdvAli.Logic.CitySelect.SearchEngineKeyword;
            }
            else if (!Logic.Consult.CheckAllWebSiteCity(cityId)) //判断是否有网站选择了该地域,如果没有则转给受访网站
            {
                citySelect = AdvAli.Logic.CitySelect.LocalDomainCity;
                Response.Clear();
                Response.Write("");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            else //客户不在受访网站选择的地域,转给相关地域进行处理.
            {
                citySelect = AdvAli.Logic.CitySelect.IPCity;
            }


            int    adType = 0;
            int    adId   = 0;
            string urls   = "";
            object obj;

            if (citySelect == AdvAli.Logic.CitySelect.LocalDomainCity) //只显示受访网站的对话
            {
                AdvAli.Entity.Site site = Logic.Consult.GetWebSite(siteid);
                obj    = HtmlWebSite.GetAdvert(site.AdDisplay, site.AdId);
                adType = site.AdDisplay;
                adId   = site.AdId;
            }
            else if (citySelect == AdvAli.Logic.CitySelect.SearchEngineKeyword) //轮换显示搜索引擎关键词及地域所在网站的对话
            {
                siteid = Logic.Consult.GetAdKeyWebSiteId(key, cityId);
                AdvAli.Entity.Site site = Logic.Consult.GetWebSite(siteid);
                if (object.Equals(site, null)) //没有该地域没有任何对话,显示受访网站对话
                {
                    site   = Logic.Consult.GetWebSite(Common.Util.GetPageParamsAndToInt("siteid"));
                    siteid = site.Id;
                }
                adType = site.AdDisplay;
                adId   = site.AdId;
                obj    = HtmlWebSite.GetAdvert(adType, adId);
            }
            else if (cityId > 0) //根据客户地域,轮换显示不同网站对话 || 轮换显示搜索引擎包含地域所在的网站的对话
            {
                siteid = Logic.Consult.GetAdWebSiteId(cityId);
                AdvAli.Entity.Site site = Logic.Consult.GetWebSite(siteid);
                if (object.Equals(site, null)) //没有该地域没有任何对话,显示受访网站对话
                {
                    site   = Logic.Consult.GetWebSite(Common.Util.GetPageParamsAndToInt("siteid"));
                    siteid = site.Id;
                }
                adType = site.AdDisplay;
                adId   = site.AdId;
                obj    = HtmlWebSite.GetAdvert(adType, adId);
            }
            string scripts = "";

            //adType==0或adId==0即不正常的访问,
            if (adType == 0 || adId == 0)
            {
                return;
            }
            if (adType == 1)
            {
                urls = Config.Global.__WebSiteUrl + "website/getguidec.aspx?1=1";
            }
            if (adType == 2 || adType == 3)
            {
                QQMsn  q       = (QQMsn)HtmlWebSite.GetAdvert(adType, adId);
                string baseUrl = Config.Global.__WebSiteUrl + "website/previewQQ.aspx?";
                urls += "&isqq=" + (q.IsQQ ? "1" : "0");
                urls += "&qqhead=" + q.Header;
                urls += "&qqbottom=" + q.Bottom;
                string[] qqnum   = q.Account.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries);
                string[] qqs     = q.Notes.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries);
                string[] qqtitle = q.Namer.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < qqnum.Length; i++)
                {
                    urls += string.Format("&qqnum{0}={1}", i, qqnum[i]);
                    urls += string.Format("&qqs{0}={1}", i, qqs[i]);
                    urls += string.Format("&qqtitle{0}={1}", i, qqtitle[i]);
                }
                urls += "&qqn=" + qqnum.Length.ToString();
                urls  = baseUrl + urls;
            }
            if (adType == 4)
            {
                string baseUrl = Config.Global.__WebSiteUrl + "website/previewPicture.aspx?";
                Images i       = (Images)HtmlWebSite.GetAdvert(adType, adId);
                urls += "&width=" + i.Width.ToString() + "&height=" + i.Height.ToString();
                urls += "&picname=" + GlobalObject.escape(i.ImageName);
                urls += "&picurl=" + GlobalObject.escape(i.ImageUrl);
                urls += "&piclnk=" + GlobalObject.escape(i.ImageLink);
                urls  = baseUrl + urls;
            }
            if (adType == 5) //本地资源,默认访问
            {
                scripts = Logic.Consult.GetScripts(Common.Util.GetPageParamsAndToInt("siteid"));
            }
            else
            {
                WebClient webclient = new WebClient();
                byte[]    bytes     = webclient.DownloadData(urls + "&isscript=1&siteid=" + Common.Util.GetPageParamsAndToInt("siteid") + "&getsiteid=" + siteid);
                webclient.Dispose();
                scripts = Encoding.UTF8.GetString(bytes);
            }
            Response.Clear();
            Response.Write("var islocal=true;" + scripts);
            HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
Exemplo n.º 43
0
    public void StartDialog(Dialog d, GlobalObject g)
    {
        dialog = d;
        if (d.isUnique && d.happened) return;

        dialogNode = d.nodes["entry"];
        global = g;
        d.happened = true;
        MyGame.Instance.dialog = true;
    }
Exemplo n.º 44
0
 private void Awake()
 {
     Instance         = this;
     IsInitedRP.Value = true;
 }
Exemplo n.º 45
0
    void replace()
    {
        pieceinfo = GlobalObject.getpiece();
        pieceid   = GlobalObject.getpieceid();
        for (int i = 0; i < pieceinfo.GetLength(0); i++)
        {
            switch (pieceinfo [i, 0])
            {
            case "fu":
                if (pieceinfo [i, 3] == uid)
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(al_Fu, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(al_FuNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                else
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(en_Fu, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(en_FuNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                break;

            case "kyosha":
                if (pieceinfo [i, 3] == uid)
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(al_Kyosya, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(al_KyosyaNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                else
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(en_Kyosya, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(en_KyosyaNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                break;

            case "keima":
                if (pieceinfo [i, 3] == uid)
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(al_Keima, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(al_KeimaNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                else
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(en_Keima, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(en_KeimaNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                break;

            case "gin":
                if (pieceinfo [i, 3] == uid)
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(al_Gin, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(al_GinNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                else
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(en_Gin, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(en_GinNari, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                break;

            case "kin":
                if (pieceinfo [i, 3] == uid)
                {
                    createpiece(al_Kin, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                }
                else
                {
                    createpiece(en_Kin, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                }
                break;

            case "oh":
                if (pieceinfo [i, 3] == uid)
                {
                    createpiece(al_Ou, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                }
                else
                {
                    createpiece(en_Ou, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                }
                break;

            case "kaku":
                if (pieceinfo [i, 3] == uid)
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(al_Kaku, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(al_Uma, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                else
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(en_Kaku, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(en_Uma, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                break;

            case "hisha":
                if (pieceinfo [i, 3] == uid)
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(al_Hisya, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(al_Ryu, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                else
                {
                    if (pieceinfo [i, 4] == "False")
                    {
                        createpiece(en_Hisya, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                    else
                    {
                        createpiece(en_Ryu, float.Parse(pieceinfo [i, 1]), float.Parse(pieceinfo [i, 2]), pieceid[i]);
                    }
                }
                break;

            default:
                break;
            }
        }
    }
Exemplo n.º 46
0
        public Main()
            : base("http://res.app.local/index.html")
        {
            InitializeComponent();

            MainForm = this;

            LoadHandler.OnLoadEnd += HtmlLoadEnd;

            GlobalObject.AddFunction("ShowDevTools").Execute += (func, args) =>
            {
                this.RequireUIThread(() =>
                {
                    Chromium.ShowDevTools();
                });
            };

            GlobalObject.AddFunction("ChangeSerialConnection").Execute += (func, args) =>
            {
                this.RequireUIThread(() =>
                {
                    string portName = args.Arguments[0].StringValue;
                    if (SerialPortManager.Device.IsOpen)
                    {
                        SerialPortManager.Close();
                    }
                    else
                    {
                        SerialPortManager.Open(portName);
                    }
                    args.SetReturnValue(SerialPortManager.Device.IsOpen);
                });
            };

            GlobalObject.AddFunction("ChangeConnectionState").Execute += (func, args) =>
            {
                this.RequireUIThread(() =>
                {
                    bool state = args.Arguments[0].BoolValue;
                    if (state)
                    {
                        ConnectionManager.Start();
                    }
                    else
                    {
                        ConnectionManager.Stop();
                    }
                });
            };

            GlobalObject.AddFunction("ReconnectDevice").Execute += (func, args) =>
            {
                this.RequireUIThread(() =>
                {
                    ConnectionManager.Start();
                });
            };

            GlobalObject.AddFunction("RefreshClick").Execute += (func, args) =>
            {
                this.RequireUIThread(() =>
                {
                    bool ret = false;
                    try
                    {
                        DataManager.Params.Clear();
                        string deal = PortAgreement.ReadAllCard();
                        SerialPortManager.Write(deal);
                        OverTimer.start();

                        ret = true;
                    }
                    catch (Exception ex)
                    {
                        Log4Helper.ErrorInfo(ex.Message, ex);
                        JavascriptEvent.ErrorMessage(ex.Message);
                    }
                    args.SetReturnValue(ret);
                });
            };


            GlobalObject.AddFunction("DownloadClick").Execute += (func, args) =>
            {
                int count = DataManager.Params.Where(e => e.State != "设置成功" && e.DataType == "正常").Count();
                if (count == 0)
                {
                    args.SetReturnValue(count);
                    return;
                }
                this.RequireUIThread(() =>
                {
                    string strClientNumber = args.Arguments[0].StringValue;

                    Task.Factory.StartNew(() =>
                    {
                        foreach (Param item in DataManager.Params)
                        {
                            if (item.State != "设置成功" && item.DataType == "正常")
                            {
                                string deal = PortAgreement.WriteClientNumber(item.CardNumber, strClientNumber);
                                bool ret    = SerialPortManager.Write(deal);
                                if (ret)
                                {
                                    SerialPortManager.OperationResult = OperationResults.None;
                                    for (int i = 0; i < 500; i++)
                                    {
                                        Thread.Sleep(10);
                                        if (SerialPortManager.OperationResult != OperationResults.None)
                                        {
                                            if (SerialPortManager.OperationResult == OperationResults.Success)
                                            {
                                                item.State = "设置成功";

                                                DataManager.ViewListDisplay();
                                            }
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        JavascriptEvent.OperationOver();
                    });
                });
                args.SetReturnValue(-1);
            };

            GlobalObject.AddFunction("SetDeviceClient").Execute += (func, args) =>
            {
                this.RequireUIThread(() =>
                {
                    string strClientNumber = args.Arguments[0].StringValue;
                    string deal            = PortAgreement.EncryptionDevice(strClientNumber);
                    bool ret = SerialPortManager.Write(deal);
                    args.SetReturnValue(ret);
                });
            };

            GlobalObject.AddFunction("SetCardNumber").Execute += (func, args) =>
            {
                this.RequireUIThread(() =>
                {
                    string strOldNumber  = args.Arguments[0].StringValue;
                    string strCardNumber = args.Arguments[1].StringValue;
                    string strType       = args.Arguments[2].StringValue;
                    string deal          = PortAgreement.WriteCardNumber(strOldNumber, strCardNumber, strType);
                    bool ret             = SerialPortManager.Write(deal);
                    if (ret)
                    {
                        if (strCardNumber != "797979" || strCardNumber != "123456")
                        {
                            ConfigManager.SetConfig("Number", strCardNumber);
                        }
                    }
                    args.SetReturnValue(ret);
                });
            };
        }
Exemplo n.º 47
0
 // Use this for initialization
 void Start()
 {
     uid = GlobalObject.getuserid();
     Invoke("replace", 0.4f);
 }
        private string obtenerRecursos(string sAp1, string sAp2, string sNombre)
        {
            string        sResul     = "";
            StringBuilder strBuilder = new StringBuilder();
            int           i          = 0;

            strBuilder.Append("<table id='tblDatos' class='texto' style='width: 396px; BORDER-COLLAPSE: collapse;' cellSpacing='0' border='0'>");
            strBuilder.Append("<colgroup><col style='width:40px;' /><col style='width:340px;' /></colgroup>");

            try
            {
                SqlDataReader dr = Recursos.CargarRecursos(GlobalObject.unescape(sAp1), GlobalObject.unescape(sAp2), GlobalObject.unescape(sNombre), 1, 0);

                while (dr.Read())
                {
                    if (i % 2 == 0)
                    {
                        strBuilder.Append("<tr class=FA ");
                    }
                    else
                    {
                        strBuilder.Append("<tr class=FB ");
                    }

                    strBuilder.Append("id='" + dr["T001_IDFICEPI"].ToString() + "' codred='" + dr["T001_CODRED"].ToString() + "' onclick=\"ms(this)\" ondblclick=\"aceptarClick(this.rowIndex)\" onmouseover=TTip(event);>");

                    strBuilder.Append("<td style='text-align:right;padding-right:5px;'>" + dr["T001_IDFICEPI"].ToString() + "</td><td><nobr style='width:340px;' class='NBR'>" + dr["TECNICO"].ToString() + "</nobr></td>");

                    strBuilder.Append("</tr>");
                    i++;
                }
                dr.Close();
                dr.Dispose();

                strBuilder.Append("</table>");
                sResul = "OK@@" + strBuilder.ToString();
            }
            catch (Exception ex)
            {
                sResul = "Error@@" + ex.ToString();
            }
            return(sResul);
        }
Exemplo n.º 49
0
    public void InitializeWindow(GUIProperties properties)
    {
        this._properties = properties;
        events = GUIEventManager.Instance;
        _game = GlobalObject.Instance;

        textBoxStyle = new GUIStyle(_properties.UserInterface.label);
        buttonStyle = new GUIStyle(_properties.UserInterface.button);

        menuTexture = _properties.UserInterface.window.normal.background;
        windowHeaderTexture = _properties.UserInterface.label.normal.background;
        menuButtonTexture = _properties.UserInterface.button.normal.background;

        for (int i = 0; i < _properties.BTNButtonTexturesArray.Length; i++)
        {
            BTNButtonTexturesArray[i] = _properties.BTNButtonTexturesArray[i];
            _WeaponTitlesArray[i] = _properties.WeaponTitlesArray[i];
        }
        for (int i = 0; i < _properties.DBTNButtonTexturesArray.Length; i++)
        {
            DBTNButtonTexturesArray[i] = _properties.DBTNButtonTexturesArray[i];
        }

        RecalculateRect();
    }
Exemplo n.º 50
0
        public string EndPatientCare(string exitDate, int exitReason, string facilityOutTransfer, string dateOfDeath, string careEndingNotes)
        {
            try
            {
                DateTime?emptyDateOfDeath = null;

                PatientCareEndingManager careEndingManager    = new PatientCareEndingManager();
                PatientEnrollmentManager enrollmentManager    = new PatientEnrollmentManager();
                PatientLookupManager     patientLookupManager = new PatientLookupManager();



                patientId            = int.Parse(Session["PatientPK"].ToString());
                patientMasterVisitId = int.Parse(Session["PatientMasterVisitId"].ToString());
                var enrollments = enrollmentManager.GetPatientEnrollmentByPatientId(patientId);
                if (enrollments.Count > 0)
                {
                    patientEnrollmentId = enrollments[0].Id;
                }

                var patient = patientLookupManager.GetPatientDetailSummary(patientId);

                if (patientEnrollmentId > 0)
                {
                    if (!String.IsNullOrWhiteSpace(facilityOutTransfer))
                    {
                        careEndingManager.AddPatientCareEndingTransferOut(patientId, patientMasterVisitId,
                                                                          patientEnrollmentId,
                                                                          exitReason, DateTime.Parse(exitDate), GlobalObject.unescape(facilityOutTransfer),
                                                                          GlobalObject.unescape(careEndingNotes));
                    }
                    else if (String.IsNullOrWhiteSpace(facilityOutTransfer) && String.IsNullOrWhiteSpace(dateOfDeath))
                    {
                        careEndingManager.AddPatientCareEndingOther(patientId, patientMasterVisitId,
                                                                    patientEnrollmentId,
                                                                    exitReason, DateTime.Parse(exitDate), GlobalObject.unescape(careEndingNotes));
                    }
                    else
                    {
                        careEndingManager.AddPatientCareEndingDeath(patientId, patientMasterVisitId, patientEnrollmentId,
                                                                    exitReason, DateTime.Parse(exitDate), (string.IsNullOrEmpty(dateOfDeath))?DateTime.Parse(dateOfDeath):emptyDateOfDeath, GlobalObject.unescape(careEndingNotes));
                    }



                    PatientEntityEnrollment entityEnrollment =
                        enrollmentManager.GetPatientEntityEnrollment(patientEnrollmentId);
                    entityEnrollment.CareEnded = true;
                    enrollmentManager.updatePatientEnrollment(entityEnrollment);
                    Session["EncounterStatusId"] = 0;
                    Session["PatientEditId"]     = 0;
                    Session["PatientPK"]         = 0;
                    Msg = "Patient has been successfully care ended";
                    MessageEventArgs args = new MessageEventArgs()
                    {
                        PatientId     = patientId,
                        EntityId      = patientEnrollmentId,
                        MessageType   = MessageType.UpdatedClientInformation,
                        EventOccurred = "Patient CareEnded Identifier = ",
                        FacilityId    = patient.FacilityId
                    };
                    Publisher.RaiseEventAsync(this, args).ConfigureAwait(false);
                }
                else
                {
                    SoapException b = new SoapException();
                    SoapException e = (SoapException)Activator.CreateInstance(b.GetType(), "Patient is already care ended", b);
                    Msg = e.Message;
                }
            }
            catch (SoapException e)
            {
                Msg = e.Message;
            }
            return(Msg);
        }
Exemplo n.º 51
0
		//-------------------------------------------------------------------------------------
		#region << Methods >>
		/// <summary>
		/// Возвращает true, если объект заглушен, false - если зарегистрирован
		/// </summary>
		/// <param name="obj"></param>
		/// <param name="cox"></param>
		/// <param name="typeid"></param>
		/// <param name="objid"></param>
		/// <returns></returns>
		private static bool StubGOLObject(GlobalObject obj, SerContext cox, ushort typeid, uint objid)
		{
			if(cox.asEmptyTypes.Contains(obj.GetType()) || cox.asEmptyObjects.Contains(obj))
			{
				#region
				SerObjectInfo si = new SerObjectInfo();
				si.typeID = (ushort)InfraTypes.PulsarEmptyStub;
				si.objID = objid;
				si.fields = new List<SerFieldInfo>(1);

				SerFieldInfo fsi = new SerFieldInfo();
				fsi.typeID = typeid;
				si.fields.Add(fsi);

				if(obj is GlobalObject)
				{
					fsi = new SerFieldInfo();
					fsi.typeID = (ushort)PrimitiveTypes.OID;
					fsi.name = "oid";
					fsi.value = ToBytes(((GlobalObject)obj).OID);
					si.fields.Add(fsi);
				}

				si.Save(cox.stream);
				#endregion 
				return true;
			}

			bool noStub = cox.noStubObjects.Contains(obj);
			if(noStub == false && cox.noStubTypes.Count > 0)
			{
			 Type t = obj.GetType();
				while(t != null)
				 if((noStub = cox.noStubTypes.Contains(t)) == true)
					 break;
					else
					 t = t.BaseType;
			}


			if(typeid == 0)
				typeid = cox.types.GetTypeID(obj.GetType());
			if(objid == 0)
				objid = cox.objs.GetObjID(typeid, obj);

			if(noStub)
			{
				cox.stream.WriteUInt16((ushort)InfraTypes.GOLObjectRegistrator);
				if(Pulsar.Server.ServerParamsBase.IsServer == false && GOL.Contains(obj) == false)
				 GOL.Add(obj);
			}
			else
				cox.stream.WriteUInt16((ushort)InfraTypes.GOLObjectStub);

			cox.stream.WriteUInt16(typeid);
			cox.stream.WriteUInt32(objid);
			cox.stream.WriteBytes(ToBytes(obj.OID));
			if(noStub)
			{
			 if(((IReadWriteLockObject)obj).IsLocked == false)
			  ((IReadWriteLockObject)obj).BeginRead();
				cox.stack.Push(obj);
			}
			return !noStub;
		}
Exemplo n.º 52
0
 // Use this for initialization
 void Start()
 {
     uid = GlobalObject.getuserid();
     StartCoroutine(delayturnchange(0.3f));
 }
Exemplo n.º 53
0
Arquivo: World.cs Projeto: mxgmn/GENW
    public void Load()
    {
        Log.Write("loading the world... ");
        XmlNode xnode = MyXml.SecondChild("Data/world.xml");
        Log.Assert(xnode.Name == "map", "wrong world file format");

        int width = MyXml.GetInt(xnode, "width");
        int height = MyXml.GetInt(xnode, "height");
        map.margin.x = MyXml.GetInt(xnode, "vMargin");
        map.margin.y = MyXml.GetInt(xnode, "hMargin");
        string method = MyXml.GetString(xnode, "method");

        map.Load(width, height, method);

        xnode = xnode.NextSibling;
        camera = new ZPoint(MyXml.GetInt(xnode, "x"), MyXml.GetInt(xnode, "y"));

        player = new Player();
        player.SetPosition(camera, 0.01f);
        player.UpdateVisitedLocations();

        for (xnode = xnode.NextSibling.FirstChild; xnode != null; xnode = xnode.NextSibling)
        {
            GlobalObject o = new GlobalObject(BigBase.Instance.gShapes.Get(MyXml.GetString(xnode, "name")));
            o.uniqueName = MyXml.GetString(xnode, "uniqueName");

            string dialogName = MyXml.GetString(xnode, "dialog");
            if (dialogName != "") o.dialog = BigBase.Instance.dialogs.Get(dialogName);

            o.SetPosition(new HexPoint(MyXml.GetInt(xnode, "x"), MyXml.GetInt(xnode, "y")), 0.01f);

            for (XmlNode xitem = xnode.FirstChild; xitem != null; xitem = xitem.NextSibling)
                o.inventory.Add(new Item(MyXml.GetString(xitem, "name"), MyXml.GetInt(xitem, "amount", 1)));

            gObjects.Add(o);
        }

        Log.WriteLine("OK");
    }
Exemplo n.º 54
0
        public Engine(Action <Options> options)
        {
            _executionContexts = new Stack <ExecutionContext>();

            Global = GlobalObject.CreateGlobalObject(this);

            Object   = ObjectConstructor.CreateObjectConstructor(this);
            Function = FunctionConstructor.CreateFunctionConstructor(this);

            Array   = ArrayConstructor.CreateArrayConstructor(this);
            String  = StringConstructor.CreateStringConstructor(this);
            RegExp  = RegExpConstructor.CreateRegExpConstructor(this);
            Number  = NumberConstructor.CreateNumberConstructor(this);
            Boolean = BooleanConstructor.CreateBooleanConstructor(this);
            Date    = DateConstructor.CreateDateConstructor(this);
            Math    = MathInstance.CreateMathObject(this);
            Json    = JsonInstance.CreateJsonObject(this);

            Error          = ErrorConstructor.CreateErrorConstructor(this, "Error");
            EvalError      = ErrorConstructor.CreateErrorConstructor(this, "EvalError");
            RangeError     = ErrorConstructor.CreateErrorConstructor(this, "RangeError");
            ReferenceError = ErrorConstructor.CreateErrorConstructor(this, "ReferenceError");
            SyntaxError    = ErrorConstructor.CreateErrorConstructor(this, "SyntaxError");
            TypeError      = ErrorConstructor.CreateErrorConstructor(this, "TypeError");
            UriError       = ErrorConstructor.CreateErrorConstructor(this, "URIError");

            // Because the properties might need some of the built-in object
            // their configuration is delayed to a later step

            Global.Configure();

            Object.Configure();
            Object.PrototypeObject.Configure();

            Function.Configure();
            Function.PrototypeObject.Configure();

            Array.Configure();
            Array.PrototypeObject.Configure();

            String.Configure();
            String.PrototypeObject.Configure();

            RegExp.Configure();
            RegExp.PrototypeObject.Configure();

            Number.Configure();
            Number.PrototypeObject.Configure();

            Boolean.Configure();
            Boolean.PrototypeObject.Configure();

            Date.Configure();
            Date.PrototypeObject.Configure();

            Math.Configure();
            Json.Configure();

            Error.Configure();
            Error.PrototypeObject.Configure();

            // create the global environment http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.3
            GlobalEnvironment = LexicalEnvironment.NewObjectEnvironment(this, Global, null, false);

            // create the global execution context http://www.ecma-international.org/ecma-262/5.1/#sec-10.4.1.1
            EnterExecutionContext(GlobalEnvironment, GlobalEnvironment, Global);

            Options = new Options();

            if (options != null)
            {
                options(Options);
            }

            Eval = new EvalFunctionInstance(this, new string[0], LexicalEnvironment.NewDeclarativeEnvironment(this, ExecutionContext.LexicalEnvironment), StrictModeScope.IsStrictModeCode);
            Global.FastAddProperty("eval", Eval, true, false, true);

            _statements  = new StatementInterpreter(this);
            _expressions = new ExpressionInterpreter(this);

            if (Options._IsClrAllowed)
            {
                Global.FastAddProperty("System", new NamespaceReference(this, "System"), false, false, false);
                Global.FastAddProperty("importNamespace", new ClrFunctionInstance(this, (thisObj, arguments) =>
                {
                    return(new NamespaceReference(this, TypeConverter.ToString(arguments.At(0))));
                }), false, false, false);
            }

            ClrTypeConverter = new DefaultTypeConverter(this);
            BreakPoints      = new List <BreakPoint>();
            DebugHandler     = new DebugHandler(this);
        }
Exemplo n.º 55
0
Arquivo: Player.cs Projeto: mxgmn/GENW
 public override void ProcessCollisions(GlobalObject g)
 {
     if (g.dialog != null) M.dialogScreen.StartDialog(g.dialog, g);
 }
Exemplo n.º 56
0
        protected void InitializeChromium(string initialUrl)
        {
            if (string.IsNullOrEmpty(initialUrl))
            {
                this.browser = new ChromiumBrowser();
            }
            else
            {
                this.browser = new ChromiumBrowser(initialUrl);
            }
            this.browser.Dock = System.Windows.Forms.DockStyle.Fill;
            this.browser.RemoteCallbackInvokeMode = JSInvokeMode.Inherit;
            this.Controls.Add(this.browser);

            BrowserHandle = browser.Handle;


            browser.BrowserCreated += (sender, args) =>
            {
                AttachInterceptorToChromiumBrowser();
            };


            LifeSpanHandler.OnBeforePopup += (sender, args) =>
            {
            };

            DragHandler.OnDraggableRegionsChanged += (sender, args) =>
            {
                var regions = args.Regions;

                if (regions.Length > 0)
                {
                    foreach (var region in regions)
                    {
                        var rect = new Rectangle(region.Bounds.X, region.Bounds.Y, region.Bounds.Width, region.Bounds.Height);

                        if (draggableRegion == null)
                        {
                            draggableRegion = new Region(rect);
                        }
                        else
                        {
                            if (region.Draggable)
                            {
                                draggableRegion.Union(rect);
                            }
                            else
                            {
                                draggableRegion.Exclude(rect);
                            }
                        }
                    }
                }
            };

            DragHandler.OnDragEnter += (s, e) =>
            {
                // 禁止往窗口上拖东西
                e.SetReturnValue(true);
            };

            LoadHandler.OnLoadEnd += (sender, args) =>
            {
                HideInitialSplash();
            };

            LoadHandler.OnLoadError += (sender, args) =>
            {
                HideInitialSplash();
            };


            GlobalObject.Add("NanUI", new JsHostWindowObject(this));
        }
Exemplo n.º 57
0
 public void FillInForm(string Expression)
 {
     this.mainfrm.DisplayProgress("Filling Forms...");
     Expression = Expression.Replace("&amp;", "&");
     Expression = HttpUtility.UrlDecode(Expression, this.mainfrm.CurrentSite.WebEncoding);
     foreach (string str in Expression.Split(new char[] { '&' }))
     {
         string[] paraNameValue = WebSite.GetParaNameValue(str, '=');
         try
         {
             this.WCRBrowser.Document.All[paraNameValue[0]].SetAttribute("value", GlobalObject.unescape(paraNameValue[1]));
         }
         catch
         {
         }
         HtmlWindowCollection frames = this.WCRBrowser.Document.Window.Frames;
         for (int i = 0; i < frames.Count; i++)
         {
             try
             {
                 this.WCRBrowser.Document.Window.Frames[i].Document.All[paraNameValue[0]].SetAttribute("value", GlobalObject.unescape(paraNameValue[1]));
             }
             catch
             {
             }
         }
     }
     this.mainfrm.DisplayProgress("Done");
 }
Exemplo n.º 58
0
        /// <summary>
        /// Constructs a new engine instance and allows customizing options.
        /// </summary>
        /// <remarks>The provided engine instance in callback is not guaranteed to be fully configured</remarks>
        public Engine(Action <Engine, Options> options)
        {
            _executionContexts = new ExecutionContextStack(2);

            Global = GlobalObject.CreateGlobalObject(this);

            Object   = ObjectConstructor.CreateObjectConstructor(this);
            Function = FunctionConstructor.CreateFunctionConstructor(this);
            _callerCalleeArgumentsThrowerConfigurable    = new GetSetPropertyDescriptor.ThrowerPropertyDescriptor(this, PropertyFlag.Configurable | PropertyFlag.CustomJsValue, "'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them");
            _callerCalleeArgumentsThrowerNonConfigurable = new GetSetPropertyDescriptor.ThrowerPropertyDescriptor(this, PropertyFlag.CustomJsValue, "'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them");

            Symbol   = SymbolConstructor.CreateSymbolConstructor(this);
            Array    = ArrayConstructor.CreateArrayConstructor(this);
            Map      = MapConstructor.CreateMapConstructor(this);
            Set      = SetConstructor.CreateSetConstructor(this);
            Iterator = IteratorConstructor.CreateIteratorConstructor(this);
            String   = StringConstructor.CreateStringConstructor(this);
            RegExp   = RegExpConstructor.CreateRegExpConstructor(this);
            Number   = NumberConstructor.CreateNumberConstructor(this);
            Boolean  = BooleanConstructor.CreateBooleanConstructor(this);
            Date     = DateConstructor.CreateDateConstructor(this);
            Math     = MathInstance.CreateMathObject(this);
            Json     = JsonInstance.CreateJsonObject(this);
            Proxy    = ProxyConstructor.CreateProxyConstructor(this);
            Reflect  = ReflectInstance.CreateReflectObject(this);

            GlobalSymbolRegistry = new GlobalSymbolRegistry();

            // Because the properties might need some of the built-in object
            // their configuration is delayed to a later step

            // trigger initialization
            Global.GetProperty(JsString.Empty);

            // this is implementation dependent, and only to pass some unit tests
            Global._prototype = Object.PrototypeObject;
            Object._prototype = Function.PrototypeObject;

            // create the global environment http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.3
            GlobalEnvironment = LexicalEnvironment.NewGlobalEnvironment(this, Global);

            // create the global execution context http://www.ecma-international.org/ecma-262/5.1/#sec-10.4.1.1
            EnterExecutionContext(GlobalEnvironment, GlobalEnvironment);

            Eval = new EvalFunctionInstance(this);
            Global.SetProperty(CommonProperties.Eval, new PropertyDescriptor(Eval, PropertyFlag.Configurable | PropertyFlag.Writable));

            Options = new Options();

            options?.Invoke(this, Options);

            // gather some options as fields for faster checks
            _isDebugMode       = Options.IsDebugMode;
            _isStrict          = Options.IsStrict;
            _constraints       = Options._Constraints;
            _referenceResolver = Options.ReferenceResolver;

            _referencePool         = new ReferencePool();
            _argumentsInstancePool = new ArgumentsInstancePool(this);
            _jsValueArrayPool      = new JsValueArrayPool();

            if (Options._IsClrAllowed)
            {
                Global.SetProperty("System", new PropertyDescriptor(new NamespaceReference(this, "System"), PropertyFlag.AllForbidden));
                Global.SetProperty("importNamespace", new PropertyDescriptor(new ClrFunctionInstance(
                                                                                 this,
                                                                                 "importNamespace",
                                                                                 (thisObj, arguments) => new NamespaceReference(this, TypeConverter.ToString(arguments.At(0)))), PropertyFlag.AllForbidden));
            }

            ClrTypeConverter = new DefaultTypeConverter(this);
        }