Beispiel #1
0
        public ApiResult <Object> Validate(InputScript configuration)
        {
            var cmd = new ValidateInputScript(scriptProvider, configuration);

            cmd.Execute();
            return(cmd.Result);
        }
Beispiel #2
0
        public ApiResult <Object> Remove(InputScript configuration)
        {
            var cmd = new RemoveInputScript(scriptProvider, storageProvider, configuration);

            cmd.Execute();
            return(cmd.Result);
        }
Beispiel #3
0
        public void AddOrUpdate(InputScript script, bool createContext = false)
        {
            lock (scripts)
            {
                var index = scripts.IndexOf(script);
                if (index > -1)
                {
                    var ctx = GetContext(scripts[index]);
                    if (ctx != null)
                    {
                        RemoveContext(ctx);
                        ctx.Dispose();
                    }

                    scripts[index] = script;
                    Create(script);
                }
                else
                {
                    scripts.Add(script);
                    if (createContext)
                    {
                        Create(script);
                    }
                }
            }
        }
Beispiel #4
0
        public override string ToString()
        {
            if (string.IsNullOrWhiteSpace(InputScript))
            {
                return(string.Empty);
            }
            if (InputScript.ToUpper().Contains("EXEC"))
            {
                return(InputScript);
            }

            // Check for a new line in the script
            int lastSelect = InputScript.LastIndexOf("SELECT", StringComparison.Ordinal);

            // if there is no new line, return the whole input script
            if (lastSelect == -1)
            {
                return(InputScript);
            }

            var finalSelect = InputScript.Substring(lastSelect);

            Regex trimmer = new Regex(@"\s\s+");

            return(trimmer.Replace(finalSelect, " "));
            // else
        }
Beispiel #5
0
 public void Initialize(bool t_playerControl)
 {
     //GameManager.Instance.LoadStats();
     //Initialize edges points collider;
     edgeCollider           = transform.GetChild(0).GetChild(0).GetComponent <EdgeCollider2D>();
     normalCollidersPoints  = new Vector2[4];
     jumpingCollidersPoints = new Vector2[4];
     //Debug.Log();
     for (int i = 0; i < edgeCollider.pointCount; i++)
     {
         normalCollidersPoints[i]  = edgeCollider.points[i];
         jumpingCollidersPoints[i] = normalCollidersPoints[i];
     }
     jumpingCollidersPoints[1] = new Vector2(0.3f, -0.45f);
     jumpingCollidersPoints[2] = new Vector2(-0.55f, -0.98f);
     playerControl             = t_playerControl;
     colliders     = transform.GetChild(0).gameObject;
     inputScript   = new InputScript();
     axisXY        = new float[2];
     movementState = new bool[10];
     inAirSpeed    = 0.5f; // FIX
     if (t_playerControl)
     {
         playerColor = new List <SpriteRenderer>();
         PlayerBodyColor();
         for (int i = 0; i < _timedGlitches.Length; i++)
         {
             _timedGlitches[i] = new bool();
             _timedGlitches[i] = false;
         }
     }
     ReInitialize(GameManager.Instance.myList);
 }
Beispiel #6
0
    private void Start()
    {
        input = GameManager.instance.input;

        if (canvas.worldCamera == null)
        {
            canvas.worldCamera = Camera.main;
        }

        if (!staticText)
        {
            int pos = Random.Range(0, 5);

            switch (pos)
            {
            case 0:
                offset = new Vector3(0.5f, 0, 0.5f);
                return;

            case 1:
                offset = new Vector3(-0.5f, 0, 0.5f);
                return;

            case 2:
                offset = new Vector3(-0.5f, 0, -0.5f);
                return;

            case 3:
                offset = new Vector3(0.5f, 0, -0.5f);
                return;
            }
        }
    }
        public void SaveScript_ThrowsIfScriptsFolderDoesNotExist()
        {
            var s = new InputScript();

            fileSystemUtilsMock.Setup(f => f.DirectoryExists(It.IsAny <string>())).Returns(false);
            provider.SaveScript(s);
        }
Beispiel #8
0
        public async Task <ApiResult <Object> > Save(InputScript configuration)
        {
            var cmd = new SaveInputScript(storageProvider, scriptProvider, configuration);
            await cmd.Execute();

            return(cmd.Result);
        }
    void OnTouchStart()
    {
        if (gameplayScript.IsGameOver)
        {
            return;
        }

        Vector2 pos = InputScript.GetTouchPositionWorldSpace();

        RaycastHit2D[] hits = Physics2D.RaycastAll(pos, Vector2.zero);

        for (int i = 0; i < hits.Length; i++)
        {
            possibleCurrentPick[i] = hits[i].collider.GetComponent <Lane>();
        }

        bMouseCoordsOnClick = true;
        vMouseCoordsOnClick = pos;

        bMouseCoordsNow = true;
        vMouseCoordsNow = pos;

        currentPick = null;

        touchPoint.transform.position = new Vector3(pos.x, pos.y, 0.0f);
        touchPoint.SetActive(true);
    }
