示例#1
0
        public void Test1()
        {
            IGodClass god = new GodClass();

            var tst = "abcdefgh";

            Assert.Equal(tst, god.Echo(tst));
        }
示例#2
0
        public void InitFromJSON(String text)
        {
            JObject testJson = JObject.Parse(text);

            attackSpeed = (double)testJson["attackSpeed"];
            moveSpeed   = (double)testJson["moveSpeed"];
            spriteImage = (string)testJson["spriteImage"];
            attackPwr   = (int)testJson["attackPwr"];
            maxHealth   = (int)testJson["maxHealth"];
            attackRange = (int)testJson["attackRange"];
            aggroRange  = (int)testJson["aggroRange"];
            colorName   = (string)testJson["color"];
            if (testJson.ContainsKey("armor"))
            {
                armor = (double)testJson["armor"];
            }
            else
            {
                armor = 0;
            }

            /*
             * if (testJson.ContainsKey("fillColor"))
             * {
             *  fillColorName = (string)testJson["fillColor"];
             *  drawColor = ConvertStringToColor(fillColorName);
             * }
             */
            if (testJson.ContainsKey("sprite"))
            {
                string spriteName = (string)testJson["sprite"];
                if (testJson.ContainsKey("animations"))
                {
                    animManager = new AnimationManager(spriteName, testJson);
                }
                else
                {
                    animManager = new AnimationManager(spriteName);
                }
                this.AddChild(animManager);
                animManager.Play("move");
            }
            if (testJson.ContainsKey("abilities"))
            {
                JArray abilities = (JArray)testJson["abilities"];

                foreach (JObject ability in abilities)
                {
                    string  abilityName     = (string)ability["actionName"];
                    JObject compileTimeArgs = (JObject)ability["compileTimeArgs"];
                    CardAct tempAction      = GodClass.GetAction(abilityName, compileTimeArgs);
                    this.abilityList.Add(tempAction);
                }
            }
        }
示例#3
0
        public async Task <List <AntiPatternBase> > DetectAsync(Solution roslynSolution)
        {
            var godClass = new GodClass();
            await godClass.ExtractFromRoslynSolutionAsync(roslynSolution);

            List <DetectionRule> detectionRules = new DetectionRuleFactory <T>().GetDetectionRules();
            var detectedAntiPatterns            = new List <AntiPatternBase>();

            foreach (var modelTree in godClass.ORMModelTrees)
            {
                foreach (var detectionRule in detectionRules)
                {
                    if (detectionRule.AppliesToModelTree(modelTree))
                    {
                        detectedAntiPatterns.AddRange(detectionRule.DetectedAntiPatterns);
                    }
                }
            }

            return(detectedAntiPatterns);
        }
示例#4
0
        private void ExecuteAction(MsgStruct msg)
        {
            int teamColor;

            //Parse actions
            switch (msg.type)
            {
            case MsgType.PlayCard:
                Debug.WriteLine("Play Card: " + msg.Message);
                string[] args = msg.Message.Split(';');
                if (args.Length > 1)
                {
                    string cardName = args[0];
                    int.TryParse(args[1], out teamColor);
                    GodClass.PlayCard(cardName, new int[] { teamColor });
                }
                break;

            default:
                break;
            }
        }
示例#5
0
        public void LogicInit(String text)
        {
            JObject cardJson = JObject.Parse(text);

            cardTitle = (string)cardJson["cardTitle"];
            cardText  = (string)cardJson["cardText"];
            cardImage = (string)cardJson["cardImage"];
            cardCost  = (int)cardJson["cardCost"];
            if (cardJson.ContainsKey("cardTiming"))
            {
                cardTiming = ((string)cardJson["cardTiming"]).ToLower() == "immediate" ? CardTimeOpts.Immediate : CardTimeOpts.Queued;
            }

            JArray cardActions = (JArray)cardJson["cardActions"];

            foreach (JObject cardAction in cardActions)
            {
                string  cardName        = (string)cardAction["actionName"];
                JObject compileTimeArgs = (JObject)cardAction["compileTimeArgs"];
                CardAct tempAction      = GodClass.GetAction(cardName, compileTimeArgs);
                this.cardActionList.Add(tempAction);
            }
        }
示例#6
0
        private void InitGame()
        {
            this.cardHUD = new CardHUD(0, 0, (int)GodClass.CardHUDdimensions.GetHeight(),
                                       (int)GodClass.CardHUDdimensions.GetWidth(),
                                       this.gameplayLayer);
            this.cardHistory = new CardHistory((int)(GodClass.BattlefieldDimensions.GetWidth() * 0.4)
                                               , (int)(BattlefieldDimensions.GetHeight() * 0.95)
                                               , (int)(GodClass.BattlefieldDimensions.GetHeight())
                                               , (int)GodClass.BattlefieldDimensions.GetWidth()
                                               , this.gameplayLayer);
            this.battlefield = new UIcontainer(0,
                                               (int)GodClass.CardHUDdimensions.GetHeight(),
                                               (int)GodClass.BattlefieldDimensions.GetHeight(),
                                               (int)GodClass.BattlefieldDimensions.GetWidth(),
                                               this.gameplayLayer);
            GodClass.battlefield = battlefield;
            GodClass.cardHUD     = this.cardHUD;
            GodClass.cardHistory = this.cardHistory;

            gameplayLayer.AddChild(battlefield);
            gameplayLayer.AddChild(cardHUD);
            gameplayLayer.AddChild(cardHistory);
            targetLines = new List <CCDrawNode>();

            GodClass.gameplayLayer = gameplayLayer;
            GodClass.hudLayer      = hudLayer;
            GodClass.InitLibrary();

            InitGridManager();

            this.InitTeams();

            //InitScrollMap();

            GamesState = GameState.Playing;
        }
示例#7
0
 public void SetClass(string classStr)
 {
     //Debug.Log(classStr);
     if (classStr.Contains("Mage"))
     {
         godClass = GodClass.Mage;
     }
     if (classStr.Contains("Warrior"))
     {
         godClass = GodClass.Warrior;
     }
     if (classStr.Contains("Hunter"))
     {
         godClass = GodClass.Hunter;
     }
     if (classStr.Contains("Guardian"))
     {
         godClass = GodClass.Guardian;
     }
     if (classStr.Contains("Assassin"))
     {
         godClass = GodClass.Assassin;
     }
 }
示例#8
0
        public void Test3()
        {
            IGodClass god = new GodClass();

            Assert.Null(god.Zzz());
        }
示例#9
0
        public void Test4()
        {
            IGodClass god = new GodClass();

            Assert.Equal(0, god.Yyy());
        }
示例#10
0
        public void Test2()
        {
            IGodClass god = new GodClass();

            Assert.Equal(42, god.SuperMethod());
        }