Beispiel #1
0
        public static long GetSelectedDeckId()
        {
            var config = new XmlDocument();
            var fs     =
                new FileStream(
                    (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                     "\\LogicBreakers\\Resources\\HearthStone\\config.xml"), FileMode.Open, FileAccess.Read);

            config.Load(fs);
            var list    = config.GetElementsByTagName("selectedDeck");
            var xmlNode = list[0].ChildNodes.Item(0);

            if (xmlNode == null)
            {
                return(DeckPickerTrayDisplay.Get().GetSelectedDeckID());
            }
            var name = xmlNode.InnerText.Trim();

            fs.Close();
            using (var enumerator = CollectionManager.Get().GetDecks().Values.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var current = enumerator.Current;
                    if (name == current.Name)
                    {
                        return(current.ID);
                    }
                }
            }
            return(DeckPickerTrayDisplay.Get().GetSelectedDeckID());
        }
        private void UpdateRelease()
        {
            this.detailsEditor.CommitChanges(this.CollectionManager);

            bool hasTrackArtists = this.release.Tracklist.Any(t => !string.IsNullOrEmpty(t.JoinedArtists));

            foreach (Track track in this.release.Tracklist)
            {
                if (hasTrackArtists)
                {
                    if (track.Artists.Join() != track.JoinedArtists)
                    {
                        track.Artists.Clear();
                        track.Artists.Add(new TrackArtist()
                        {
                            Artist = CollectionManager.GetOrCreateArtist(track.JoinedArtists)
                        });
                    }
                }
                else
                {
                    track.Artists.Clear();
                }
            }

            ThumbnailGenerator.UpdateReleaseThumbnail(release, this.imagesEditor);

            this.release.DateModified = DateTime.Now;
        }
Beispiel #3
0
        protected override void ApplicationStarted()
        {
            defaultCollection = CollectionManager.GetCollection();

            var levelBlueprint  = new LevelBlueprint();
            var levelEntity     = defaultCollection.CreateEntity(levelBlueprint);
            var player          = defaultCollection.CreateEntity(new PlayerBlueprint(_gameConfiguration.StartingFoodPoints));
            var playerView      = player.GetComponent <ViewComponent>();
            var playerComponent = player.GetComponent <PlayerComponent>();
            var levelComponent  = levelEntity.GetComponent <LevelComponent>();

            levelComponent.Level.DistinctUntilChanged()
            .Subscribe(x =>
            {
                var gameObject = playerView.View as GameObject;
                gameObject.transform.position = Vector3.zero;
                SetupLevel(levelComponent);
            });

            EventSystem.Receive <PlayerKilledEvent>()
            .Delay(TimeSpan.FromSeconds(_gameConfiguration.IntroLength))
            .Subscribe(x =>
            {
                levelBlueprint.UpdateLevel(levelComponent, 1);
                playerComponent.Food.Value = _gameConfiguration.StartingFoodPoints;
                SetupLevel(levelComponent);
            });
        }
Beispiel #4
0
        public static RsReportCollection LoadCollection(string aCollectionName)
        {
            if (!File.Exists(aCollectionName))
            {
                if (CRSMessageBox.ShowBox(
                        Locale.GetMessageTitle("collectionMissing"),
                        Locale.GetMessage("collectionMissing"),
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question
                        ) == DialogResult.No)
                {
                    return(null);
                }
            }

            return(CollectionManager.GetCollection(aCollectionName));

            //RsReportCollection lNewCollection = CollectionManager.GetCollection(aCollectionName);

#if DEMO
            try {
                long lVal    = ReportSmart.Authorization.AppAuth.chkshwauthfrw(ReportSmart.Authorization.AppAuth.crdtstamp(new DateTime(2010, 5, 23), _YM, _MM, _DM), _YM, _MM, _DM, _PERIOD);
                long lChkval = ReportSmart.Authorization.AppAuth.gnchkval(_YM, _MM, _DM, _PERIOD);
                Math.Sqrt(lVal - lChkval);
            } catch {
                KillApplication();
            }
#endif

            //lNewCollection.LoadFromXML(aCollectionName);
            //return lNewCollection;
        }
