public override void HandleInput(Microsoft.Xna.Framework.GameTime gameTime, GameLibrary.InputManager input)
        {
            Vector2 point;

            state = input.MouseState;

            foreach (Skeleton skeleton in ScreenManager.Input.SkeletonData)
            {
                if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
                {
                    if (((Manager)ScreenManager).Hand == "Left")
                    {
                        point = ScreenManager.Input.SkeletonToColorMap(skeleton.Joints[JointType.HandLeft].Position);
                    }

                    else
                    {
                        point = ScreenManager.Input.SkeletonToColorMap(skeleton.Joints[JointType.HandRight].Position);
                    }

                    Vector2 calibratedPoint = ((Manager)ScreenManager).kTrackedObj.TranslatePoint(point);

                    state = new MouseState((int)calibratedPoint.X, (int)calibratedPoint.Y, state.ScrollWheelValue, state.LeftButton, state.MiddleButton, state.RightButton, state.XButton1, state.XButton2);

                    break;
                }
            }

            base.HandleInput(gameTime, input);
        }
 bool handleMouseDown(MouseEventArgs a, Vector3 v2, GameLibrary.Objekte.Node q)
 {
     Vector3 v = P.GetNewStartPosition(P.CurrNode.Position);
     float f = 100;
     P.CurrNode.getSet<gIColl>().AddCircle(v, f, true);
     P.OnBufferClick = null;
     return false;
 }
 bool handleMouseDown(MouseEventArgs a, Vector3 v2, GameLibrary.Objekte.Node q)
 {
     Vector3 v = P.GetNewStartPosition(hashedObject.Position);
     if (hashedObject.getSet<gCPrefPath_PS_Wrapper>() != null)
         hashedObject.getSet<gCPrefPath_PS_Wrapper>().AddPoint(v, stdRadius, true);
     else hashedObject.getSet<gCNavPath_PS_Wrapper>().AddPoint(v, stdRadius, true);
     P.OnBufferClick = null;
     return false;
 }
 bool handleMouseDown(MouseEventArgs a, Vector3 v2, GameLibrary.Objekte.Node q)
 {
     Vector3 v = P.GetNewStartPosition(hashedObject.Position);
     if (hashedObject.getSet<gCNavZone_PS_Wrapper>() != null)
         hashedObject.getSet<gCNavZone_PS_Wrapper>().AddPoint(v, true);
     else hashedObject.getSet<gCNegZone_PS_Wrapper>().AddPoint(v, true);
     P.CurrNode = hashedObject;
     P.OnBufferClick = null;
     return true;
 }
        /// <summary>
        /// Allows the screen to accept and handle input.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        /// <param name="input">The input manager that handles the different hardware inputs.</param>
        public override void HandleInput(Microsoft.Xna.Framework.GameTime gameTime, GameLibrary.InputManager input)
        {
            MouseState MouseState = input.MouseState;

            selectButton.Update(MouseState);
            cancelButton.Update(MouseState);

            patientList.Update(gameTime, MouseState);

            base.HandleInput(gameTime, input);
        }
Example #6
0
 public override Boolean hasFlag(GameLibrary.Model.Object.Object _Object)
 {
     if (_Object is GameLibrary.Model.Object.RaceObject)
     {
         return (_Object as GameLibrary.Model.Object.RaceObject).Race == this.race;
     }
     else
     {
         return false;
     }
 }
Example #7
0
 public override Boolean hasFlag(GameLibrary.Model.Object.Object _Object)
 {
     if (_Object is GameLibrary.Model.Object.FactionObject)
     {
         return (_Object as GameLibrary.Model.Object.FactionObject).Faction == this.faction;
     }
     else
     {
         return false;
     }
 }
Example #8
0
 public override Boolean hasFlag(GameLibrary.Model.Object.Object _Object)
 {
     if (_Object is Object.LivingObject)
     {
         return ((Object.LivingObject)_Object).HealthPoints < ((Object.LivingObject)_Object).MaxHealthPoints;
     }
     else
     {
         return false;
     }
 }
Example #9
0
 public static IGame Create(GameLibrary gameName)
 {
     switch (gameName)
     {
         case GameLibrary.Syn:
             return new Syn { Name = "Syn: The Sci-Fi Adventure!"};
         case GameLibrary.BubbleCommander:
             return new BubbleCommander(){Name = "Bubble Commander: The Last bubble!"};
         default:
             throw new ArgumentException("Sorry that game is not in the library!");
     }
 }
        public override void HandleInput(Microsoft.Xna.Framework.GameTime gameTime, GameLibrary.InputManager input)
        {
            MouseState mouseState = input.MouseState;

            selectButton.Update(mouseState);
            cancelButton.Update(mouseState);

            difficultyUpDown.Update(gameTime, mouseState);
            repetitionUpDown.Update(gameTime, mouseState);

            handList.Update(gameTime, mouseState);

            base.HandleInput(gameTime, input);
        }
Example #11
0
        public void GameLibraryUnknownExtension_Test()
        {
            var path = new DirectoryInfo(Path.GetTempPath())
                       .CreateSubdirectory(Path.GetFileNameWithoutExtension(Path.GetTempFileName()));
            var fs  = new PhysicalFileSystem();
            var gfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(path.FullName));

            var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>();

            optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}");
            var glib = new GameRecordLibrary(optionsBuilder);
            var ccs  = new ConfigurationCollectionStore(optionsBuilder);

            var gl = new GameLibrary(glib);

            Assert.Throws <KeyNotFoundException>(() => gl.GetExtension <IGameConfigurationExtensionProvider>());
            var game = gl.CreateGame("NINTENDO_NES");

            Assert.Throws <KeyNotFoundException>(() => game.GetExtension <IGameConfigurationExtension>());
        }
Example #12
0
 override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     base.OnStateEnter(animator, stateInfo, layerIndex);
     if (GameLibrary.IsMajorOrLogin())
     {
         if (null != UICreateRole.instance)
         {
             UICreateRole.instance.SetSpinWithMouse();
         }
         if (null != cs)
         {
             //cs.EndAppeared(1);
         }
         if (cs.type == ModelType.NPC)
         {
             cs.ShowNPCEffect(false);
         }
         return;
     }
 }
Example #13
0
 public void ChangeRunes(long id, int site)
 {
     this.site = 1 + site;
     if (id == 0)
     {
         runeSpr.enabled = false;
         runeBtn.enabled = false;
     }
     else
     {
         if (GameLibrary.Instance().ItemStateList.TryGetValue((int)id, out rune))
         {
             runeSpr.enabled      = true;
             runeBtn.enabled      = true;
             runeBtn.normalSprite = rune.icon_name;
         }
         //rune = FSDataNodeTable<RuneNode>.GetSingleton().FindDataByType((int)id);
         //VOManager.Instance().GetCSV<ItemCSV>("Item").GetVO(id);
     }
 }
