Exemplo n.º 1
0
	// Update is called once per frame
	void Update()
	{

        if (rayOn)
        {
            RaycastHit hit;
            Physics.Raycast(transform.position, transform.forward, out hit);
            if (Input.GetKeyDown(KeyCode.Tab))
                Debug.Log("hi");

        }

        int ret;
        float velocity_old = 0.0f;
        ret = wiiController.ReadWiimoteData();
        wiiButton = wiiController.Button;
        if (ret > 0 && wiiButton.b)
        {
            oldVecz = newVecz;
            throwSet = true;
            Vector3 accel = GetAccelVector();
            Vector3 accelNormal = accel;
            accelNormal.Normalize();

            float sizeOfWidth = 2;
            leftRightMotion = accelNormal.x * (sizeOfWidth / 2);

            velocity_old = velocity;
            Vector2 vVec = new Vector2(accel.y, accel.z);
            velocity = Mathf.Sqrt(vVec.SqrMagnitude());
            velocity *= Mathf.Sign(accel.y);
            velocity -= velocity_old;
            newVecz = leftRightMotion;
               
            if (finalVel <= velocity)
            {
                finalVel = velocity;
                fVelTime = Time.time;
            }
            iTween.ValueTo(gameObject, iTween.Hash("from", oldVecz, "to", newVecz, "time", Time.deltaTime, "onupdate", "ShowGhost"));

        }
        else if (!wiiButton.b && throwSet)
        {
            throwSet = false;
            Destroy(myBall);
            myBall = (GameObject)Instantiate(pingPong, new Vector3(transform.position.x - 1, transform.position.y, newVecz), Quaternion.identity);
            myBall.GetComponent<Rigidbody>().velocity = new Vector3(Mathf.Abs(finalVel) * -2, 2f, 0f);
        }

        if (Time.time - fVelTime > 1f)
        {
            finalVel = velocity;
        }

		if (Time.time - timeStart > 30f && playEnabled && false)
		{
			TimeUp();
		}
	}
Exemplo n.º 2
0
 public void Should_return_HTML_code_representing_a_button_with_partial_path_if_pathutility_is_not_configured()
 {
     const IPathUtility pathUtility = null;
     _buttonData = new ButtonData(_buttonType, pathUtility);
     SetAdditionalParameters();
     _buttonData.ToString().ShouldBeEqualTo(_htmlText);
 }
Exemplo n.º 3
0
 public void GenerateObject(ButtonData objectData)
 {
     Debug.Log("Generating Object");
     if (objectsGenerated[currentIndex] == null)
     {
         objectsGenerated[currentIndex] = GenerateGameObject(objectData);
         objectsGenerated[currentIndex].SyncTextToCollisions();
     }
     else
         objectsGenerated[currentIndex].ChangeObjectInfo(objectData);
     IncrementIndex();
 }
Exemplo n.º 4
0
 ObjectInfo GenerateGameObject(ButtonData data)
 {
     Transform generatedObject = (Transform)Instantiate(objectTemplate, transform.position, transform.rotation) as Transform;
     Debug.Log(generatedObject.name);
     Rigidbody body = generatedObject.gameObject.AddComponent<Rigidbody>();
     body.mass = 1000;
     ObjectInfo generatedObjectInfo = generatedObject.GetComponent<ObjectInfo>();
     generatedObjectInfo.ChangeObjectInfo(data);
     if (spawnPoint != null)
         spawnPoint = transform.GetChild(0);
     generatedObject.transform.position = new Vector3(spawnPoint.position.x, spawnPoint.position.y, spawnPoint.position.z);
     generatedObject.transform.parent = ObjectOrganizer;
     body.AddForce(GenerateForce());
     return generatedObjectInfo;
 }