Beispiel #10
0
    // Use this for initialization
    void Start()
    {
        ty            = GameObject.Find("Ty");
        anim          = ty.GetComponent <Animator>();
        talkingScript = GetComponentInChildren <Text>();
        curState      = WAIT_SERVER_RESPONSE;
        lastState     = WAIT_SERVER_RESPONSE;

        touchScreenKeyboard = TouchScreenKeyboard.Open(string.Empty, TouchScreenKeyboardType.Default);

        // For blackboard text.
        text = GameObject.Find("Text");
        ts   = text.GetComponent <textScript> ();

        //For input text.
        GameObject inputObject = GameObject.Find("InputField");

        ist = inputObject.GetComponent <InputScript> ();

//		// For submit button.
//		btn = GameObject.Find("Button");
//		submitBtn = btn.GetComponent<Button> ();
//		submitBtn.onClick.AddListener(TaskOnClick);


        StartCoroutine("startLogics");
    }
Beispiel #11
0
 public IScriptContext GetContext(InputScript script)
 {
     lock (contexts)
     {
         return(contexts.FirstOrDefault(s => s.Script.Equals(script)));
     }
 }
Beispiel #12
0
 protected void CreateSourceFilesDirectoryIfNotExists(InputScript s)
 {
     if (!HasSourceFilesDirectory(s))
     {
         CreateSourceFilesDirectory(s);
     }
 }
Beispiel #13
0
        public void SaveScriptSource(InputScript script, string fileName, string source)
        {
            var scriptsPath = AppConfigProvider.AppConfig.ScriptsFolder;
            var sourcePath  = Path.Combine(scriptsPath, script.Name, fileName);

            FileSystemUtils.SaveStringToDisk(source, sourcePath);
        }
Beispiel #14
0
 private void Start()
 {
     resultPanel.SetActive(false);
     resultList.SetActive(false);
     searchPanel.SetActive(true);
     contentRect = contentField.GetComponent <RectTransform>();
     IS          = GameObject.Find("Main Camera").GetComponent <InputScript>();
 }
Beispiel #15
0
 public void SetInput(InputScript input)
 {
     inputScript = input;
     if (input)
     {
         TakeInput();
     }
 }
 void Start()
 {
     playerScript  = GetComponent <PlayerScript>();
     inputScript   = GetComponent <InputScript>();
     gunScript     = transform.GetComponentInChildren <GunScript>();
     grappleScript = transform.GetComponentInChildren <GrappleScript>();
     xRotation     = 0f;
 }
Beispiel #17
0
        public void Setup()
        {
            scriptProviderMock = new Mock <IScriptProvider>();
            scriptProviderMock.Setup(s => s.Scripts).Returns(Scripts);
            scriptProvider = scriptProviderMock.Object;

            toMatch = TestFactory.CreateTestInputScript();
        }
Beispiel #18
0
 void Awake()
 {
     groundCheck    = transform.GetComponent <PlayerGroundCheck>();
     inventory      = transform.GetComponent <ItemInventory>();
     inputScript    = transform.GetComponent <InputScript>();
     rigidbody      = transform.GetComponent <Rigidbody2D>();
     topCollider    = transform.GetComponent <BoxCollider2D>();
     spriteAnimator = transform.GetComponent <SpriteAnimator>();
 }
Beispiel #19
0
 public IScriptContext Create(InputScript script)
 {
     lock (contexts)
     {
         var ctx = new JintScriptingContext(script);
         contexts.Add(ctx);
         return(ctx);
     }
 }
Beispiel #20
0
    public void SetManager(ManageGame m)
    {
        mgmt  = m;
        phys  = m.GetPhysics();
        input = m.input;

        rb.gravityScale = phys.dinogravityscale;
        rb.mass         = phys.dinomass;
    }
Beispiel #21
0
 // Use this for initialization
 void Start()
 {
     sound     = GameObject.Find("Main Camera").GetComponent <SoundPlayer>();
     inventory = GetComponent <PlayerInventory> ();
     input     = GetComponent <InputScript> ();
     PMS       = GetComponent <PlayerMovementScript> ();
     input.assignXButton(UseItem, null);
     input.assignAButton(Attack, null);
 }
Beispiel #22
0
    void stage4()
    {
        if (currentTarget == "heartTrigger")
        {
            nextStage();

            compressionGame         = GameObject.FindGameObjectWithTag("patient").GetComponent <InputScript>();
            compressionGame.started = true;
        }
    }