Example #14
0
 void RefreshItem(GameObject item, long id, int count)
 {
     if (!GameLibrary.Instance().ItemStateList.ContainsKey(id))
     {
         return;
     }
     itemNode = GameLibrary.Instance().ItemStateList[id];
     if (itemNode.types == 6 || itemNode.types == 7)
     {
         item.transform.Find("Icon").GetComponent <UISprite>().atlas = ResourceManager.Instance().GetUIAtlas("UIHeroHead");
     }
     else
     {
         item.transform.Find("Icon").GetComponent <UISprite>().atlas = ResourceManager.Instance().GetUIAtlas("Prop");
     }
     ItemData.SetAngleMarking(item.transform.Find("Subscript").GetComponent <UISprite>(), itemNode.types);
     item.GetComponent <UISprite>().spriteName = ItemData.GetFrameByGradeType((GradeType)itemNode.grade);
     item.transform.Find("Icon").GetComponent <UISprite>().spriteName = itemNode.icon_name;
     item.transform.Find("Count").GetComponent <UILabel>().text       = "" + count;
 }
Example #15
0
 public void SetControlSwitch(bool b)
 {
     if (b)
     {
         canControlSwitch++;
     }
     else
     {
         canControlSwitch--;
     }
     if (cs == CharacterManager.playerCS)
     {
         SkillBuff mExistBuff = null;
         if (!b)
         {
             mExistBuff = SkillBuffManager.GetInst().GetSkillBuffListByCs(cs).Find(a => (SkillBuffType)a.id == SkillBuffType.Silence);
         }
         FightTouch._instance.ChangeAllCDTo(b ? b: !(mExistBuff == null && GameLibrary.Instance().CanControlSwitch(this)));
     }
 }
        public void Run()
        {
            int t0, t1;

            Log("GameLibCompiler started.");

            GameLib = new GameLibrary();
            t0      = Environment.TickCount;
            GameLib.LoadJson(GAMELIB_JSON_PATH);
            t1 = Environment.TickCount;
            Log("Json load: " + (t1 - t0) + " ms.");

            // save
            using (var file = File.Create(GAMELIB_BIN_PATH))
            {
                t0 = Environment.TickCount;
                Serializer.Serialize(file, GameLib.GetList().AsList());
                t1 = Environment.TickCount;
                Log("Bin  save: " + (t1 - t0) + " ms.");
            }

            // test load
            List <GardenItem> l;

            using (var file = File.OpenRead(GAMELIB_BIN_PATH))
            {
                t0 = Environment.TickCount;
                l  = Serializer.Deserialize <List <GardenItem> >(file);
                t1 = Environment.TickCount;
                Log("Bin  load test 1: " + (t1 - t0) + " ms.");
            }

            // test load 2
            t0 = Environment.TickCount;
            GameLibrary gl = new GameLibrary();

            gl.LoadBin(GAMELIB_BIN_PATH);
            t1 = Environment.TickCount;
            Log("Bin load test 2: " + (t1 - t0) + " ms.");
            int c = gl.GetList().Count;
        }
Example #17
0
    /// <summary>
    /// 计算全部进化所需要的金币(同品级内只计算金币数,不管材料够不够)
    /// </summary>
    /// <returns></returns>
    public long CalculateAllMoney()
    {
        long            costmoney = 0;
        List <ItemData> itemlist  = playerData.GetInstance().baginfo.itemlist;
        List <int>      siteList  = new List <int>();
        ItemNodeState   currentins;
        ItemNodeState   nextins;
        long            currentGold = playerData.GetInstance().baginfo.gold;

        for (int i = 0; i < playerData.GetInstance().selectHeroDetail.equipSite.Count; i++)
        {
            currentins = GameLibrary.Instance().ItemStateList[playerData.GetInstance().selectHeroDetail.equipSite[i + 1].id];
            if (ins.next_grade != 0)
            {
                nextins = GameLibrary.Instance().ItemStateList[currentins.next_grade];
            }
            else
            {
                nextins = null;
            }
            if (nextins != null)
            {
                //英雄品质不足的不计算钱
                int needlv = (1 + playerData.GetInstance().selectHeroDetail.grade) * playerData.GetInstance().selectHeroDetail.grade / 2 + 1;
                if (currentins.grade + 1 <= needlv)
                {
                    costmoney += nextins.syn_cost;
                }

                //if (IsItemCodition(nextins, ref currentGold))
                //{
                //    costmoney += nextins.syn_cost;
                //}
                //else
                //{
                //    continue;
                //}
            }
        }
        return(costmoney);
    }
Example #18
0
        public async Task GameLibraryIntegrationConfig_Test()
        {
            var path = new DirectoryInfo(Path.GetTempPath())
                       .CreateSubdirectory(Path.GetFileNameWithoutExtension(Path.GetTempFileName()));
            var fs  = new PhysicalFileSystem();
            var gfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(path.FullName));

            var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>();

            optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}");
            var glib = new GameRecordLibrary(optionsBuilder);
            var ccs  = new ConfigurationCollectionStore(optionsBuilder);

            var gl = new GameLibrary(glib);

            gl.AddExtension <IGameConfigurationExtensionProvider, IGameConfigurationExtension>
                (new GameConfigurationExtensionProvider(ccs));
            var game = gl.CreateGame("NINTENDO_NES");

            var profile = game.WithConfigurations()
                          .CreateNewProfile <ExampleConfigurationCollection>("TestConfiguration", "test");

            var profileGuid = profile.CollectionGuid;

            Assert.NotNull(game.WithConfigurations()
                           .GetProfile <ExampleConfigurationCollection>("TestConfiguration", profileGuid));

            Assert.NotEmpty(game.WithConfigurations().GetProfileNames());

            profile.Configuration.ExampleConfiguration.FullscreenResolution =
                Configuration.FullscreenResolution.Resolution1600X1050;
            gl.WithConfigurationLibrary().UpdateProfile(profile);
            var newProfile = game.WithConfigurations()
                             .GetProfile <ExampleConfigurationCollection>("TestConfiguration", profileGuid);

            Assert.Equal(Configuration.FullscreenResolution.Resolution1600X1050,
                         newProfile.Configuration.ExampleConfiguration.FullscreenResolution);

            game.WithConfigurations().DeleteProfile("TestConfiguration", profileGuid);
            Assert.Empty(game.WithConfigurations().GetProfileNames());
        }