Exemplo n.º 5
0
 public void ChangeObjectInfo(ButtonData objectInfo)
 {
     if (!CheckObjectType(objectInfo.objectType))
         ClearModelInfo();
         switch (objectInfo.objectType)
         {
             case "Sphere":
                 AddSphereModelInfo();
                 break;
             case "Cube":
             AddCubeModelInfo();
                 break;
         }
     SetDefaultData();
     ChangeObjectColor(objectInfo.color);
     ChangeGravity(objectInfo.obeyGravity);
 }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                EntityId = Request.QueryString["id"] == null ? Guid.Empty : new Guid(Request.QueryString["id"]);
                string OrgName = Request.QueryString["orgname"] == null ? "" : Request.QueryString["orgname"];
                EntityType = Request.QueryString["type"] == null ? 0 : int.Parse(Request.QueryString["type"]);
                EntityName = Request.QueryString["typename"] == null ? "" : Request.QueryString["typename"];

                string data = Request.QueryString["data"] == null ? "" : Request.QueryString["data"];
                if (EntityId != Guid.Empty && EntityType != 0 && OrgName != "" && data != "")
                {
                    CreateService(ConfigurationManager.AppSettings["ServerName"], OrgName, ConfigurationManager.AppSettings["Login"],
                                  ConfigurationManager.AppSettings["Password"], ConfigurationManager.AppSettings["Domain"]);
                    try
                    {
                        string LicenseFilePath = ConfigurationManager.AppSettings["LicenseFilePath"];

                        // Check for license and apply if exists.
                        if (File.Exists(LicenseFilePath))
                        {
                            License license = new License();
                            license.SetLicense(LicenseFilePath);
                        }
                    }
                    catch { }
                    string[] ButtonsData = data.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string ButtonData in ButtonsData)
                    {
                        string[] Data = ButtonData.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                        if (Data.Length == 4)
                        {
                            string TemplateName    = Data[0];
                            string ButtonToDisplay = Data[1];

                            if (ButtonToDisplay.ToLower() == "download")
                            {
                                BTN_Download.Visible = true;
                                DownloadTemplate     = TemplateName;
                                DownloadFormat       = Data[2];
                                DownloadFileName     = Data[3];
                            }
                            if (ButtonToDisplay.ToLower() == "note")
                            {
                                BTN_AttachToNote.Visible = true;
                                AttachToNoteTemplate     = TemplateName;
                                AttachToNoteFormat       = Data[2];
                                AttachToNoteFileName     = Data[3];
                            }
                        }
                        else
                        {
                            LBL_Message.Text         = "Data is not correct.";
                            BTN_Download.Visible     = false;
                            BTN_AttachToNote.Visible = false;
                            LBL_Message.Visible      = true;
                        }
                    }
                }
                else
                {
                    LBL_Message.Text         = "Parameters are not correct, Please save the record first.";
                    BTN_Download.Visible     = false;
                    BTN_AttachToNote.Visible = false;
                    LBL_Message.Visible      = true;
                }
            }
            catch (Exception ex)
            {
                LBL_Message.Text         = "Error has occured. Details: " + ex.Message;
                BTN_Download.Visible     = false;
                BTN_AttachToNote.Visible = false;
                LBL_Message.Visible      = true;
            }
        }
 public void OnGet()
 {
     PossibleSelection = new ButtonData[] {
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function Insertion(stringToInsert)
             {
                     if(GridObject.length == 0)
                     {
                         page += stringToInsert;
                     } else {
                         var Grid = GridObject.pop();
                         var Row = Grid.pop();
                         var ColumnPosition = Row.pop();
                         InsertIntoPageString(stringToInsert, ColumnPosition);
                         if(Row.length == 0)
                         {
                             if(Grid.length == 0)
                             {
                                 return; //empty column
                             } else {
                                 GridObject.push(Grid)
                             }
                             return;
                         }
                         else
                         {
                             Grid.push(Row);
                             GridObject.push(Grid)
                         }
                     }
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             Name               = "Set Title",
             JavascriptFunction = @"var Title;
             function SetTitle()
             {
                Title = document.getElementById('Title').value;
                 var i = 0;
             }",
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
         new ButtonData
         {
             DisplayModal       = false,
             JavascriptFunction = @"function InsertIntoPageString(Element, aPosition)
             {
                 var beforeMe = page.substr(0, aPosition);
                 var afterMe = page.substr(aPosition, page.length);
                 page = beforeMe + Element + afterMe;
             }",
             isHidden           = true
         },
     };
 }
 public void BeforeEachTest()
 {
     _pathUtility = MockRepository.GenerateMock<IPathUtility>();
     _buttonData = new ButtonData(ButtonData.ButtonType.Delete, _pathUtility, "Delete");
 }
Exemplo n.º 9
0
 public void Should_return_HTML_code_representing_a_button_with_partial_path_if_pathutility_is_not_configured()
 {
     const IPathUtility pathUtility = null;
     _buttonData = new ButtonData(_buttonType, pathUtility);
     SetAdditionalParameters();
     var htmlText = String.Format("<input Id='btnLink' name='btnLink' value='Cancel' class='cancel' type='button' onClick='javascript:location.href=&quot;{0}&quot;'/>", "/Test/Action/4/name");
     _buttonData.ToString().ShouldBeEqualTo(htmlText);
 }
Exemplo n.º 10
0
 public void Should_return_HTML_code_representing_a_button_with_partial_path_if_pathutility_is_not_configured()
 {
     const IPathUtility pathUtility = null;
     _buttonData = new ButtonData(_buttonType, pathUtility, ControllerName)
                   {
                       ControllerExtension = ".mvc"
                   };
     SetAdditionalParameters();
     var htmlText = String.Format("<input Id='btnSave' name='btnSave' value='Save' class='button default' type='submit' action='{0}' onClick='javascript:return changeFormAction(this)'/>", "/Admin.mvc/Save");
     _buttonData.ToString().ShouldBeEqualTo(htmlText);
 }
Exemplo n.º 11
0
 public void Should_return_HTML_code_representing_a_button_with_partial_path_if_pathutility_is_not_configured()
 {
     const IPathUtility pathUtility = null;
     _buttonData = new ButtonData(_buttonType, pathUtility, ControllerName)
                   {
                       ControllerExtension = ".mvc"
                   };
     SetAdditionalParameters();
     var htmlText = String.Format("<input Id='btnDelete' name='btnDelete' value='Text' class='cancel' type='submit' action='{2}' onClick='javascript:return confirmThenChangeFormAction({0}{1}{0}, this)'/>", "\"".EscapeForTagAttribute(), _buttonData.ConfirmMessage, "/Admin.mvc/Test");
     _buttonData.ToString().ShouldBeEqualTo(htmlText);
 }
Exemplo n.º 12
0
    void Awake()
    {
        atkButton = new ButtonData();
        atkButton.isPressed = false;

        ability1Button = new ButtonData();
        ability1Button.isPressed = false;

        ability2Button = new ButtonData();
        ability2Button.isPressed = false;

        #if UNITY_EDITOR
        Debug.Log("Unity Editor");
        #else
        Debug.Log("Any other platform");
        usePhoneControls = true;
        debugPanel.gameObject.SetActive(true);
        atkButtonPanel.gameObject.SetActive(true);
        ability1ButtonPanel.gameObject.SetActive(true);
        ability2ButtonPanel.gameObject.SetActive(true);
        #endif
    }
Exemplo n.º 13
0
    public void AddData(ButtonData tData)
    {
        _tContent.Add(tData);

        _tVirtualView.CreateView(_tContent.Count, AddCallback);
    }
Exemplo n.º 14
0
    //activating the level buttons for the stage given
    public void ActivationForLevelButtons(int stage)
    {
        //disabling the stage buttons
        ActivationForStageButtons(false);

        //current stage selected is equal to the stage recieved
        currentStageSelected = stage;

        //if old and current stage are different, go to the first page
        int oldStageSelected = PlayerPrefs.GetInt(PlayerSetting.CURRENT_STAGE_KEY);

        if (currentStageSelected != oldStageSelected)
        {
            PlayerPrefs.SetInt(PlayerSetting.CURRENT_LEVEL_PAGE_KEY, 1);
        }

        //updating the currentStage key
        PlayerPrefs.SetInt(PlayerSetting.CURRENT_STAGE_KEY, currentStageSelected);
        PlayerPrefs.Save();

        int totalStageLevels = StageManager.instance.GetTotalLevelsFromStage(stage);
        int currentLevelPage = PlayerPrefs.GetInt(PlayerSetting.CURRENT_LEVEL_PAGE_KEY);

        bool value = stageLevelsBeingShown;

        if (totalStageLevels <= 0)
        {
            Debug.LogError("Amount of leves on stage " + stage + "is " + totalStageLevels);
            return;
        }

        //the amount level stage buttons that will be revealed
        int levelButtonsToShow = 0;

        //if total levels of a stage are equal or less than 4, show buttons equal to the total levels
        if (totalStageLevels <= totalLevelButtonsOnPage)
        {
            levelButtonsToShow = totalStageLevels;
        }

        else
        {
            //quotient and remainder between the total game levels and the current level page
            int levelButtonQuotient = totalStageLevels / (currentLevelPage * totalLevelButtonsOnPage);
            int levelButtonReminder = totalStageLevels % (currentLevelPage * totalLevelButtonsOnPage);

            //if there are more or equal levels than the currentLevelPage * 4, show 4 buttons
            if (levelButtonQuotient > 0)
            {
                levelButtonsToShow = totalLevelButtonsOnPage;
            }


            //else show the remainder level buttons available
            else if (levelButtonQuotient == 0 && levelButtonReminder > 0)
            {
                levelButtonsToShow = levelButtonReminder % 4;
            }
        }

        bool stageIsCompleted = StageManager.instance.CheckIfStageIsCompleted(stage);

        int currentLevelOnStage = PlayerPrefs.GetInt(PlayerSetting.CURRENT_LEVEL_FROM_LAST_STAGE_UNLOCKED_KEY);

        bool breakLevelPositioning;

        int i = 0;

        string tempString;

        //showing the corresponding buttons of a stage on the current level page
        while (i < levelButtonsToShow)
        {
            //see if there are still more buttons to be created or not
            if (((i + 1) + (currentLevelPage - 1) * totalLevelButtonsOnPage) <= currentLevelOnStage)
            {
                breakLevelPositioning = true;
            }

            else
            {
                breakLevelPositioning = false;
            }

            //if stage is completed, the levels of a stage are still shown, even if the last played level number
            //is different of what is expected
            if (breakLevelPositioning == false && stageIsCompleted == false)
            {
                break;
            }

            levelButtonArray[i].gameObject.SetActive(value);

            //change level buttons number text
            if (value == true)
            {
                tempButtonData = levelButtonArray[i].GetComponent <ButtonData>();

                //refreshing the text button, for deleating the previous number on the level button text
                tempButtonData.refreshButtonText = true;

                tempButtonData.buttonLevel = ((currentLevelPage - 1) * totalLevelButtonsOnPage) + (i + 1);

                //change button language
                CheckButtonTextLanguage(levelButtonArray[i]);

                tempString = " " + (((currentLevelPage - 1) * totalLevelButtonsOnPage) + (i + 1));

                //adding the level number on a level button text
                levelButtonArray[i].GetComponentInChildren <Text>().text += tempString;
            }

            i++;
        }

        //showing next and previous stage buttons if needed
        if (value == true)
        {
            if (totalStageLevels > (currentLevelPage * totalLevelButtonsOnPage) &&
                (currentLevelOnStage > (currentLevelPage * totalLevelButtonsOnPage) || stageIsCompleted == true))
            {
                nextStageLevelsButton.gameObject.SetActive(value);
                CheckButtonTextLanguage(nextStageLevelsButton);
            }

            if (currentLevelPage > 1 && ((currentLevelPage * totalLevelButtonsOnPage) - 4) > 0)
            {
                previousStageLevelsButton.gameObject.SetActive(value);
                CheckButtonTextLanguage(previousStageLevelsButton);
            }
        }

        else if (value == false)
        {
            nextStageLevelsButton.gameObject.SetActive(value);
            previousStageLevelsButton.gameObject.SetActive(value);
        }
    }
Exemplo n.º 15
0
 private void UpdateActionButtonValues(ButtonData newButtonData)
 {
     _actionButton      = newButtonData.ActionButton;
     _actionButtonText  = newButtonData.ActionText;
     _actionButtonImage = newButtonData.ActionImage;
 }
Exemplo n.º 16
0
    /// <summary>
    /// Recebe um novo botão como o botão de action que será utilizado
    /// </summary>
    /// <param name="newButton"></param>
    private void RecieveButtonData(ButtonData newButton)
    {
        _buttonData = newButton;

        UpdateActionButtonValues(_buttonData);
    }
Exemplo n.º 17
0
    private float UpdateButtonEffect(ButtonData buttonData, ButtonEffectData effectData)
    {
        var normTime = 1 - Mathf.Clamp01(((buttonData.EvaluationTime + effectData.Duration) - Time.time) / effectData.Duration);
        var zPos = Mathf.Lerp(buttonData.StartZ, buttonData.EndZ, effectData.MovementCurve.Evaluate(normTime));
        buttonData.Trans.localPosition = new Vector3(buttonData.Trans.localPosition.x, buttonData.Trans.localPosition.y, zPos);

        return normTime;
    }
Exemplo n.º 18
0
        public static List <ConfigValues> OpenFile_Click(string fileToOpen)
        {
            // Regex för att hitta alla rader med prefixet Btn men som inte följs av en siffra (och således inte ska visas i textboxarna)
            string reg = @"Btn(?=)\d";

            if (fileToOpen.IsNullOrWhiteSpace() || fileToOpen == "undefined.txt")
            {
                lists.Clear();
                return(lists);
            }
            else
            {
                try
                {
                    linesInDoc.Clear();
                    unFilteredLinesInDoc.Clear();
                    fileName = fileToOpen;

                    using (StreamReader reader = new StreamReader(truckPath + "\\" + fileToOpen))
                    {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            if (!string.IsNullOrEmpty(line) && (line.StartsWith("Btn") || line.StartsWith("Status")))
                            {
                                Match match = Regex.Match(line, reg);

                                if (line.StartsWith("StatusBtnColor"))
                                {
                                    unFilteredLinesInDoc.Add(line);
                                }
                                else if (line.StartsWith("Status"))
                                {
                                    linesInDoc.Add(line);
                                    var data = ButtonData.Parse(line);
                                    if (data != null)
                                    {
                                        _linesInDoc.Add(data);
                                    }
                                }
                                else if (!match.Success)
                                {
                                    unFilteredLinesInDoc.Add(line);
                                }
                                else
                                {
                                    linesInDoc.Add(line);
                                    var data = ButtonData.Parse(line);
                                    if (data != null)
                                    {
                                        _linesInDoc.Add(data);
                                    }
                                }
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(line))
                                {
                                    unFilteredLinesInDoc.Add(line);
                                }
                            }
                        }
                    }

                    listObject.statusList.Clear();
                    listObject.tgList.Clear();
                    listObject.portList.Clear();
                    listObject.shortList.Clear();
                    listObject.linkList.Clear();
                    listObject.quickList.Clear();
                    lists.Clear();

                    ExtractStatusInfo();
                    ExtractTgInfo();
                    ExtractPortInfo();
                    ExtractKortNRInfo();
                    ExtractUrlInfo();
                    ExtractQuickButtonInfo();
                    ExtractName();
                    lists.Add(listObject);

                    return(lists);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex.ToString());
                    return(lists);
                }
            }
        }