Beispiel #5
0
        public async Task <List <PhotoModelForMap> > GetPhotosForMapAsync(string id)
        {
            using (CollectionManager <PhotoModel> collectionManager =
                       new CollectionManager <PhotoModel>(database, Variables.MongoDBPhotosCollectionName))
                using (MyBlobStorageManager myBlobStorageManager =
                           new MyBlobStorageManager(Variables.BlobStorageConnectionString, id))
                {
                    var photosForMap = new List <PhotoModelForMap>();

                    var res = await collectionManager.mongoCollection.Find(
                        x => x.PhotoGpsLatitude != null &&
                        x.PhotoGpsLongitude != null).ToListAsync();

                    var sasKey = myBlobStorageManager.GetContainerSasUri(10);

                    foreach (var photo in res)
                    {
                        photosForMap.Add(new PhotoModelForMap
                        {
                            _id            = photo._id.ToString(),
                            IconPath       = photo.PhotoPhatIcon + sasKey,
                            PhotoName      = photo.ImageName,
                            PhotoLatitude  = photo.PhotoGpsLatitude ?? 0,
                            PhotoLongitude = photo.PhotoGpsLongitude ?? 0
                        });
                    }

                    return(photosForMap);
                }
        }
Beispiel #6
0
    public bool SetCollection(string type, string collectionName)
    {
        type           = type.ToLowerInvariant();
        collectionName = collectionName.ToLowerInvariant();

        var collection = string.Equals(collectionName, ModCollection.Empty.Name, StringComparison.InvariantCultureIgnoreCase)
            ? ModCollection.Empty
            : CollectionManager[collectionName];

        if (collection == null)
        {
            Dalamud.Chat.Print($"The collection {collection} does not exist.");
            return(false);
        }

        switch (type)
        {
        case "default":
            if (collection == CollectionManager.Default)
            {
                Dalamud.Chat.Print($"{collection.Name} already is the default collection.");
                return(false);
            }

            CollectionManager.SetCollection(collection, ModCollection.Type.Default);
            Dalamud.Chat.Print($"Set {collection.Name} as default collection.");
            return(true);

        default:
            Dalamud.Chat.Print(
                "Second command argument is not default, the correct command format is: /penumbra collection default <collectionName>");
            return(false);
        }
    }
Beispiel #7
0
        public async Task <List <PhotoModelForGallery> > GetPhotoForGalleryAsync(string userId, string tag = "")
        {
            List <PhotoModelForGallery> result = new List <PhotoModelForGallery>();

            using (CollectionManager <PhotoModel> collectionManager =
                       new CollectionManager <PhotoModel>(database, Variables.MongoDBPhotosCollectionName))
            {
                IAsyncCursor <PhotoModel> response = null;

                if (string.IsNullOrEmpty(tag) || string.IsNullOrWhiteSpace(tag))
                {
                    response = await collectionManager.mongoCollection.FindAsync(x => x.UserId == userId);
                }
                else
                {
                    response = await collectionManager.mongoCollection.FindAsync(x => x.Tags.Any(y => y.Equals(tag.ToLower())) &&
                                                                                 x.UserId == userId);
                }

                response.ToList().ForEach(x => result.Add(new PhotoModelForGallery()
                {
                    _id = x._id, PhotoPhatPreview = x.PhotoPhatPreview
                }));
            }

            result.Reverse();
            return(result);
        }
Beispiel #8
0
        protected void btnSearch_Click(object sender, ImageClickEventArgs e)
        {
            List <LeadView>  leads = null;
            List <UserStaff> users = null;
            int clientID           = 0;

            var predicate = buildPredicate();

            leads = LeadsManager.GetLeads(predicate).ToList();

            if (leads != null && leads.Count > 0)
            {
                gvUserLeads.DataSource = leads;

                gvUserLeads.DataBind();

                // load users
                clientID = SessionHelper.getClientId();

                users = SecUserManager.GetStaff(clientID);
                CollectionManager.FillCollection(ddlUsers, "UserId", "StaffName", users);

                pnlGrid.Visible = true;
                lblError.Text   = string.Empty;

                pnlSearch.Visible = false;
            }
            else
            {
                lblError.Text    = "No results found.";
                lblError.Visible = true;
            }
        }
        public override void OnViewCreated(IEntity entity, Object viewObject)
        {
            var viewComponent  = entity.GetComponent <ViewComponent>();
            var viewGameObject = instantiator.InstantiatePrefab(viewObject as GameObject);

            viewComponent.View = viewGameObject;


            var entityBinding = viewGameObject.GetComponent <EntityView>();

            if (entityBinding == null)
            {
                entityBinding                  = viewGameObject.AddComponent <EntityView>();
                entityBinding.Entity           = entity;
                entityBinding.EntityCollection = CollectionManager.GetCollectionFor(entity);
            }

            if (viewComponent.DestroyWithView)
            {
                viewGameObject.OnDestroyAsObservable()
                .Subscribe(x => entityBinding.EntityCollection.RemoveEntity(entity.Id))
                .AddTo(viewGameObject);
            }

            OnViewCreated(entity, viewComponent);
            entity.AddComponent <ViewReadyComponent>();
        }