Example #19
0
 void PlaySpecialAnimation()
 {
     GameLibrary.isBossChuChang = true;
     CharacterManager.instance.PlayerStop();
     if (bossSpawnMonster != null)
     {
         bossSpawnMonster.OnCreatMonster += (GameObject mBossObj, CharacterData cd) =>
         {
             mCurBoss = mBossObj.GetComponent <CharacterState>();
             if (mCurBoss.mBossShowCamera != null)
             {
                 AudioController.Instance.PlayEffectSound("BOSS/Boss_" + cd.attrNode.modelNode.modelPath, CharacterManager.playerCS);
                 mBossAI = mCurBoss.GetComponent <Boss_AI>();
                 if (mBossAI != null)
                 {
                     mBossAI.enabled = false;
                 }
                 GameLibrary.Instance().SetCsInvisible(CharacterManager.playerCS, true, skinned);
                 SetUICameraDepthAndCullingMask();
                 mCurBossAni = mCurBoss.pm.ani;
                 mCurBoss.pm.Enter();
                 mCurBoss.OnEnterOver += (mCs) =>
                 {
                     if (mBossAI != null)
                     {
                         mBossAI.enabled = true;
                     }
                     GameLibrary.isBossChuChang = false;
                     mCs.mBossShowCamera.gameObject.SetActive(false);
                     GameLibrary.Instance().SetCsInvisible(CharacterManager.playerCS, false, skinned);
                 };
                 mCurBoss.mBossShowCamera.gameObject.SetActive(true);
             }
             else
             {
                 GameLibrary.isBossChuChang = false;
             }
         };
         bossSpawnMonster.StartSpawn();
     }
 }
Example #20
0
    public List <GameObject> GetTargetByCondition(GameObject target, SkillNode skillNode)
    {
        List <GameObject> mTempMonsters = new List <GameObject>();

        Collider[] colliders = Physics.OverlapSphere(cs.transform.position, GameLibrary.Instance().GetSkillDistBySkillAndTarget(cs, skillNode), GameLibrary.GetAllLayer());
        for (int i = 0; i < colliders.Length; i++)
        {
            CharacterState mCurTargetCs = colliders[i].GetComponent <CharacterState>();
            if (mCurTargetCs != null)
            {
                Vector3 direction = mCurTargetCs.transform.position - cs.transform.position;
                if (GameLibrary.Instance().CheckHitCondition(skillNode, cs, mCurTargetCs) &&
                    (skillNode.isSingle ? (target == null ? false : target.transform == mCurTargetCs.transform) : true) &&
                    (skillNode.angle == 0 ? true : direction == Vector3.zero ? true : Vector3.Angle(cs.transform.forward, direction) <= skillNode.angle / 2))
                {
                    mTempMonsters.Add(colliders[i].gameObject);
                }
            }
        }
        return(mTempMonsters);
    }
Example #21
0
    public static GameObject CreateCharacter(CharacterAttrNode attrNode, GameObject parent, Vector3 pos = default(Vector3), int groupIndex = -99)
    {
        if (attrNode == null || attrNode.model == 0)
        {
            return(null);
        }

        string modelName = attrNode.modelNode.modelPath;

        if (attrNode is HeroAttrNode && !GameLibrary.IsMajorOrLogin())
        {
            modelName = attrNode.modelNode.modelLowPath;
        }
        string modelPath = attrNode.modelNode.modelRoot;

        if (groupIndex != -99)
        {
            modelName = modelName + groupIndex;
        }
        return(CreatPrefabs(modelName, parent, pos, modelPath));
    }
Example #22
0
 public void SetMainHeroLevel()
 {
     if (!GameLibrary.isNetworkVersion)
     {
         HeroData hd = playerData.GetInstance().GetHeroDataByID(GameLibrary.player);
         // ShowLv(null == hd ? 1 : hd.lvl);
         RefreshIconId(GameLibrary.SceneType(SceneType.PVP3) ? (int)Globe.challengeTeam[0].id : (int)GameLibrary.player);//初始化显示英雄头像
     }
     else
     {
         if (null == SceneBaseManager.instance)
         {
             //  UIRole.instance.RefreshLv(playerData.GetInstance().selfData.level);//经验值
         }
         else
         {
             //  ShowLv(Globe.Heros()[0].lvl);
         }
         RefreshIconId(null == SceneBaseManager.instance ? (int)GameLibrary.player : (int)Globe.Heros()[0].id);//初始化显示英雄头像
     }
 }
Example #23
0
 public int[] GetFrontEquipPropertyNum(ItemEquip Ie)
 {
     if (Ie != null && Ie.itemVO != null)
     {
         foreach (var item in GameLibrary.Instance().ItemStateList.Values)
         {
             if (Ie.itemVO.props_id == item.props_id)
             {
                 for (int i = 0; i < FrontEquipPropertyNum.Length; i++)
                 {
                     FrontEquipPropertyNum[i] = item.propertylist[i] + item.propertylist[i] * UI_HeroDetail.hd.lvl;
                 }
             }
         }
     }
     else
     {
         Debug.Log("Ie is null!!");
     }
     return(FrontEquipPropertyNum);
 }
Example #24
0
 public int[] GetQueenEquipPropertyNum(ItemEquip Ie)
 {
     if (Ie != null && Ie.itemVO != null)
     {
         foreach (var item in GameLibrary.Instance().ItemStateList.Values)
         {
             if (Ie.itemVO.props_id + 1 == item.props_id)
             {
                 for (int i = 0; i < QueenEquipPropertyNum.Length; i++)
                 {
                     QueenEquipPropertyNum[i] = item.propertylist[i];
                 }
             }
         }
     }
     else
     {
         Debug.Log("Ie is null!!");
     }
     return(QueenEquipPropertyNum);
 }