Exemplo n.º 19
0
    // Start is called before the first frame update
    void Start()
    {
        new screenSetting().screenSet(1920);

        acti1 = new UiData("1000");
        acti2 = new UiData("1100");
        acti3 = new UiData("1110");
        acti4 = new UiData("1111");

        lock2 = new UiData("lock2");
        lock3 = new UiData("lock3");
        lock4 = new UiData("lock4");


        ch1 = new ButtonData("select1");
        ch2 = new ButtonData("select2");
        ch3 = new ButtonData("select3");
        ch4 = new ButtonData("select4");

        acti1.disable();
        acti2.disable();
        acti3.disable();
        acti4.disable();

        lock2.disable();
        lock3.disable();
        lock4.disable();



        ch1.disable();
        ch2.disable();
        ch3.disable();
        ch4.disable();
        if (commonData.Totalscore < 500)
        {
            acti1.enable();
            ch1.enable();

            lock2.enable();
            lock3.enable();
            lock4.enable();
        }
        else if (commonData.Totalscore > 500 && commonData.Totalscore < 1000)
        {
            acti2.enable();
            ch1.enable();
            ch2.enable();

            lock3.enable();
            lock4.enable();
        }
        else if (commonData.Totalscore > 1000 && commonData.Totalscore < 2000)
        {
            acti3.enable();
            ch1.enable();
            ch2.enable();
            ch3.enable();

            lock4.enable();
        }
        else
        {
            acti4.enable();
            ch1.enable();
            ch2.enable();
            ch3.enable();
            ch4.enable();
        }

        switch (commonData.character)
        {
        case "character1":
            t   = check.transform.position;
            t.x = ch1.buttonEnable.gameObject.transform.position.x;
            check.transform.position = t;
            break;

        case "character2":
            t   = check.transform.position;
            t.x = ch2.buttonEnable.gameObject.transform.position.x;
            check.transform.position = t;
            break;

        case "character3":
            t   = check.transform.position;
            t.x = ch3.buttonEnable.gameObject.transform.position.x;
            check.transform.position = t;
            break;

        case "character4":
            t   = check.transform.position;
            t.x = ch4.buttonEnable.gameObject.transform.position.x;
            check.transform.position = t;
            break;
        }

        score.text = "Total Score: " + commonData.Totalscore.ToString();
    }