Beispiel #10
0
    public override bool PreAnimateContentEntrance()
    {
        CollectionDeck taggedDeck = CollectionManager.Get().GetTaggedDeck(CollectionManager.DeckTag.Editing);

        this.UpdateCardBack(taggedDeck.CardBackID, false, null);
        return(true);
    }
Beispiel #11
0
 protected override void InitializeComponent(ICore core)
 {
     global::FoxTunes.BackgroundTask.ActiveChanged += this.OnActiveChanged;
     this.DatabaseFactory       = core.Factories.Database;
     this.PlaylistBrowser       = core.Components.PlaylistBrowser;
     this.SignalEmitter         = core.Components.SignalEmitter;
     this.SignalEmitter.Signal += this.OnSignal;
     this.ErrorEmitter          = core.Components.ErrorEmitter;
     this.Playlists             = new CollectionManager <Playlist>()
     {
         ItemFactory = () => new Playlist()
         {
             Name    = Playlist.GetName(this.Playlists.ItemsSource),
             Enabled = true
         },
         ExchangeHandler = (item1, item2) =>
         {
             var temp = item1.Sequence;
             item1.Sequence = item2.Sequence;
             item2.Sequence = temp;
         }
     };
     this.Dispatch(this.Refresh);
     base.InitializeComponent(core);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int clientID = SessionHelper.getClientId();
                carriers = CarrierManager.GetCarriers(clientID).ToList();
                CollectionManager.FillCollection(ddlCarrier, "CarrierID", "CarrierName", carriers);
                if (carriers != null)
                {
                    int[] carrierID = new int[carriers.Count];
                    for (var i = 0; i < carriers.Count; i++)
                    {
                        carrierID[i] = carriers[i].CarrierID;
                    }


                    List <CarrierLocation> CarrierLocationArr = new List <CarrierLocation>();

                    CarrierLocationArr = CarrierLocationManager.GetAllList(carrierID);

                    CollectionManager.FillCollection(gvLocation, "CarrierLocationID", "LocationName", CarrierLocationArr);
                }
                ddlCarrier.Items[0].Text = "Select All";
                gvLocation.Items[0].Text = "Select All";
                ddlCarrier.SelectedIndex = 0;
                gvLocation.SelectedIndex = 0;
            }
        }
Beispiel #13
0
        private void Update()
        {
            // Updates DeckList On Start
            var myDecks = CollectionManager.Get().GetDecks();

            if (myDecks.Count > 0 && !_loadedDecks)
            {
                DeckListToJson(myDecks);
                _loadedDecks = true;
                _needUpdate  = false;
            }
            // Updates Deck List After Editing Decks
            var gameMode = SceneMgr.Get().GetMode();

            switch (gameMode)
            {
            case SceneMgr.Mode.COLLECTIONMANAGER:
                if (!_needUpdate)
                {
                    _needUpdate = true;
                }
                break;

            default:
                if (_needUpdate)
                {
                    _loadedDecks = false;
                }
                break;
            }
        }
    public void SetBasicSetProgress(TAG_CLASS classTag)
    {
        int basicCardsIOwn = CollectionManager.Get().GetBasicCardsIOwn(classTag);
        int num2           = 20;

        if (basicCardsIOwn == num2)
        {
            this.m_classLabel.transform.position         = this.m_bones.m_classLabelOneLine.position;
            this.m_labelGradient.transform.parent        = this.m_bones.m_gradientOneLine;
            this.m_labelGradient.transform.localPosition = Vector3.zero;
            this.m_labelGradient.transform.localScale    = Vector3.one;
            this.m_setProgressLabel.gameObject.SetActive(false);
        }
        else
        {
            this.m_classLabel.transform.position  = this.m_bones.m_classLabelTwoLine.position;
            this.m_labelGradient.transform.parent = this.m_bones.m_gradientTwoLine;
            object[] args = new object[] { basicCardsIOwn, num2 };
            this.m_setProgressLabel.Text = GameStrings.Format((UniversalInputManager.UsePhoneUI == null) ? "GLUE_BASIC_SET_PROGRESS" : "GLUE_BASIC_SET_PROGRESS_PHONE", args);
            this.m_labelGradient.transform.localPosition = Vector3.zero;
            this.m_labelGradient.transform.localScale    = Vector3.one;
            this.m_setProgressLabel.gameObject.SetActive(true);
            this.m_setProgressLabel.TextColor = BASIC_SET_COLOR_IN_PROGRESS;
        }
    }