Beispiel #23
0
        public void RemoveScript(InputScript s)
        {
            var path = AppConfigProvider.AppConfig.ScriptsFolder;

            if (!FileSystemUtils.DirectoryExists(path))
            {
                throw new Exception("Directory does not exist");
            }
            FileSystemUtils.RemoveFile(Path.Combine(path, s.FileName));
        }
 //SpriteAnimator spriteAnimator;
 // Use this for initialization
 void Awake()
 {
     //spriteAnimator = GetComponent<SpriteAnimator> ();
     //state = GetComponent<PlayerStateMachine> ();
     IS = GetComponent <InputScript> ();
     RB = GetComponent <Rigidbody2D> ();
     //	state = GetComponent<PlayerStateMachine> ();
     IS.SetThumbstick(ProcessMovement);
     ResetSpeed();
 }
Beispiel #25
0
        private void UpdateScriptDirectory(InputScript n, InputScript o)
        {
            var path          = AppConfigProvider.AppConfig.ScriptsFolder;
            var oldFolderPath = Path.Combine(path, o.Name);
            var newFolderPath = Path.Combine(path, n.Name);

            if (!FileSystemUtils.DirectoryExists(newFolderPath) && FileSystemUtils.DirectoryExists(oldFolderPath))
            {
                FileSystemUtils.MoveDirectory(oldFolderPath, newFolderPath);
            }
        }
Beispiel #26
0
 private void Start()
 {
     uiManager   = FindObjectOfType <UIManager>();
     inputScript = FindObjectOfType <InputScript>();
     //path = Application.persistentDataPath + "/node.json";
     path = Path.Combine(Application.streamingAssetsPath, "node.json");
     Debug.Log(path);
     //Debug.Log(AssetDatabase.GetAssetPath(nodeJson));
     //Debug.Log("DP" + Application.dataPath);
     load();
 }
Beispiel #27
0
 private void CreatePlaceholderSourceFiles(InputScript s)
 {
     foreach (var sourceName in s.SourceFileNames)
     {
         var path = Path.Combine(AppConfigProvider.AppConfig.ScriptsFolder, s.Name, sourceName);
         if (!FileSystemUtils.FileExists(path))
         {
             FileSystemUtils.SaveStringToDisk("// Code away!!", path);
         }
     }
 }
Beispiel #28
0
 // Use this for initialization
 void Start()
 {
     if (Application.platform == RuntimePlatform.Android | Application.platform == RuntimePlatform.IPhonePlayer)
     {
         input = new TouchInputScript();
     }
     else
     {
         input = new MouseInputScript();
     }
 }
Beispiel #29
0
        public void SaveScript(InputScript s)
        {
            var path = AppConfigProvider.AppConfig.ScriptsFolder;

            if (!FileSystemUtils.DirectoryExists(path))
            {
                throw new Exception("Directory does not exist");
            }
            FileSystemUtils.SaveObjectToDisk(s, Path.Combine(path, s.FileName));
            CreateSourceFilesDirectoryIfNotExists(s);
            CreatePlaceholderSourceFiles(s);
        }
Beispiel #30
0
        private void UpdateScriptFile(InputScript n, InputScript o)
        {
            var path          = AppConfigProvider.AppConfig.ScriptsFolder;
            var oldScriptPath = Path.Combine(path, o.FileName);
            var newScriptPath = Path.Combine(path, n.FileName);

            if (!FileSystemUtils.FileExists(newScriptPath) && FileSystemUtils.FileExists(oldScriptPath))
            {
                FileSystemUtils.MoveFile(oldScriptPath, newScriptPath);
            }
            FileSystemUtils.SaveObjectToDisk(n, newScriptPath);
        }
Beispiel #31
0
    //ObjectPoolScript SwingEffectPool;


    // Use this for initializationswing
    void Awake()
    {
        groundMask       = 1 << 8;
        playerGroundMask = 1 << 9;         // maybe nine maybe just a number

        IS = GetComponent <InputScript> ();
        SR = GetComponent <SpriteRenderer> ();
        SS = GameObject.Find("ScoreObject").GetComponent <ScoreScript>();
        SS.AddPlayer(gameObject);
        SPS = GameObject.Find("SoundObject").GetComponent <SoundPlayerScript> ();
        //SwingEffectPool = GameObject.Find ("LinePooler").GetComponent<ObjectPoolScript> ();
    }
Beispiel #32
0
 void Awake()
 {
     groundCheck = transform.GetComponent<PlayerGroundCheck>();
     inventory = transform.GetComponent<ItemInventory>();
     inputScript = transform.GetComponent<InputScript>();
     rigidbody = transform.GetComponent<Rigidbody2D>();
     topCollider = transform.GetComponent<BoxCollider2D>();
     spriteAnimator = transform.GetComponent<SpriteAnimator>();
 }
Beispiel #33
0
    // Use this for initialization
    void Start()
    {
        iScript = this;

        m_hands = GetComponentsInChildren<SixenseHand>();
        grabPoints = new Transform[2];
        //grabbedObjects = new Transform[2];
        lastPositions = new Vector3[2];

        for (int i = 0; i < m_hands.Length; i++)
        {
            grabPoints[i] = m_hands[i].transform.Find("GrabPoint").transform;
        }
    }