Exemplo n.º 20
0
 public static bool ScrollingMenu_SetupItemUnlocks(ButtonData myButtonData, Unlock myUnlock) => SetupUnlocks(myButtonData, myUnlock);
 public static ButtonData getButtonData(int button)
 {
     if (_jcOuyaController == IntPtr.Zero)
     {
         Log.Error(LOG_TAG, "_jcOuyaController is not initialized");
         return null;
     }
     if (_jmGetButtonData == IntPtr.Zero)
     {
         Log.Error(LOG_TAG, "_jmGetButtonData is not initialized");
         return null;
     }
     IntPtr result = JNIEnv.CallStaticObjectMethod(_jcOuyaController, _jmGetButtonData, new JValue(button));
     if (result == IntPtr.Zero)
     {
         Log.Error(LOG_TAG, "Failed to get ButtonData");
         return null;
     }
     ButtonData retVal = new ButtonData();
     retVal.Instance = result;
     return retVal;
 }
Exemplo n.º 22
0
            public void Should_return_HTML_code_representing_a_button_with_full_path_if_pathUtility_is_configured()
            {
                IPathUtility pathUtility = new TestPathUtility();
                _buttonData = new ButtonData(_buttonType, pathUtility, ControllerName)
                              {
                                  ControllerExtension = ".mvc"
                              };

                var htmlText = String.Format("<input Id='btnDelete' name='btnDelete' value='Delete' class='cancel' type='submit' action='{2}' onClick='javascript:return confirmThenChangeFormAction({0}{1}{0}, this)'/>", "\"".EscapeForTagAttribute(), ButtonData.ButtonType.Delete.ConfirmationMessage, pathUtility.GetUrl("/Admin.mvc/Delete"));
                _buttonData.ToString().ShouldBeEqualTo(htmlText);
            }