Beispiel #15
0
        public void bindData(int taskID)
        {
            int clientID = SessionHelper.getClientId();
            int userID   = SessionHelper.getUserId();

            List <UserStaff> owners = null;

            // load owners for this client
            owners = SecUserManager.GetStaff(clientID);
            CollectionManager.FillCollection(ddlOwner, "UserId", "StaffName", owners);

            // check user can assign user to event
            bool isAssignUsersToActivities = Core.PermissionHelper.checkAction((int)Globals.Actions.AssignUsersToActivities);


            if (isAssignUsersToActivities)
            {
                ddlOwner.Enabled = true;
            }
            else
            {
                ddlOwner.Enabled       = false;
                ddlOwner.SelectedValue = userID.ToString();
            }

            fillForm(taskID);
        }
    private void LoadVanillaHeroCardDef()
    {
        Player player = null;

        foreach (Player player2 in GameState.Get().GetPlayerMap().Values)
        {
            if (player2.GetSide() == Player.Side.FRIENDLY)
            {
                player = player2;
                break;
            }
        }
        if (player == null)
        {
            Debug.LogWarning("GoldenHeroEvent.LoadVanillaHeroCardDef() - currentPlayer == null");
        }
        else
        {
            EntityDef entityDef = player.GetEntityDef();
            if (entityDef.GetCardSet() == TAG_CARD_SET.HERO_SKINS)
            {
                string vanillaHeroCardID    = CollectionManager.Get().GetVanillaHeroCardID(entityDef);
                CardPortraitQuality quality = new CardPortraitQuality(3, TAG_PREMIUM.NORMAL);
                DefLoader.Get().LoadCardDef(vanillaHeroCardID, new DefLoader.LoadDefCallback <CardDef>(this.OnVanillaHeroCardDefLoaded), new object(), quality);
            }
        }
    }
Beispiel #17
0
        private void bindData()
        {
            List <UserStaff> users = null;

            // load tasks priorties
            ddlPriority.DataSource = TasksManager.GetPriorities(clientID);
            ddlPriority.DataBind();

            // load users
            users = SecUserManager.GetStaff(clientID);
            CollectionManager.FillCollection(ddlUsers, "UserId", "StaffName", users);

            // select user
            ddlUsers.SelectedValue = userID.ToString();

            if (roleID == (int)UserRole.Client || roleID == (int)UserRole.SiteAdministrator)
            {
                ddlUsers.Enabled = true;
            }
            else
            {
                // disable dropdown for user
                ddlUsers.Enabled = false;
            }


            // load appointment data
            if (TaskID > 0)
            {
                fillApppointmentForm(TaskID);
            }
        }
Beispiel #18
0
 public frmAddEditCollectionEntry(CollectionManager collMgr, CollectionEntryDetails collEntryDets, CollectionEntryForm type)
 {
     _collectionManager      = collMgr;
     _collectionEntryDetails = collEntryDets;
     _type = type;
     InitializeComponent();
 }
        public int CompareTo(object obj)
        {
            if (!(obj is CollectionCardStack.ArtStack))
            {
                throw new ArgumentException("Object is not an ArtStack.");
            }
            CollectionCardStack.ArtStack stack = obj as CollectionCardStack.ArtStack;
            EntityDef entityDef = DefLoader.Get().GetEntityDef(this.CardID);
            EntityDef def2      = DefLoader.Get().GetEntityDef(stack.CardID);

            if (!entityDef.Equals(def2))
            {
                return(CollectionManager.Get().EntityDefSortComparison(entityDef, def2));
            }
            if (!this.Flair.Equals(stack.Flair))
            {
                return(GameUtils.CardFlairSortComparisonAsc(this.Flair, stack.Flair));
            }
            if (!this.NewestInsertDate.Equals(stack.NewestInsertDate))
            {
                return(this.NewestInsertDate.CompareTo(stack.NewestInsertDate));
            }
            if (this.Count != stack.Count)
            {
                return(this.Count - stack.Count);
            }
            return(this.NumSeen - stack.NumSeen);
        }