Example #25
0
 void PlayEntranceAnimation()
 {
     GameLibrary.isBossChuChang = true;
     CharacterManager.instance.PlayerStop();
     if (bossSpawnMonster != null)
     {
         bossSpawnMonster.OnCreatMonster += (GameObject mBossObj, CharacterData cd) =>
         {
             GameLibrary.Instance().SetCsInvisible(CharacterManager.playerCS, true, skinned);
             SetUICameraDepthAndCullingMask();
             GameObject mEntranceCamera = new GameObject("mEntranceCamera");
             mEntranceCamera.transform.parent = mBossObj.transform.parent;
             Camera mCamera = mEntranceCamera.AddComponent <Camera>();
             mCamera.depth       = Camera.main.depth + 1;
             mCamera.cullingMask = Camera.main.cullingMask;
             mCurBoss            = mBossObj.GetComponent <CharacterState>();
             mBossAI             = mCurBoss.GetComponent <Boss_AI>();
             if (mBossAI != null)
             {
                 mBossAI.enabled = false;
             }
             AddBossName();
             float mExtendSize = GetMeshSize(mCurBoss);
             mCurBoss.transform.forward              = CharacterManager.playerCS.transform.position - mCurBoss.transform.position;
             mEntranceCamera.transform.forward       = mCurBoss.transform.position - CharacterManager.playerCS.transform.position;
             mEntranceCamera.transform.position      = CharacterManager.playerCS.transform.position + mEntranceCamera.transform.forward * 0.1f;
             mEntranceCamera.transform.localPosition = new Vector3(mEntranceCamera.transform.localPosition.x, mCurBoss.transform.localPosition.y + mExtendSize + 0.05f, mEntranceCamera.transform.localPosition.z);
             float mExtendDis = Vector3.Distance(CharacterManager.playerCS.transform.position, mCurBoss.transform.position) - mExtendSize - mBossLength - mCamera.nearClipPlane - 0.1f;
             //if (cd.attrNode.icon_name.Equals("gw_082") || cd.attrNode.icon_name.Equals("gw_113")) mExtendDis -= mExtendSize * 2.0f;
             TweenPosition td = mEntranceCamera.AddComponent <TweenPosition>();
             SetTweenPositon(td, mEntranceCamera.transform.localPosition, mEntranceCamera.transform.localPosition + mEntranceCamera.transform.forward * mExtendDis,
                             UITweener.Style.Once, UITweener.Method.Linear, 0.5f);
             td.SetOnFinished(() =>
             {
                 SwitchSlowAnimation(mEntranceCamera, mCurBoss);
             });
         };
         bossSpawnMonster.StartSpawn();
     }
 }
Example #26
0
        public async Task TestCopyInstaller_IntegrationTest()
        {
            using var testStream = TestUtilities.GetResource("TestRoms.test.nes");
            using var fileStream = File.Create(Path.GetTempFileName() + ".nes");
            await testStream.CopyToAsync(fileStream);

            string fname = fileStream.Name;

            fileStream.Dispose();

            var path = new DirectoryInfo(Path.GetTempPath())
                       .CreateSubdirectory(Path.GetFileNameWithoutExtension(Path.GetTempFileName()));
            var fs  = new PhysicalFileSystem();
            var gfs = fs.GetOrCreateSubFileSystem(fs.ConvertPathFromInternal(path.FullName));

            var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>();

            optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}");
            var glib = new GameRecordLibrary(optionsBuilder);
            var flib = new FileRecordLibrary(optionsBuilder);

            var gl = new GameLibrary(glib);

            gl.AddExtension <GameFileExtensionProvider, IGameFileExtension
                             >(new GameFileExtensionProvider(flib, gfs));

            var game = gl.CreateGame("NINTENDO_NES");

            var stone   = new StoneProvider();
            var install = new SingleFileCopyInstaller(stone);

            await foreach (var res in install.Install(game, new List <FileSystemInfo>()
            {
                new FileInfo(fname)
            }))
            {
            }

            Assert.NotEmpty(game.WithFiles().FileRecords);
        }
Example #27
0
 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     base.OnStateUpdate(animator, stateInfo, layerIndex);
     if (cs == CharacterManager.playerCS & mIsStateStart && CheckAnimatorIsAttack(stateInfo))
     {
         CheckTouchKey();
         GetSkillNodeByStateInfo(stateInfo);
         if (mCurSkillNode != null)
         {
             if (stateInfo.normalizedTime > mCurSkillNode.castBefore)
             {
                 HandleSkill(animator, stateInfo, layerIndex);
             }
             if (skillIndex == 1 || skillIndex == 2)
             {
                 if (stateInfo.normalizedTime > 0.55)
                 {
                     HandleRun(animator, stateInfo, layerIndex);
                 }
             }
         }
         if (!mIsTriggerPassive && stateInfo.normalizedTime > 0.5f && cs.mCurMobalId == MobaObjectID.HeroJiansheng)
         {
             //添加剑圣普攻被动攻击计数判断逻辑
             pm.mCurAttackTime++;
             if (pm.mCurAttackTime == pm.mAmountAttackTime)
             {
                 //添加剑圣普攻被动攻击达到条件后添加武器特效
                 SkillNode mTempSkillNode = GameLibrary.Instance().GetCurrentSkillNodeByCs(cs, 3);
                 if (mTempSkillNode != null)
                 {
                     CharacterData characterData = null;
                     GameLibrary.Instance().SetSkillDamageCharaData(ref characterData, mTempSkillNode, cs);
                     cs.AddBuffManager(mTempSkillNode, cs, characterData);
                 }
             }
             mIsTriggerPassive = true;
         }
     }
 }
Example #28
0
        public void DrawACard_EmptyHandNonemptyLibrary_CardsInHand()
        {
            bool cardDrawnEventTriggered = false;

            GameLibrary lib = new GameLibrary();
            SelectableLinkedList <GameCard> cards = new SelectableLinkedList <GameCard>();

            cards.AddFirst(new MockCardWithData(42));
            lib.Add(cards);
            Hand   h = new Hand();
            Player p = new Player(lib, h, null, null);

            p.EventManager = this.EventManager;
            this.EventManager.Register(new Trigger <CardDrawnEvent>(_ => cardDrawnEventTriggered = true));
            Engine.AddActor(p);
            p.Draw(1);
            GameCard c = p.Hand.TakeCards(1)[0];

            Assert.IsTrue(cardDrawnEventTriggered);
            Assert.IsTrue(lib.IsEmpty());
            Assert.IsTrue(((MockCardWithData)c).data == 42);
        }
Example #29
0
    void Start()
    {
        List <long>  skills   = thisCs.GetSkills();
        List <float> skillCDs = new List <float>();

        skills.ForEach((long sid) => skillCDs.Add(AISkillHandler.GetNode(sid).cooling));
        aiSkillHandler.SetSkills(thisCs.GetSkills(), skillCDs);
        GameLibrary.bossBlood.ShowBlood(thisCs);
        //Thunder = Resources.Load("Thunder") as GameObject;

        //if (null != Thunder)
        //    InvokeRepeating("BeginThunder", 5, 5);

        if (GameLibrary.SceneType(SceneType.TD) || GameLibrary.SceneType(SceneType.ACT_GOLD) || GameLibrary.SceneType(SceneType.ACT_EXP))
        {
            thisCs.OnBeAttack += (c) =>
            {
                if (c.state == Modestatus.Player && thisCs.attackTarget != CharacterManager.playerCS)
                {
                    targetCs = CharacterManager.playerCS;
                    thisCs.SetAttackTargetTo(CharacterManager.playerCS);
                }
            };
        }

        thisCs.OnDead += (c) =>
        {
            for (int i = sumMonster.Count - 1; i >= 0; i--)
            {
                if (null != sumMonster[i])
                {
                    if (sumMonster[i].GetComponent <Monster_AI>())
                    {
                        sumMonster[i].GetComponent <Monster_AI>().StopMonsterAI();
                    }
                }
            }
        };
    }