Exemplo n.º 23
0
 /// <summary>
 /// Disable the ButtonSettings
 /// </summary>
 public void Disable()
 {
     running = false;
     ButtonSettingsCanvas.SetActive(false);
     currButtonData = null;
 }
Exemplo n.º 24
0
            public void Should_return_HTML_code_representing_a_button_with_full_path_if_pathUtility_is_configured()
            {
                IPathUtility pathUtility = new TestPathUtility();
                _buttonData = new ButtonData(_buttonType, pathUtility, ControllerName)
                              {
                                  ControllerExtension = ".mvc"
                              };

                var htmlText = String.Format("<input Id='btnSave' name='btnSave' value='Save' class='button' type='submit' action='{0}' onClick='javascript:return changeFormAction(this)'/>", pathUtility.GetUrl("/Admin.mvc/Save"));
                _buttonData.ToString().ShouldBeEqualTo(htmlText);
            }
Exemplo n.º 25
0
    // Method for saving data out to a file
    // 1. Create BinaryFormatter
    // 2. Create file to save to
    // 3. Create a container for the object
    // 4. Write the container to the file
    // 5. Close the file
    public void SaveButtonAssignment()
    {
        // BinaryFormatter is the thing that is going to write for us
        BinaryFormatter bf = new BinaryFormatter();
        // persistantDataPath is a Unity specific place to hide save data.
        // Application.persistantDataPath is a string, so you can output the full path if
        // you want to know exactly where the data is being stored
        // playerInfo.dat is a data file inside of persistantDataPath where we will store the players info.
        FileStream file = File.Create(Application.persistentDataPath + "/buttonAssignment.dat");

        // Take data from ButtonControl and put it in ButtonData container
        ButtonData data = new ButtonData();
        data.SetButtonLeft(left);
        data.SetButtonRight(right);
        data.SetButtonUp(up);
        data.SetButtonDown(down);
        data.SetButtonJump(jump);
        data.SetButtonFire1(fire1);
        data.SetButtonFire2(fire2);
        data.SetButtonFire3(fire3);
        data.SetButtonQuickFire(quickFire);
        data.SetButtonSubmit(submit);
        data.SetButtonCancel(cancel);

        // Now, write that container to a file
        // Takes serializable class "data", and writes it to "file"
        bf.Serialize(file, data);

        // Close the file
        file.Close();
    }