Beispiel #20
0
        protected override void ApplicationStarted()
        {
            var defaultPool = CollectionManager.GetCollection();
            var viewEntity  = defaultPool.CreateEntity();

            viewEntity.AddComponents(new CustomViewComponent(), new PlayerControlledComponent(), new CameraFollowsComponent());
        }
Beispiel #21
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Expression <Func <Claim, bool> > predicate = null;
            List <AdjusterView> adjusters = null;
            List <LeadView>     leads     = null;

            predicate = buildPredicate();

            using (ClaimManager repository = new ClaimManager()) {
                leads = repository.Search(predicate).orderBy("ClaimantLastName").ToList();
            }

            gvSearchResult.DataSource = leads;
            gvSearchResult.DataBind();

            if (leads != null && leads.Count > 0)
            {
                pnlResult.Visible  = true;
                pnlToolbar.Visible = true;

                // load adjusters
                adjusters = AdjusterManager.GetClaimAssigned(clientID);

                gvAdjusters.DataSource = adjusters;
                gvAdjusters.DataBind();

                CollectionManager.FillCollection(ddlAdjuster, "AdjusterID", "AdjusterName", adjusters);
            }
        }
        private void InitializeSpriteCollection()
        {
            if (SpriteCollection != null)
            {
                return;
            }

            SpriteCollection = new List <pSprite>();

            List <string> list = CollectionManager.FindCollection(Name);

            if (list == null)
            {
                return;
            }

            int total  = list.Count;
            int delete = 0;

            for (int i = total - 1; i >= 0; i--)
            {
                //todo: this shouldn't be done in a sprite/view class.
                Beatmap map = BeatmapManager.GetBeatmapByChecksum(list[i]);
                if (map == null)
                {
                    CollectionManager.RemoveFromCollection(Name, list[i]); //map doesn't exist
                    delete++;
                }
            }
            Count = total - delete;
        }
    private void OnAdventureProgressUpdate(bool isStartupAction, AdventureMission.WingProgress oldProgress, AdventureMission.WingProgress newProgress, object userData)
    {
        List <CardRewardData> cardRewards = new List <CardRewardData>();

        if ((!isStartupAction && (newProgress != null)) && newProgress.IsOwned())
        {
            if (oldProgress == null)
            {
                this.TriggerWingProgressAction(true, newProgress.Wing, newProgress.Progress, cardRewards);
                this.TriggerWingFlagsAction(true, newProgress.Wing, newProgress.Flags, cardRewards);
            }
            else
            {
                bool flag = !oldProgress.IsOwned() && newProgress.IsOwned();
                if (flag || (oldProgress.Progress != newProgress.Progress))
                {
                    this.TriggerWingProgressAction(!flag, newProgress.Wing, newProgress.Progress, cardRewards);
                }
                if (oldProgress.Flags != newProgress.Flags)
                {
                    this.TriggerWingFlagsAction(true, newProgress.Wing, newProgress.Flags, cardRewards);
                }
            }
            CollectionManager.Get().AddCardRewards(cardRewards, false);
        }
    }
 private void Awake()
 {
     s_Instance = this;
     this.m_headlineText.Text        = GameStrings.Get("GLUE_MASS_DISENCHANT_HEADLINE");
     this.m_detailsHeadlineText.Text = GameStrings.Get("GLUE_MASS_DISENCHANT_DETAILS_HEADLINE");
     this.m_disenchantButton.SetText(GameStrings.Get("GLUE_MASS_DISENCHANT_BUTTON_TEXT"));
     if (this.m_detailsText != null)
     {
         this.m_detailsText.Text = GameStrings.Get("GLUE_MASS_DISENCHANT_DETAILS");
     }
     if (this.m_singleSubHeadlineText != null)
     {
         this.m_singleSubHeadlineText.Text = GameStrings.Get("GLUE_MASS_DISENCHANT_SUB_HEADLINE_TEXT");
     }
     if (this.m_doubleSubHeadlineText != null)
     {
         this.m_doubleSubHeadlineText.Text = GameStrings.Get("GLUE_MASS_DISENCHANT_SUB_HEADLINE_TEXT");
     }
     this.m_disenchantButton.SetUserOverYOffset(-0.04409015f);
     foreach (DisenchantBar bar in this.m_singleDisenchantBars)
     {
         bar.Init();
     }
     foreach (DisenchantBar bar2 in this.m_doubleDisenchantBars)
     {
         bar2.Init();
     }
     CollectionManager.Get().RegisterMassDisenchantListener(new CollectionManager.OnMassDisenchant(this.OnMassDisenchant));
 }