Example #30
0
    /// <summary>
    /// 信息赋值
    /// </summary>
    /// <param name="obj"></param>
    public override void Info(object obj)
    {
        if (obj == null)
        {
            mailBtn.gameObject.SetActive(false);
            count.enabled = false;
        }
        else
        {
            itemNode = GameLibrary.Instance().ItemStateList[((ItemData)obj).Id];

            mailBtn.GetComponent <UISprite>().spriteName = itemNode.icon_name;
            count.text   = playerData.GetInstance().GetItemCountById(itemNode.props_id) + "";
            currentCount = playerData.GetInstance().GetItemCountById(itemNode.props_id);
            num.text     = "+" + GameLibrary.Instance().ItemStateList[itemNode.props_id].exp_gain.ToString() + "经验";
            propsData props = new propsData();
            props.id  = itemNode.props_id;
            props.num = GameLibrary.Instance().ItemStateList[itemNode.props_id].exp_gain * playerData.GetInstance().GetItemCountById(itemNode.props_id);
            propslist.Add(props);
            //propsDic.Add(itemNode.props_id, GameLibrary.Instance().ItemStateList[itemNode.props_id].exp_gain * playerData.GetInstance().GetItemCountById(itemNode.props_id));
        }
    }
Example #31
0
    public void Init(object info)
    {
        sceneEnter = transform.parent.parent.parent.GetComponent <UISceneEntry>();
        goodsTips  = sceneEnter.goodsTips.gameObject;

        infos = new int[((int[])info).Length];
        for (int i = 0; i < infos.Length; i++)
        {
            infos[i] = ((int[])info)[i];
        }

        item = GameLibrary.Instance().ItemStateList[long.Parse(((int[])info)[0].ToString())];

        if (item.types == 6)
        {
            icon.atlas = ResourceManager.Instance().GetUIAtlas("UIHeroHead");
        }

        ItemData.SetAngleMarking(soulStone, item.types);
        icon.spriteName    = item.icon_name;
        borderS.spriteName = ItemData.GetFrameByGradeType((GradeType)item.grade);
    }
Example #32
0
    public void NormalAttack(CharacterState target = null)
    {
        if (target == null)
        {
            target = thisCs.attackTarget;
        }
        if (target == null)
        {
            return;
        }

        float disRadius = thisCs.pm.nav.radius;

        if (BattleUtil.ReachPos(thisCs, target, thisCs.AttackRange + GameLibrary.Instance().GetExtendDis(target)))
        {
            if (CanAttack())
            {
                thisCs.pm.Stop();
                thisCs.pm.RotateTo(target.transform.position);
                thisCs.pm.ContinuousAttack();
                //Debug.LogError(Time.realtimeSinceStartup + " Do attack");
            }
            else if (!BattleUtil.ReachPos(thisCs, target, 0.2f))
            {
                thisCs.pm.Approaching(target.transform.position);
                //Debug.LogError(Time.realtimeSinceStartup + " move to " + target.transform.position);
            }
            else
            {
                thisCs.pm.Stop();
                //Debug.LogError(Time.realtimeSinceStartup + " Stop");
            }
        }
        else
        {
            thisCs.pm.Approaching(target.transform.position);
            //Debug.LogError(Time.realtimeSinceStartup + " move to " + target.transform.position);
        }
    }
Example #33
0
 void ShowBoos(MonsterData mCurMonsterData)
 {
     if (mCurMonsterData.attrNode == null)
     {
         Invoke("ShowBossSpawn", warningTime);
         Invoke("ShowMonster", warningTime + 0.8f);
     }
     else
     {
         GameLibrary.isBossChuChang = true;
         GameLibrary.Instance().SetCsInvisible(CharacterManager.playerCS, true, skinned);
         SetUICameraDepthAndCullingMask();
         CharacterManager.instance.PlayerStop();
         this.gameObject.SetActive(false);
         string     modelPath = mCurMonsterData.attrNode.modelNode.modelPath;
         GameObject go        = Resources.Load(GameLibrary.Effect_Boss + modelPath) as GameObject;
         if (go != null)
         {
             AudioController.Instance.PlayEffectSound("BOSS/Boss_" + modelPath, CharacterManager.playerCS);
             GameObject mCurBossEffect = Instantiate(go) as GameObject;
             mCurBossEffect.transform.position = bossobj.transform.position;
             Effect_LifeCycle lifeCycle = mCurBossEffect.GetComponent <Effect_LifeCycle>();
             Invoke("AddBossName", lifeCycle.cycle - 3.5f);
             lifeCycle.OnDesEff += () =>
             {
                 GameLibrary.isBossChuChang = false;
                 GameLibrary.Instance().SetCsInvisible(CharacterManager.playerCS, false, skinned);
                 Invoke("ShowBossSpawn", 0);
                 Invoke("ShowMonster", 0.8f);
             };
         }
         else
         {
             GameLibrary.isBossChuChang = false;
             Invoke("ShowBossSpawn", warningTime);
             Invoke("ShowMonster", warningTime + 0.8f);
         }
     }
 }
Example #34
0
    public void Update(IStatusHandler netStatusHandlerDelegate)
    {
        if (!IgnoreGlobalPause && GlobalPause && CurStatus != STATUS.DEAD)
        {
            return;
        }
        if (!IsPlayer && Time.frameCount % 4 > 0)
        {
            return;
        }
        IStatus status = null;

        if (statusMap.TryGetValue(CurStatus, out status))
        {
            status.UpdateLogic();
            if (!IsLockAutoChange() && mActionController.IsUnderControl())
            {
                STATUS next = status.GetNextStatus();
                if (next != STATUS.NONE)
                {
                    next = GameLibrary.Instance().SetIdleStatusByScene(next);
                    if (UseNet && netStatusHandlerDelegate != null)
                    {
                        LockAutoChange();
                        netStatusHandlerDelegate.ChangeStatusTo(next);
                    }
                    else
                    {
                        ChangeStatusTo(next);
                    }
                }
            }
        }
        else
        {
            Debug.Log("Invalid Status:" + CurStatus);
        }
    }
Example #35
0
 public override void Init(SkillNode skillNode, GameObject targetTrans, Transform thisTrans, VoidResult action = null)
 {
     base.Init(skillNode, targetTrans, thisTrans, action);
     transform.localScale = Vector3.zero;
     if (thisTrans)
     {
         FindBip(thisTrans, ref startPoint);
     }
     if (targetTrans != null)
     {
         if (mHitTargetCs.state == Modestatus.Tower)
         {
             targetPoint = hit;
         }
         else
         {
             FindBip(targetTrans.transform, ref targetPoint);
         }
     }
     isContinue = mCurSkillNode.interval_time != null && mCurSkillNode.interval_time.Length != 0;
     if (isContinue)
     {
         int count = mCurSkillNode.interval_time.Length;
         for (int i = 0; i < count; i++)
         {
             if (i == count - 1)
             {
                 CDTimer.GetInstance().AddCD(mCurSkillNode.interval_time[i], DestoryMe, 1);
             }
             CDTimer.GetInstance().AddCD(mCurSkillNode.interval_time[i], HitTarget, 1);
         }
     }
     else
     {
         DestoryMe(destoryTime);
     }
     mMaxDis = mCurSkillNode.max_fly + GameLibrary.Instance().GetExtendDis(mHitTargetCs);
 }
