Exemplo n.º 1
0
        public void JsonPassiveNode_ClearPosition(float x, float y, float zoomLevel, int orbitRadiiIndex, float[] orbitRadii, int skillsPerOrbitIndex, float[] skillsPerOrbit)
        {
            var group = new JsonPassiveNodeGroup
            {
                OriginalX = x,
                OriginalY = y,
                ZoomLevel = zoomLevel,
            };

            var node = new JsonPassiveNode
            {
                PassiveNodeGroup    = group,
                OrbitRadiiIndex     = orbitRadiiIndex,
                OrbitRadii          = orbitRadii,
                SkillsPerOrbitIndex = skillsPerOrbitIndex,
                SkillsPerOrbit      = skillsPerOrbit,
                ZoomLevel           = zoomLevel,
            };

            Assert.AreEqual(group.Position.X - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Sin(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.X);
            Assert.AreEqual(group.Position.Y - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Cos(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.Y);

            var newGroup = new JsonPassiveNodeGroup
            {
                OriginalX = x * 10,
                OriginalY = y * 10,
                ZoomLevel = zoomLevel,
            };

            node.PassiveNodeGroup = newGroup;
            node.ClearPositionCache();

            Assert.AreEqual(newGroup.Position.X - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Sin(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.X);
            Assert.AreEqual(newGroup.Position.Y - orbitRadii[orbitRadiiIndex] * zoomLevel * (float)Math.Cos(-2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[skillsPerOrbitIndex]), node.Position.Y);
        }
Exemplo n.º 2
0
        public void JsonPassiveNode_Convert(float _x, float _y, float zoomLevel, int orbitRadiiIndex, float[] orbitRadii, int skillsPerOrbitIndex, float[] skillsPerOrbit)
        {
            var group = new JsonPassiveNodeGroup
            {
                OriginalX = _x,
                OriginalY = _y,
                ZoomLevel = zoomLevel,
            };

            var node = new JsonPassiveNode
            {
                PassiveNodeGroup    = group,
                OrbitRadiiIndex     = orbitRadiiIndex,
                OrbitRadii          = orbitRadii,
                SkillsPerOrbitIndex = skillsPerOrbitIndex,
                SkillsPerOrbit      = skillsPerOrbit,
                ZoomLevel           = zoomLevel,
            };

            var nodeDefinition = PassiveNodeDefinition.Convert(node);
            var nodePosition   = node.PositionAtZoomLevel(1f);

            Assert.AreEqual(nodePosition.X, nodeDefinition.Position.X);
            Assert.AreEqual(nodePosition.Y, nodeDefinition.Position.Y);
        }
Exemplo n.º 3
0
        public bool JsonPassiveNode_IsAscendancyNode(string ascendancyName)
        {
            var node = new JsonPassiveNode
            {
                AscendancyName = ascendancyName
            };

            return(node.IsAscendancyNode);
        }
Exemplo n.º 4
0
        public void JsonPassiveNode_StartingCharacterClass(CharacterClass?characterClass)
        {
            var node = new JsonPassiveNode()
            {
                StartingCharacterClass = characterClass
            };

            Assert.AreEqual(characterClass.HasValue, node.IsRootNode);
            Assert.AreEqual(characterClass, node.StartingCharacterClass);
        }
Exemplo n.º 5
0
        public void JsonPassiveNode_Arc(int orbitRadiiIndex, float[] orbitRadii, int skillsPerOrbitIndex, float[] skillsPerOrbit)
        {
            var node = new JsonPassiveNode
            {
                OrbitRadiiIndex     = orbitRadiiIndex,
                OrbitRadii          = orbitRadii,
                SkillsPerOrbitIndex = skillsPerOrbitIndex,
                SkillsPerOrbit      = skillsPerOrbit,
            };

            Assert.AreEqual(2 * Math.PI * skillsPerOrbitIndex / skillsPerOrbit[orbitRadiiIndex], node.Arc);
        }
Exemplo n.º 6
0
        public PassiveNodeType JsonPassiveNode_PassiveNodeType(PassiveNodeType passiveNodeType)
        {
            var node = new JsonPassiveNode
            {
                IsKeystone    = passiveNodeType == PassiveNodeType.Keystone,
                IsMastery     = passiveNodeType == PassiveNodeType.Mastery,
                IsNotable     = passiveNodeType == PassiveNodeType.Notable,
                IsJewelSocket = passiveNodeType == PassiveNodeType.JewelSocket,
            };

            return(node.PassiveNodeType);
        }