Beispiel #25
0
    public void OnPointerClick(PointerEventData eventData)
    {
        if (eventData.button == PointerEventData.InputButton.Left)
        {
            if ((lastClick + interval) > Time.time)
            {
                // Double Click
                GameObject        leaderPickerGo = transform.parent.parent.parent.gameObject;
                DeckController    deckController = leaderPickerGo.GetComponent <LeaderPicker>().deckController;
                CollectionManager deckCollection = leaderPickerGo.GetComponent <LeaderPicker>().deckCollection;
                // Change the leader in deck
                deckController.my_deck.Leader = leaderId;

                // Update middle info


                // Save deck
                deckCollection.OnDeckEdit();

                // Disable Leader Picker
                leaderPickerGo.SetActive(false);
            }
            else
            {
                // Single Click
            }
            lastClick = Time.time;
        }
    }
Beispiel #26
0
        public void CollectionManager_Changed_ChangeUntypedObject()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();

            var collectionManager = new CollectionManager(remoteMethodCall.Object);

            var objectToAdd = new TestDdpObject { integerField = 101, StringProperty = "addedTest"};

            collectionManager.Added(new Added { Collection = "Test", Fields = JObject.FromObject(objectToAdd), Id = "1" });

            var changed = new Changed
            {
                Cleared = null,
                Collection = "Test",
                Fields = new Dictionary<string, JToken>() {{"StringProperty", JToken.FromObject("changed!")}},
                ID = "1"
            };

            collectionManager.Changed(changed);

            var collection = collectionManager.GetCollection<TestDdpObject>("Test");

            Assert.AreEqual(1, collection.Count);

            objectToAdd.StringProperty = "changed!";
            objectToAdd.Id = "1";
            AssertDdpObjectsEqual(objectToAdd, collection.First());
        }
    public void CheckForTutorialComplete()
    {
        List <CardRewardData> cardRewards = new List <CardRewardData>();

        this.CheckForTutorialComplete(cardRewards);
        CollectionManager.Get().AddCardRewards(cardRewards, false);
    }
        public void Setup(IEntity entity)
        {
            var viewComponent = entity.GetComponent <ViewComponent>();

            if (viewComponent.View != null)
            {
                return;
            }

            var viewGameObject = CreateView(entity);

            viewComponent.View = viewGameObject;

            var entityBinding = viewGameObject.GetComponent <EntityView>();

            if (entityBinding == null)
            {
                entityBinding                  = viewGameObject.AddComponent <EntityView>();
                entityBinding.Entity           = entity;
                entityBinding.EntityCollection = CollectionManager.GetCollectionFor(entity);
            }

            if (viewComponent.DestroyWithView)
            {
                viewGameObject.OnDestroyAsObservable()
                .Subscribe(x => entityBinding.EntityCollection.RemoveEntity(entity.Id))
                .AddTo(viewGameObject);
            }
        }
 public frmAddEditCollection(CollectionManager collMgr, Collection collection, CollectionForm type)
 {
     _collectionManager = collMgr;
     _collection        = collection;
     _type = type;
     InitializeComponent();
 }