Exemplo n.º 26
0
 public void Should_return_HTML_code_representing_a_button_with_full_path_if_pathUtility_is_configured()
 {
     IPathUtility pathUtility = new TestPathUtility();
     _buttonData = new ButtonData(_buttonType, pathUtility, ControllerName)
                   {
                       ControllerExtension = ".mvc"
                   };
     SetAdditionalParameters();
     _buttonData.ToString().ShouldBeEqualTo(HtmlText);
 }
Exemplo n.º 27
0
    /// <summary>
    /// Toggles whether this menu is on or off
    /// </summary>
    public void Toggle(ButtonData data)
    {
        currButtonData = data;
        int id = currButtonData.GetTransitionWindowID();
        if (id == 0)
            TransitionID.text = "Curr Transition ID: None";
        else TransitionID.text = "Curr Transition ID: " + id;

        if (id == 0) {
            TransitionButtonText.text = "Create Window";
        } else {
            TransitionButtonText.text = "GoTo Window " + id;
        }
        IDInput.text = string.Empty;

        running = !running;
        ButtonSettingsCanvas.SetActive(running);
    }
Exemplo n.º 28
0
 /// <summary>
 /// Disable the ButtonSettings
 /// </summary>
 public void Disable()
 {
     running = false;
     ButtonSettingsCanvas.SetActive(false);
     currButtonData = null;
 }
        public HomeSearchViewModel(MainViewModel mainViewModel) : base(mainViewModel)
        {
            //Populate the data on the Home search page
            CurrentLocation = new ButtonData()
            {
                Text  = "Current Location",
                Image = "location_changed"
            };

            //Initiate and insert data in the contact list for the Xaml to render the screen.
            #region ContactLists
            ContactList = new ObservableCollection <ButtonData>();
            ContactList.Add(new ButtonData()
            {
                Text  = "Add New",
                Image = "add_photo"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 1",
                Image = "http://lorempixel.com/190/190/people/"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 1",
                Image = "http://lorempixel.com/190/190/people/"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 2",
                Image = "http://lorempixel.com/190/190/people/"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 3",
                Image = "http://lorempixel.com/190/190/people/"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 4",
                Image = "http://lorempixel.com/190/190/people/"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 5",
                Image = "http://lorempixel.com/190/190/people/"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 6",
                Image = "http://lorempixel.com/190/190/people/"
            });
            ContactList.Add(new ButtonData()
            {
                Text  = "Person 7",
                Image = "http://lorempixel.com/190/190/people/"
            });


            //we tried removing one of the Contacts after delay of 5 sec to see if the list on the screen is being refreshed
            Task.Run(async() =>
            {
                await Task.Delay(5000).ContinueWith((arg) =>
                {
                    ContactList.RemoveAt(3);
                });
            });
            #endregion

            //Initiate and insert data in the contact list for the Xaml to render the screen.
            #region StarredLocations
            StarredLocations = new ObservableCollection <ButtonData>();
            StarredLocations.Add(new ButtonData()
            {
                Text        = "School",
                Image       = "starred_place",
                BorderWidth = 1
            });
            StarredLocations.Add(new ButtonData()
            {
                Text        = "Home",
                Image       = "starred_place",
                BorderWidth = 1
            });
            StarredLocations.Add(new ButtonData()
            {
                Text        = "Work",
                Image       = "starred_place",
                BorderWidth = 1
            });
            StarredLocations.Add(new ButtonData()
            {
                Text        = "Library",
                Image       = "starred_place",
                BorderWidth = 1
            });
            StarredLocations.Add(new ButtonData()
            {
                Text        = "Jamie's Dorm",
                Image       = "starred_place",
                BorderWidth = 1
            });

            StarredLocations.Add(new ButtonData()
            {
                Text  = "Add More Starred Places",
                Image = "plus_changed"
            });
            #endregion

            //Initiate and insert data in the Recent locations list for the Xaml to render the screen.
            #region RecentLists
            RecentLocations = new ObservableCollection <ButtonData>();
            RecentLocations.Add(new ButtonData()
            {
                Text  = "872 Higuera St",
                Image = "location_changed"
            });
            RecentLocations.Add(new ButtonData()
            {
                Text  = "872 Higuera St",
                Image = "location_changed"
            });
            RecentLocations.Add(new ButtonData()
            {
                Text  = "872 Higuera St",
                Image = "location_changed"
            });
            RecentLocations.Add(new ButtonData()
            {
                Text  = "872 Higuera St",
                Image = "location_changed"
            });
            RecentLocations.Add(new ButtonData()
            {
                Text  = "872 Higuera St",
                Image = "location_changed"
            });
            RecentLocations.Add(new ButtonData()
            {
                Text  = "872 Higuera St",
                Image = "location_changed"
            });
            #endregion
        }
