Ejemplo n.º 1
0
        /// <summary>
        /// Draws the Loading Screen
        /// </summary>
        public void OnGUI()
        {
            GUI.skin = _zodiacStyle;
            GUIOperations.DrawLabelCenteredAt(Screen.width / 2, Screen.height * 5 / 6, (int)(0.1f * Screen.width), "Loading");
            int top       = (int)(Screen.height * 0.15f);
            int topoffset = (int)(0.05f * Screen.height);
            int left;
            int leftoffset = Screen.width / 3;

            if (GameManager.GetInstance().PlayerCount == 1)
            {
                left = Screen.width / 2;
            }
            else
            {
                left = Screen.width / 3;
            }

            for (int i = 1; i <= GameManager.GetInstance().PlayerCount; i++)
            {
                ControlKeysManager c = ConfigManager.GetInstance().GetControlKeysForPlayer(i);
                GUIOperations.DrawLabelCenteredAt(left, top - topoffset, (int)(0.04f * Screen.width), "Player " + i);
                GUIOperations.DrawLabelCenteredAt(left, top + topoffset, (int)(0.02f * Screen.width), "Walk up: " + ConfigManager.KeyToString(c.ForwardKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (2 * topoffset), (int)(0.02f * Screen.width), "Walk down: " + ConfigManager.KeyToString(c.BackwardKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (3 * topoffset), (int)(0.02f * Screen.width), "Walk left: " + ConfigManager.KeyToString(c.LeftKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (4 * topoffset), (int)(0.02f * Screen.width), "Walk right: " + ConfigManager.KeyToString(c.RightKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (5 * topoffset), (int)(0.02f * Screen.width), "Attack: " + ConfigManager.KeyToString(c.AttackKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (6 * topoffset), (int)(0.02f * Screen.width), "Defend: " + ConfigManager.KeyToString(c.DefendKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (7 * topoffset), (int)(0.02f * Screen.width), "Jump: " + ConfigManager.KeyToString(c.JumpKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (8 * topoffset), (int)(0.02f * Screen.width), "Pickup & Use: " + ConfigManager.KeyToString(c.PickupKey));
                GUIOperations.DrawLabelCenteredAt(left, top + (9 * topoffset), (int)(0.02f * Screen.width), "Drop: " + ConfigManager.KeyToString(c.DropItemKey));
                left += leftoffset;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Unity callback; called once per frame.
 /// </summary>
 public void Update()
 {
     if (ControlKeysManager.GetKeyDown(KeyCode.F1))
     {
         TriggerSheet();
     }
 }
Ejemplo n.º 3
0
        public int LoadProperties(DataGridView grid, TestObjectNurse nurseObject)
        {
            ITestObject testObject = nurseObject.TestObject;

            int count = 0;

            foreach (KeyValuePair<string, string> pair in nurseObject.CachedProperties)
            {
                if (!testObject.Properties.ContainsKey(pair.Key) && pair.Key != ControlKeys.ImagePath
                    && pair.Key != UIAControlKeys.BoundingRectangle
                    )
                {
                    string displayName = ControlKeysManager.GetDisplayString(pair.Key);
                    grid.Rows.Add(new object[] { displayName, pair.Value });
                    count++;
                }
            }

            if (!_condition.TestObject.Properties.ContainsKey(ControlKeys.Index))
            {
                grid.Rows.Add(new object[] { ControlKeysManager.GetDisplayString(ControlKeys.Index), 0 });
                count++;
            }
            return count;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// initializing the values
 /// </summary>
 public void Start()
 {
     _default1 = ConfigManager.GetInstance().DefaultPlayer1;
     _default2 = ConfigManager.GetInstance().DefaultPlayer2;
     _player1  = (ControlKeysManager)ConfigManager.GetInstance().GetControlKeysForPlayer(1).Clone();
     _player2  = (ControlKeysManager)ConfigManager.GetInstance().GetControlKeysForPlayer(2).Clone();
     RefreshStrings();
     _zodiac  = Resources.Load("GUI/zodiac") as GUISkin;
     _mySkin2 = Resources.Load("GUI/Options") as GUISkin;
 }
Ejemplo n.º 5
0
        private void AddProperty(List <PropertySpec> properties, string key, string category)
        {
            PropertySpec spec = new PropertySpec(key, ControlKeysManager.GetDisplayString(key), typeof(string), category,
                                                 ControlKeysManager.GetDisplayString(key) /*description*/
                                                 , null);

            if (key == ControlKeys.Type || key == ControlKeys.ImagePath)
            {
                spec.Attributes = new Attribute[] { ReadOnlyAttribute.Yes };
            }
            properties.Add(spec);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Add the selected property in grid to the uiaCondition
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="testObject"></param>
        public static void AddSelectedProperty(DataGridView grid, ITestObject testObject)
        {
            foreach (DataGridViewRow gridRow in grid.SelectedRows)
            {
                string propertyName = gridRow.Cells["Property"].Value.ToString();
                string keyName      = ControlKeysManager.GetKeyString(propertyName);
                string value        = (gridRow.Cells["Value"].Value ?? string.Empty).ToString();

                if (!testObject.Contains(propertyName))
                {
                    testObject.AddProperty(keyName, value);
                }
            }
        }
Ejemplo n.º 7
0
        private ListViewItem[] AddProperties(Dictionary <string, string> properties, ListViewGroup listViewGroup)
        {
            List <ListViewItem> items = new List <ListViewItem>();

            IElementProperties elementProperties = (IElementProperties)this.listView.Tag;

            foreach (KeyValuePair <string, string> pair in properties)
            {
                ListViewItem item = new ListViewItem(new string[] { ControlKeysManager.GetDisplayString(pair.Key, elementProperties.ControlTypeString), pair.Value }, listViewGroup);
                item.Tag = pair;
                items.Add(item);
            }

            return(items.ToArray());
        }
Ejemplo n.º 8
0
        public static int FillPropertyGrid(DataGridView propertiesTable, ITestObject testObject)
        {
            propertiesTable.Rows.Clear();

            propertiesTable.Tag = testObject;

            int count = 0;

            foreach (KeyValuePair <string, string> property in testObject.Properties)
            {
                string displayName = ControlKeysManager.GetDisplayString(property.Key);

                propertiesTable.Rows.Add(new Object[] { displayName, property.Value });

                count++;
            }

            return(count);
        }
        public void ControlKeysManager_GetDisplayString()
        {
            //UIA
            string displayString = ControlKeysManager.GetDisplayString("automationId");

            Assert.AreEqual("AutomationId", displayString);

            //common
            displayString = ControlKeysManager.GetDisplayString("title");
            Assert.AreEqual("Title", displayString);

            //web
            displayString = ControlKeysManager.GetDisplayString("role", "Web");
            Assert.AreEqual("Role", displayString);


            displayString = ControlKeysManager.GetDisplayString("imgPath");
            Assert.AreEqual("ImagePath", displayString);
        }
Ejemplo n.º 10
0
        public void ReloadElementData(DataGridView grid, TestObjectNurse nurseObject)
        {
             UIATestObject existingObject = (UIATestObject) nurseObject.TestObject;
             if (existingObject.AutomationElement == null)
            {
                MessageBox.Show("Cannot load object");
            }

            UIATestObject newObject;
            
            newObject = UIAUtility.CreateTestObject(existingObject.AutomationElement, nurseObject.NodeName);

            foreach (string key in newObject.Properties.Keys)
            {
                if (!existingObject.Contains(key))
                {
                    string displayName = ControlKeysManager.GetDisplayString(key);
                    string property = newObject.Properties[key];

                    grid.Rows.Add(new object[] { displayName, property });
                }
            }
        }