Beispiel #30
0
 /// <summary>
 /// 状态在第一次运行或切换时调用
 /// </summary>
 private void Start()
 {
     foreach (PlayerState state in playerStates)
     {
         //进行状态默认设置
         state.player = this;
         state.SetType();
     }
     //收集物品管理
     if (!collectionManager)
     {
         collectionManager = GameObject.Find("CollectionManager").GetComponent <CollectionManager>();
     }
     if (!gameController)
     {
         gameController = GameObject.Find("GameController").GetComponent <GameController>();
     }
     //设置默认状态
     if (!currentState)
     {
         currentState = GetComponent <Stand>();
     }
     if (!audioSource)
     {
         audioSource = GetComponent <AudioSource>();
     }
     flip = true;
     currentState.StateStart();
     animator       = GetComponent <Animator>();
     spriteRenderer = GetComponent <SpriteRenderer>();
 }
    private void Start()
    {
        if (instance != null)
        {
            return;
        }
        instance = this;

        for (int i = 0; i < DEFAULT_TOOL_COUNT * ChapterManager.CURR_SERVICE_CHAPTER; i++)
        {
            //toolStateDic.Add(i, PlayerPrefs.GetInt(string.Format("{0}{1}", toolStateDic, i), 2));
            //toolStateDic.Add(i, STATE_ROCK);
            //toolStateDic.Add(i, STATE_ACTIVATION);
            //toolStateDic.Add(i, STATE_AD);
            toolStateDic.Add(i, PlayerPrefs.GetInt(string.Format("{0}{1}", "toolStateDic", i), STATE_ROCK));
        }
        for (int i = 0; i < DEFAULT_FRIEND_COUNT * ChapterManager.CURR_SERVICE_CHAPTER; i++)
        {
            //friendStateDic.Add(i, PlayerPrefs.GetInt(string.Format("{0}{1}", friendStateDic, i), 2));
            //friendStateDic.Add(i, STATE_ROCK);
            //friendStateDic.Add(i, STATE_ACTIVATION);
            friendStateDic.Add(i, PlayerPrefs.GetInt(string.Format("{0}{1}", "friendStateDic", i), STATE_ROCK));
        }
        for (int i = 0; i < DEFAULT_TOOL_COUNT * 1; i++)
        {
            toolStateDic_S.Add(i, PlayerPrefs.GetInt(string.Format("{0}{1}", "toolStateDic_S", i), STATE_ROCK));
        }
        for (int i = 0; i < DEFAULT_FRIEND_COUNT * 1; i++)
        {
            friendStateDic_S.Add(i, PlayerPrefs.GetInt(string.Format("{0}{1}", "friendStateDic_S", i), STATE_ROCK));
        }
    }
        public void New_list_can_grow()
        {
            using (var manager = new CollectionManager(new SystemPageMemoryManager()))
            {
                var list = manager.NewList<int>(100);
                for (int i = 0; i < 300; i++)
                    list.Add(i);

                for (int i = 299; i >= 0; i--)
                    Assert.Equal(i, list[i]);
            }
        }
        public void New_list_can_be_used()
        {
            using (var manager = new CollectionManager(new HeapMemoryManager()))
            {
                var list = manager.NewList<int>();
                for (int i = 0; i < 100; i++)
                    list.Add(i);

                for (int i = 99; i >= 0; i--)
                    Assert.Equal(i, list[i]);
            }
        }
        public void New_array_can_be_used()
        {
            using (var manager = new CollectionManager(new HeapMemoryManager()))
            {
                var array = manager.NewArray<int>(100);
                for (int i = 0; i < 100; i++)
                    array[i] = i;

                var test = array.ToList();
                for (int i = 99; i >= 0; i--)
                    Assert.Equal(i, array[i]);
            }
        }
 void Awake()
 {
     if (it == null)
     {
         it = this;
         Init();
         DontDestroyOnLoad(gameObject);
     }
     else if (it != this)
     {
         Destroy(gameObject);
     }
 }
Beispiel #36
0
        public void CollectionManager_Removed_AddedRemovedFromUntypedCollection()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();

            var collectionManager = new CollectionManager(remoteMethodCall.Object);

            var objectToAdd = new TestDdpObject { integerField = 101, StringProperty = "addedTest"};

            collectionManager.Added(new Added { Collection = "Test", Fields = JObject.FromObject(objectToAdd), Id = "1" });
            collectionManager.Removed(new Removed() { Collection = "Test", Id="1"});

            var collection = collectionManager.GetCollection<TestDdpObject>("Test");

            Assert.AreEqual(0, collection.Count);
        }
        public void Out_of_boundaries_index_throws()
        {
            using (var manager = new CollectionManager(new HeapMemoryManager()))
            {
                var list = manager.NewList<int>(100);

                Assert.Throws<IndexOutOfRangeException>(() => list[-1]);
                Assert.Throws<IndexOutOfRangeException>(() => list[100]);
                Assert.Throws<IndexOutOfRangeException>(() => list[200]);

                Assert.Throws<IndexOutOfRangeException>(() => list[-1] = 5);
                Assert.Throws<IndexOutOfRangeException>(() => list[100] = 5);
                Assert.Throws<IndexOutOfRangeException>(() => list[200] = 5);
            }
        }
	// Use this for initialization
	void Start () {
        collectionManager = CollectionManager.GetComponent<CollectionManager>();
        collection = GameData.GetCollection(collectionName);
        buttonText = GetComponentInChildren<Text>();
        if (collection ==null)
        {
            buttonText.text = lockedText;
            //unlocked = false;
                
        }
        else
        {
            buttonText.text = collectionName.ToString();
            unlocked = true;
        }
	}