Example #36
0
    public List <GameObject> GetMultiTargetByCondition(SkillNode skillNode)
    {
        List <GameObject> mTempMonsters = new List <GameObject>();

        Collider[] colliders = Physics.OverlapSphere(cs.transform.position, GameLibrary.Instance().GetSkillDistBySkillAndTarget(cs, skillNode), GameLibrary.GetAllLayer());
        for (int i = 0; i < colliders.Length; i++)
        {
            CharacterState mCurTargetCs = colliders[i].GetComponent <CharacterState>();
            if (mCurTargetCs != null)
            {
                Vector3 direction = mCurTargetCs.transform.position - cs.transform.position;
                if (GameLibrary.Instance().CheckHitCondition(skillNode, cs, mCurTargetCs) && GameLibrary.Instance().IsInvisiblityCanSetTarget(cs, mCurTargetCs) &&
                    (skillNode.angle == 0 ? true : direction == Vector3.zero ? true : Vector3.Angle(cs.transform.forward, direction) <= skillNode.angle / 2))
                {
                    mTempMonsters.Add(mCurTargetCs.gameObject);
                }
            }
        }
        if (skillNode.target_ceiling != 0)
        {
            mTempMonsters.Sort((a, b) =>
            {
                if (a == cs.attackTarget)
                {
                    return(-1);
                }
                if (b == cs.attackTarget)
                {
                    return(1);
                }
                float aDis = Vector3.Distance(cs.transform.position, a.transform.position);
                float bDis = Vector3.Distance(cs.transform.position, b.transform.position);
                return(Mathf.FloorToInt(aDis - bDis));
            });
            mTempMonsters = mTempMonsters.GetRange(0, mTempMonsters.Count < skillNode.target_ceiling ? mTempMonsters.Count : skillNode.target_ceiling);
        }
        return(mTempMonsters);
    }
Example #37
0
        public void PlaytimeImportTest()
        {
            var gameId       = "tesId";
            var libPlugin    = new Mock <ILibraryPlugin>();
            var timeToImport = 500;

            libPlugin.Setup(a => a.Id).Returns(Guid.NewGuid());
            libPlugin.Setup(a => a.GetGames()).Returns(() => new List <Game>
            {
                new Game()
                {
                    GameId   = gameId,
                    Playtime = timeToImport,
                    PluginId = libPlugin.Object.Id
                }
            });

            using (var temp = TempDirectory.Create())
            {
                var db = new GameDatabase(temp.TempPath);
                db.OpenDatabase();
                GameLibrary.ImportGames(libPlugin.Object, db, true);
                Assert.AreEqual(timeToImport, db.Games.First().Playtime);

                timeToImport = 600;
                GameLibrary.ImportGames(libPlugin.Object, db, false);
                Assert.AreEqual(500, db.Games.First().Playtime);
                GameLibrary.ImportGames(libPlugin.Object, db, true);
                Assert.AreEqual(timeToImport, db.Games.First().Playtime);

                var g = db.Games.First();
                g.Playtime = 0;
                db.Games.Update(g);
                Assert.AreEqual(0, db.Games.First().Playtime);
                GameLibrary.ImportGames(libPlugin.Object, db, false);
                Assert.AreEqual(timeToImport, db.Games.First().Playtime);
            }
        }
Example #38
0
    public void SetIntersifyData(int index, long itemid)
    {
        if (index > 3)
        {
            return;
        }

        itemarr[index] = GameLibrary.Instance().ItemStateList[itemid];

        equipstepfram[index].spriteName = UISign_in.GetspriteName(ed.grade);
        if (itemarr[index].types == 1)
        {
            equipstepbutton[index].AtlasName = ResourceManager.Instance().GetUIAtlas("UIEquip");
        }
        else
        {
            equipstepbutton[index].AtlasName = ResourceManager.Instance().GetUIAtlas("Prop");
        }
        equipstepbutton[index].spriteName = itemarr[index].icon_name;
        equipstepfram[index].gameObject.SetActive(true);
        select.transform.parent        = equipstepfram[index].transform;
        select.transform.localPosition = Vector3.zero;
        equipLv[index].text            = "";
        this.index = index;
        for (int i = index + 1; i < 4; i++)
        {
            equipstepfram[i].gameObject.SetActive(false);
        }
        if (index == 0)
        {
            evolveDlg.gameObject.SetActive(true);
            equipCompoundPanel.gameObject.SetActive(false);
        }
        else
        {
            equipCompoundPanel.InitData(itemarr[index]);
        }
    }
Example #39
0
 void SetLockTarget()
 {
     mTouches = Input.touches;
     if (Input.GetMouseButtonDown(0) || mTouches.Length > 0)
     {
         if (mTouches.Length > 0)
         {
             for (int i = 0; i < mTouches.Length; i++)
             {
                 Touch touch = mTouches[i];
                 if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
                 {
                     mIsTouched = true;
                     mTouchPos  = touch.position;
                 }
             }
         }
         else
         {
             mIsTouched = true;
             mTouchPos  = Input.mousePosition;
         }
     }
     if (mIsTouched)
     {
         mIsTouched = false;
         Ray        ray = Camera.main.ScreenPointToRay(mTouchPos);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit, GameLibrary.GetMaxRayDistance(), GameLibrary.GetAllLayer()))
         {
             CharacterState hitCS = hit.transform.GetComponent <CharacterState>();
             if (hitCS != null && hitCS.groupIndex != playerGroupIndex)
             {
                 lockedTarget = hitCS;
             }
         }
     }
 }
Example #40
0
        public void BasicEventsTest()
        {
            GameLibrary   gameLibrary   = new GameLibrary();
            GamerCustomer gamerCustomer = new GamerCustomer(gameLibrary);

            gameLibrary.AddGame(new Game("Uncharted", "Naughty Dog", "PS4"));
            Assert.AreEqual(0, gamerCustomer.InterestedGames.Count);

            gameLibrary.AddGame(new Game("God of War 3", "Santa Monica", "PS4"));
            Assert.AreEqual(1, gamerCustomer.InterestedGames.Count);

            gameLibrary.AddGame(new Game("Last of US", "Naughty Dog", "PS4"));
            Assert.AreEqual(1, gamerCustomer.InterestedGames.Count);

            gameLibrary.AddGame(new Game("God of War 2018", "Santa Monica", "PS4"));
            Assert.AreEqual(2, gamerCustomer.InterestedGames.Count);

            gameLibrary.AddGame(new Game("Last of US", "Naughty Dog", "PS4"));
            Assert.AreEqual(2, gamerCustomer.InterestedGames.Count);

            gameLibrary.AddGame(new Game("Odessy", "Ubisoft", "PS4"));
            Assert.AreEqual(3, gamerCustomer.InterestedGames.Count);
        }