Exemplo n.º 30
0
        // Update is called once per frame
        void Update()
        {
            // update the trackers only once per frame
            if (lastButtonUpdateFrame != Time.frameCount)
            {
                updateButtons();
                lastButtonUpdateFrame = Time.frameCount;
            }
            buttonData = (ButtonData)Marshal.PtrToStructure(buttonDataPointer, typeof(ButtonData));

            if (buttonData.state != lastButtonState)
            {
                lastButtonState = buttonData.state;
                VREvent e = new VREvent(eventName);
                if (buttonData.state == 0)
                {
                    e.AddData("EventType", "ButtonUp");
                }
                else if (buttonData.state == 1)
                {
                    e.AddData("EventType", "ButtonDown");
                }
                e.AddData("ButtonState", buttonData.state);
                pendingEvents.Add(e);
            }

            if (applyUpdatesToGameObject)
            {
                if (buttonData.state > 0)
                {
                    float speedThisFrame = speed * Time.deltaTime;

                    if (movementType == MovementType.TRANSLATE)
                    {
                        Vector3 position = transform.localPosition;
                        if (axis == Axis.X)
                        {
                            position.x += speedThisFrame;
                        }
                        else if (axis == Axis.Y)
                        {
                            position.y += speedThisFrame;
                        }
                        else if (axis == Axis.Z)
                        {
                            position.z += speedThisFrame;
                        }
                        else
                        {
                            position.x += speedThisFrame;
                            position.y += speedThisFrame;
                            position.z += speedThisFrame;
                        }

                        transform.localPosition = position;
                    }
                    else if (movementType == MovementType.ROTATE)
                    {
                        Quaternion newRotation = Quaternion.identity;
                        Vector3    newAngles   = newRotation.eulerAngles;

                        if (axis == Axis.X)
                        {
                            newAngles.x += speedThisFrame;
                        }
                        else if (axis == Axis.Y)
                        {
                            newAngles.y += speedThisFrame;
                        }
                        else if (axis == Axis.Z)
                        {
                            newAngles.z += speedThisFrame;
                        }
                        else
                        {
                            newAngles.x += speedThisFrame;
                            newAngles.y += speedThisFrame;
                            newAngles.z += speedThisFrame;
                        }

                        if (newAngles.x > 360)
                        {
                            newAngles.x %= 360;
                        }

                        if (newAngles.y > 360)
                        {
                            newAngles.y %= 360;
                        }

                        if (newAngles.z > 360)
                        {
                            newAngles.z %= 360;
                        }

                        newRotation.eulerAngles = newAngles;


                        Quaternion rotation = transform.localRotation;
                        rotation = rotation * newRotation;
                        transform.localRotation = rotation;
                    }
                    else
                    {
                        Vector3 scale = transform.localScale;
                        if (axis == Axis.X)
                        {
                            scale.x += speedThisFrame;
                        }
                        else if (axis == Axis.Y)
                        {
                            scale.y += speedThisFrame;
                        }
                        else if (axis == Axis.Z)
                        {
                            scale.z += speedThisFrame;
                        }
                        else
                        {
                            scale.x += speedThisFrame;
                            scale.y += speedThisFrame;
                            scale.z += speedThisFrame;
                        }

                        transform.localScale = scale;
                    }
                }
            }
        }
Exemplo n.º 31
0
        public override NetworkState.NETWORK_STATE_TYPE Deserialize()
        {
            NetworkState.NETWORK_STATE_TYPE state = NetworkState.NETWORK_STATE_TYPE.SUCCESS;
            int count = BufferedNetworkUtilsClient.ReadInt(ref state);

            for (int i = 0; i < count; ++i)
            {
                string name = BufferedNetworkUtilsClient.ReadString(ref state);
                FduClusterInputType type = (FduClusterInputType)BufferedNetworkUtilsClient.ReadByte(ref state);
                switch (type)
                {
                case FduClusterInputType.Axis:
                    float fvalue = BufferedNetworkUtilsClient.ReadFloat(ref state);
                    if (!_axisMap.ContainsKey(name))
                    {
                        AxisData _data = new AxisData();
                        _data.reset();
                        _data.setValue(fvalue);
                        _axisMap.Add(name, _data);
                    }
                    else
                    {
                        _axisMap[name].setValue(fvalue);
                    }
                    break;

                case FduClusterInputType.Button:
                    bool bvalue = BufferedNetworkUtilsClient.ReadBool(ref state);
                    if (!_buttonMap.ContainsKey(name))
                    {
                        ButtonData _data = new ButtonData();
                        _data.reset();
                        _data.setValue(bvalue);
                        _buttonMap.Add(name, _data);
                    }
                    else
                    {
                        _buttonMap[name].setValue(bvalue);
                    }
                    break;

                case FduClusterInputType.Tracker:
                    Vector3    v3Value = BufferedNetworkUtilsClient.ReadVector3(ref state);
                    Quaternion quValue = BufferedNetworkUtilsClient.ReadQuaternion(ref state);
                    if (!_trackerMap.ContainsKey(name))
                    {
                        TrackerData _data = new TrackerData();
                        _data.reset();
                        _data.setPosValue(v3Value);
                        _data.setRotValue(quValue);
                        _trackerMap.Add(name, _data);
                    }
                    else
                    {
                        _trackerMap[name].setPosValue(v3Value);
                        _trackerMap[name].setRotValue(quValue);
                    }
                    break;
                }
            }
            //if(!BufferedNetworkUtilsClient.ReadString(ref state).Equals("ClusterInputMgrEndFlag"))
            //{
            //    Debug.LogError("Wrong end!");
            //}
            //StartCoroutine(swapValueCo());
            return(state);
        }