Beispiel #39
0
        public void CollectionManager_Added_PresentInTypedCollection()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();

            var collectionManager = new CollectionManager(remoteMethodCall.Object);

            var objectToAdd = new TestDdpObject {integerField = 101, StringProperty = "addedTest"};

            collectionManager.Added(new Added {Collection = "Test", Fields = JObject.FromObject(objectToAdd), Id = "1"});

            var collection = collectionManager.GetCollection<TestDdpObject>("Test");

            Assert.AreEqual(1, collection.Count);

            objectToAdd.Id = "1";
            AssertDdpObjectsEqual(objectToAdd, collection.First());
        }
Beispiel #40
0
        public void CollectionManager_Changed_NotExist()
        {
            var collectionManager = new CollectionManager(null);

            var changed = new Changed
            {
                Cleared = null,
                Collection = "Test",
                Fields = new Dictionary<string, JToken>() { { "StringProperty", JToken.FromObject("changed!") } },
                ID = "1"
            };

            ExceptionAssert.Throws<InvalidOperationException>(() => collectionManager.Changed(changed));
        }
Beispiel #41
0
        public void CollectionManager_Removed_NotExist()
        {
            var collectionManager = new CollectionManager(null);

            ExceptionAssert.Throws<InvalidOperationException>(() => collectionManager.Removed(new Removed() { Collection = "Test", Id = "1" }));
        }
Beispiel #42
0
        public void CollectionManager_Added_MultipleCollections()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();

            var collectionManager = new CollectionManager(remoteMethodCall.Object);

            var objectToAdd1 = new TestDdpObject { integerField = 101, StringProperty = "addedTest"};
            var objectToAdd2 = new TestDdpObject { integerField = 101, StringProperty = "addedTest"};
            var objectToAdd3 = new TestDdpObject { integerField = 101, StringProperty = "addedTest"};

            collectionManager.Added(new Added { Collection = "Test1", Fields = JObject.FromObject(objectToAdd1), Id = "1" });
            collectionManager.Added(new Added { Collection = "Test2", Fields = JObject.FromObject(objectToAdd2), Id = "2" });
            collectionManager.Added(new Added { Collection = "Test3", Fields = JObject.FromObject(objectToAdd3), Id = "3" });

            var collection1 = collectionManager.GetCollection<TestDdpObject>("Test1");
            var collection2 = collectionManager.GetCollection<TestDdpObject>("Test2");
            var collection3 = collectionManager.GetCollection<TestDdpObject>("Test3");

            Assert.AreEqual(1, collection1.Count);
            Assert.AreEqual(1, collection2.Count);
            Assert.AreEqual(1, collection3.Count);

            objectToAdd1.Id = "1";
            objectToAdd2.Id = "2";
            objectToAdd3.Id = "3";

            AssertDdpObjectsEqual(objectToAdd1, collection1.First());
            AssertDdpObjectsEqual(objectToAdd2, collection2.First());
            AssertDdpObjectsEqual(objectToAdd3, collection3.First());
        }
 public void Can_initialize_new_list()
 {
     using (var manager = new CollectionManager(new HeapMemoryManager()))
         manager.NewList<int>();
 }
 public void Can_initialize_new_array()
 {            
     using (var manager = new CollectionManager(new HeapMemoryManager()))
         manager.NewArray<int>(100);
 }
Beispiel #45
0
        public void CollectionManager_GetCollection_RetypeCollection()
        {
            var remoteMethodCall = new Mock<IDdpRemoteMethodCall>();

            var collectionManager = new CollectionManager(remoteMethodCall.Object);

            var collection1 = collectionManager.GetCollection<TestDdpObject>("Test");

            ExceptionAssert.Throws<InvalidCollectionTypeException>(
                () => { var collection2 = collectionManager.GetCollection<SimpleDdpObject>("Test"); });
        }