Example #41
0
 public FactionFlag(GameLibrary.Factory.FactoryEnums.FactionEnum _FactionEnum)
 {
     this.faction = GameLibrary.Factory.BehaviourFactory.behaviourFactory.getFaction(_FactionEnum);
 }
 // UTILITY FUNCTIONS!
 /// <summary>
 /// Adds the screen to the manager and chills out.
 /// </summary>
 /// <param name="screen"></param>
 /// (That is, it stops redrawing and taking input).
 protected void AddScreenAndChill(GameLibrary.Screen screen)
 {
     ScreenManager.AddScreen(screen, false);
     ScreenState = GameLibrary.State.Hidden;
 }
        public override void HandleInput(Microsoft.Xna.Framework.GameTime gameTime, GameLibrary.InputManager input)
        {
            MouseState = input.MouseState;

            base.HandleInput(gameTime, input);
        }
Example #44
0
 private void dCam(GameLibrary.Rendering.RenderInformation rI)
 {
     string pos = "Camera Position : " + rI.CameraPosition.ToString();
     string tar = "Camera target : " + rI.ViewLookAt.ToString();
     string fps = "FPS : " + GameLibrary.Rendering.DrawFrame.FPS.ToString();
     int x = 0;
     int y = 40;
     tRenderer.DrawString(pos, x + 0, y + 0);
     tRenderer.DrawString(tar, x + 0, y + SPacing);
     tRenderer.DrawString(fps, x + 0, y + SPacing + SPacing);
 }
Example #45
0
 public override Boolean hasFlag(GameLibrary.Model.Object.Object _Object)
 {
     return _Object is GameLibrary.Model.Object.CreatureObject;
 }
Example #46
0
        public void DoProcess(GameLibrary.Rendering.RenderInformation rI)
        {
            BoundingBox B = new BoundingBox(P.CurrNode.Position - new Vector3(scale), P.CurrNode.Position + new Vector3(scale));
            if (rI.BoundingFrustums[0].Contains(B) == ContainmentType.Disjoint)
                return;
            Matrix m = P.CurrNode.Matrix;
            Vector3 po = P.CurrNode.Position;
            Quaternion q = P.CurrNode.Rotation;
            if (P.CoordSystem == eECoordinateSystem.eECoordinateSystem_Independent)
            {
                m = Matrix.Translation(po);
                q = Quaternion.Identity;
            }
            Vector3 axisx = Vector3.Transform(Vector3.UnitX * scale, q).ToVec3();
            Vector3 axisy = Vector3.Transform(Vector3.UnitY * scale, q).ToVec3();
            Vector3 axisz = Vector3.Transform(Vector3.UnitZ * scale, q).ToVec3();
            Vector2 o = ManagedWorld.NodeLibrary.Camera.Project(Vector3.Transform(Vector3.Zero, m).ToVec3(), P.BackBuffer);
            Vector2 p1 = ManagedWorld.NodeLibrary.Camera.Project(axisx + po, P.BackBuffer);
            Vector2 p2 = ManagedWorld.NodeLibrary.Camera.Project(axisy + po, P.BackBuffer);
            Vector2 p3 = ManagedWorld.NodeLibrary.Camera.Project(axisz + po, P.BackBuffer);
            Vector2 p2_xz = ManagedWorld.NodeLibrary.Camera.Project(po + axisx * s + axisz * s, P.BackBuffer);
            Vector2 p2_yz = ManagedWorld.NodeLibrary.Camera.Project(po + axisy * s + axisz * s, P.BackBuffer);
            Vector2 p2_yx = ManagedWorld.NodeLibrary.Camera.Project(po + axisx * s + axisy * s, P.BackBuffer);

            E.Variables["ColorA"].SetVariable(doColors());
            E.Variables["WVP"].SetVariable(m * rI.ViewMatrix * rI.ProjectionMatrix);
            Device.OutputMerger.DepthComparison = Comparison.Always;
            meshBuffer.DrawBufferNonIndexed(E.Techniques[0].Passes[0]);
            tRenderer.StartStrip();
            tRenderer.DrawString("X", (int)p1.X - 15, (int)p1.Y, selection == 0 ? Color.Red : Color.White);
            tRenderer.DrawString("Y", (int)p2.X - 15, (int)p2.Y, selection == 1 ? Color.Red : Color.White);
            tRenderer.DrawString("Z", (int)p3.X - 15, (int)p3.Y, selection == 2 ? Color.Red : Color.White);
            if(selection == 3)
                tRenderer.DrawString("XZ", (int)p2_xz.X - 15, (int)p2_xz.Y, Color.Red);
            if (selection == 4)
                tRenderer.DrawString("YZ", (int)p2_yz.X - 15, (int)p2_yz.Y, Color.Red);
            if (selection == 5)
                tRenderer.DrawString("YX", (int)p2_yx.X - 15, (int)p2_yx.Y, Color.Red);
            Device.OutputMerger.DepthComparison = Comparison.LessEqual;
            tRenderer.Batch();
        }
Example #47
0
        public void DoProcess(GameLibrary.Rendering.RenderInformation rI)
        {
            tRenderer.StartStrip();
            P.BackBuffer.SetTarget();
            //dCam(rI);
            if (P.CurrNode != null)
            {
                ILrentObject n = P.CurrNode;
                string pos = "Position : " + n.Position.ToString();
                string name = "Name : " + n.Name;
                string lFile = "Lrent File : " + n.File.Name;

                if (P.BackBufferControl.Width > 1000)
                {
                    int w = tRenderer.getStringWidthInPixels(pos);
                    int x = P.BackBufferControl.Width - w - 10;
                    int y = 40;
                    tRenderer.DrawString(pos, x, y);
                    w = tRenderer.getStringWidthInPixels(name);
                    x = P.BackBufferControl.Width - w - 10;
                    y = 40 + SPacing;
                    tRenderer.DrawString(name, x, y);
                    w = tRenderer.getStringWidthInPixels(lFile);
                    x = P.BackBufferControl.Width - w - 10;
                    y = 40 + SPacing + SPacing;
                    tRenderer.DrawString(lFile, x, y);
                }
                else
                {

                }
            }
            tRenderer.Batch();
        }
 public LabyrinthPathFinder(GameLibrary.Objects.Labyrinth.Labyrinth labyrinth)
 {
     _labyrinth = labyrinth;
 }
 private SystemController()
 {
     connection = Connection.getInstance();
     connection.registerErrorListener(Ids.ErrorHandlers.SystemController, onConnectionError);
     gameLibrary = new GameLibrary();
 }