Exemplo n.º 32
0
 public static ButtonData getButtonData(int button)
 {
     if (_jcOuyaController == IntPtr.Zero)
     {
         Debug.LogError("_jcOuyaController is not initialized");
         return null;
     }
     if (_jmGetButtonData == IntPtr.Zero)
     {
         Debug.LogError("_jmGetButtonData is not initialized");
         return null;
     }
     IntPtr result = AndroidJNI.CallStaticObjectMethod(_jcOuyaController, _jmGetButtonData, new jvalue[] { new jvalue() { i = button } });
     if (result == IntPtr.Zero)
     {
         Debug.LogError("Failed to get ButtonData");
         return null;
     }
     ButtonData retVal = new ButtonData();
     retVal.Instance = result;
     return retVal;
 }
Exemplo n.º 33
0
    // Update is called once per frame
    void Update()
	{
        UpdateScore();
        if (rayOn)
        {
            RaycastHit hit;
            Physics.Raycast(transform.position, transform.forward, out hit);
            //Vector3 cursorPosition = new Vector3(cursor.transform.position.x, hit.transform.position.y, hit.transform.position.z);
            if (Input.GetKeyDown(KeyCode.Tab))
                Debug.Log("hi");
            //cursor.transform.position = cursorPosition;

        }

        // void establish from state()

        if (app.RespectMyAutoritah() && !myBall)
        {
            ghostBall.SetActive(true);
            if (usingWiimote)
            {
                int ret;
                float velocity_old = 0.0f;
                ret = wiiController.ReadWiimoteData();
                wiiButton = wiiController.Button;
                if (ret > 0 && wiiButton.b)
                {
                    oldVecz = newVecz;
                    throwSet = true;
                    Vector3 accel = GetAccelVector();
                    Vector3 accelNormal = accel;
                    accelNormal.Normalize();

                    float sizeOfWidth = 2;
                    leftRightMotion = accelNormal.x * (sizeOfWidth / 2);

                    velocity_old = velocity;
                    Vector2 vVec = new Vector2(accel.y, accel.z);
                    velocity = Mathf.Sqrt(vVec.SqrMagnitude());
                    velocity *= Mathf.Sign(accel.y);
                    velocity -= velocity_old;
                    newVecz = leftRightMotion;

                    if (finalVel >= velocity)
                    {
                        finalVel = velocity;
                        fVelTime = Time.time;
                    }
                    iTween.ValueTo(gameObject, iTween.Hash("from", oldVecz, "to", newVecz, "time", Time.deltaTime * 4.0f, "onupdate", "ShowGhost"));

                    Debug.Log(finalVel);

                }
                else if (!wiiButton.b && throwSet)
                {
                    throwSet = false;
                    Destroy(myBall);
                    myBallPos = new Vector3(transform.position.x - 1, transform.position.y, newVecz);
                    myBallVel = new Vector3(Mathf.Min(finalVel, 0) * 2, 2f, newVecz / 100);
                    myBall = (GameObject)Instantiate(pingPong, myBallPos, Quaternion.identity);
                    myBall.GetComponent<Rigidbody>().velocity = myBallVel;
                    Debug.Log(finalVel);
                    myBall.GetComponent<BallBehavior>().setApp(this);
                    myBall.GetComponent<BallBehavior>().EnablePlay();

                    finalVel = 0;
                    velocity = 0;
                }

                if (Time.time - fVelTime > 1f)
                {
                    finalVel = velocity;
                    fVelTime = Time.time;
                }
            }
            else if (Input.GetKeyDown(KeyCode.Space))
            {
                myBall = (GameObject)Instantiate(pingPong, new Vector3(transform.position.x - 1, transform.position.y, 0), Quaternion.identity);
                myBall.GetComponent<Rigidbody>().velocity = new Vector3(-7.2f, 2f, 0f);
                myBall.GetComponent<BallBehavior>().setApp(this);
                myBall.GetComponent<BallBehavior>().EnablePlay();
            }


            if (Time.time - timeStart > 30f && playEnabled && false)
            {
                TimeUp();
            }
        }
        else
        {
            ghostBall.SetActive(false);
        }
	}