Example #50
0
 public override Boolean hasFlag(GameLibrary.Model.Object.Object _Object)
 {
     return _Object is LivingObject ? ((LivingObject)_Object).IsDead : false;
 }
Example #51
0
 public Chunk.Chunk getChunkObjectIsIn(GameLibrary.Model.Object.Object _Object)
 {
     //TODO: Fehlerbehandlungen, falls LivingObject nicht in der Region ist --> Nullpointer da var_X oder var_Y zu klein/groß
     int var_X = (int)(_Object.Position.X / ((this.Position.X + 1) * Chunk.Chunk.chunkSizeX * Block.Block.BlockSize));
     int var_Y = (int)(_Object.Position.Y / ((this.Position.Y + 1) * Chunk.Chunk.chunkSizeY * Block.Block.BlockSize));
     if (var_X >= Region.regionSizeX || var_Y >= Region.regionSizeY)
     {
         Logger.Logger.LogErr("LivingObject befindet sich nicht in Region " + this.Id);
         return null;
     }
     else
     {
         return this.getChunkAtPosition(_Object.Position);
     }
 }
Example #52
0
 public static void On_TileSelectionManager_ComponentsSelected(Game.GUI.TileSelectionManager self, GameLibrary.ConstructionID con, List<int> mats)
 {
     if (initiatingJob != null && initiatingJob.Type == self.NextJob)
     {
         initiatingJob.ConstructionID = con;
         initiatingJob.Materials = mats.ToArray();
         Do_UpdateRightClickMenu(initiatingJob);
     }
 }
        public override void HandleInput(GameTime gameTime, GameLibrary.Input.InputState input)
        {
            base.HandleInput(gameTime, input);

            if (awaitCancel)
            {
                PlayerIndex index;

                if (cancel.Evaluate(input, ControllingPlayer, out index))
                {
                    Manager.AddScreen(new BackgroundScreen("Textures/hiscore", TransitionType.Fade), ControllingPlayer);
                    Manager.AddScreen(new MainMenuScreen("Space Hordes"), null);
                    ExitScreen();
                    SoundManager.Play("MenuCancel");
                }
            }

            foreach (InitialEntryScreen screen in initialEntryScreens)
            {
                if (screen != null)
                    screen.HandleInput(gameTime, input);
            }
        }
 public override Boolean hasFlag(GameLibrary.Model.Object.Object _Object)
 {
     return _Object is GameLibrary.Model.Object.EnvironmentObject;
 }
Example #55
0
 public RaceFlag(GameLibrary.Factory.FactoryEnums.RaceEnum _RaceEnum)
 {
     this.race = GameLibrary.Factory.BehaviourFactory.behaviourFactory.getRace(_RaceEnum);
 }
Example #56
0
 bool handleMouseDown2(MouseEventArgs a, Vector3 v, GameLibrary.Objekte.Node n)
 {
     BackBufferControl_MouseDown3(null, a);
     P.OnBufferClick = null;
     return false;
 }
Example #57
0
        public DataTable FindItems(IList<ItemID> itemIDs, GameLibrary.ItemQuality quality)
        {
            if (_gnomanEmpire == null)
            {
                throw new InvalidOperationException("You must LoadGame() prior to FindItems()");
            }

            Dictionary<int, List<Item>> searchResult = null;
            ItemsByQuality resultByQuality = null;

            DataTable itemTable = new DataTable("items");

            DataColumn cNum = new DataColumn("Num", typeof(string));
            itemTable.PrimaryKey = new DataColumn[] { itemTable.Columns.Add(cNum.ColumnName) };

            itemTable.Columns.Add("Name", typeof(string));
            itemTable.Columns.Add("Material", typeof(string));
            itemTable.Columns.Add("Quality", typeof(string));
            itemTable.Columns.Add("Location type", typeof(string));
            itemTable.Columns.Add("Location", typeof(string));
            itemTable.Columns.Add("Position", typeof(string));

            // When no object matches, the result can be null, or contain only empty lists.
            foreach (ItemID itemID in itemIDs)
            {
                resultByQuality  = _gnomanEmpire.Fortress.StockManager.ItemsByQuality(itemID);
                if (resultByQuality != null)
                    searchResult = resultByQuality.ItemsOfQualityOrHigher(quality).Items;
                else
                    searchResult = null;
                if (searchResult != null)
                {
                    foreach (var valuePair in searchResult)
                    {
                        List<Game.Item> list = valuePair.Value;
                        foreach (Game.Item item in list)
                        {
                            DataRow tmpRow = itemTable.NewRow();
                            int col = 0;

                            // Base attributes
                            tmpRow[col++] = item.ID;
                            tmpRow[col++] = Item.GroupName(item.ItemID);// item.Name();
                            tmpRow[col++] = item.MaterialName();
                            tmpRow[col++] = item.Quality;

                            // Parent type and parent
                            if (item.Parent != null)
                            {
                                if (item.Parent is Game.Character)
                                {
                                    tmpRow[col++] = "Gnome";
                                }
                                else if (item.Parent is Game.StorageContainer)
                                {
                                    tmpRow[col++] = "Container";
                                }
                                else
                                {
                                    tmpRow[col++] = "?"; // Default catcher. Could be monster?
                                }
                                tmpRow[col++] = item.Parent.Name();
                            }
                            else
                            {
                                tmpRow[col++] = "Ground";
                                tmpRow[col++] = "";
                            }

                            tmpRow[col++] = item.Position.ToString();

                            itemTable.Rows.Add(tmpRow);
                        }
                    }
                }
            }

            return itemTable;
        }
Example #58
0
 public override void DeSerialize(GameLibrary.IO.BinaryStream bs, DeviceApplication DA)
 {
     base.DeSerialize(bs, DA);
 }
Example #59
0
 public Region.Region getRegionObjectIsIn(GameLibrary.Model.Object.Object _Object)
 {
     foreach (Region.Region var_Region in this.regions)
     {
         if (_Object.Position.X >= var_Region.Position.X)
         {
             if (_Object.Position.X <= var_Region.Position.X + var_Region.Bounds.Width)
             {
                 if (_Object.Position.Y >= var_Region.Position.Y)
                 {
                     if (_Object.Position.Y <= var_Region.Position.Y + var_Region.Bounds.Height)
                     {
                         return var_Region;
                     }
                 }
             }
         }
     }
     return null;
 }
Example #60
0
 public abstract Boolean hasFlag(GameLibrary.Model.Object.Object _Object);