Summary description for ItemDisplayer
コード例 #1
0
 public void SubmitEntry(ItemDisplayer displayer, bool isMouse)
 {
     if (GetDragged != null)
     {
         EndDrag();
     }
 }
コード例 #2
0
    public void BeginDrag(ItemDisplayer newDragged)
    {
        if (GetDragged != null)
        {
            EndDrag(EndDragPosition.original);
        }

        GetDragged = newDragged;

        int startingIndex =
            GetDragged.isInventory ?
            GetDragged.itemIndex :
            itemGridPanel.displayersGrid.transform.childCount;

        if (EventSystemModifier.Current.IsUsingMouse)
        {
            GetDragged.transform.SetParent(topLayer);
        }
        else
        {
            GetDragged.SetNavigation(false);
            GetDragged.selectable.Select();
            GetDragged.SetBobbing(true);
        }

        itemGridPanel.BeginDrag(startingIndex);
    }
コード例 #3
0
    // destination :collection좌표,parent
    public void Initialize(Transform destination, Transform parent, Vector3 localPosition, Vector3 localScale, PLAY_SOUND_MODE playSoundMode, EXPANSION_MODE expansionMode, int amount, CollectingEffectController collectingEffectController)
    {
        _itemDisplayerTransform = destination;

        if (_displayer == DISPLAYER_MODE.GOLD)
        {
            _itemDisplayer = _itemDisplayerTransform.GetComponent <ItemDisplayer>();
        }
        else if (_displayer == DISPLAYER_MODE.TROPHY)
        {
            _itemDisplayer_trophy = _itemDisplayerTransform.GetComponent <ItemDisplayer_Trophy>();
        }
        else if (_displayer == DISPLAYER_MODE.EX)
        {
            _itemDisplayer_Ex = _itemDisplayerTransform.GetComponent <ItemDisplayer_Ex>();
        }
        else if (_displayer == DISPLAYER_MODE.NONE)
        {
            Debug.Log("Mode를 선택하여 주십시오");
        }



        transform.SetParent(parent);
        transform.localPosition = localPosition;
        transform.localScale    = localScale;

        _playSoundMode             = playSoundMode;
        _expansionMode             = expansionMode;
        _collectinEffectController = collectingEffectController;
        Amount = amount;
    }
コード例 #4
0
 /// <summary>
 /// This function allows you to initialize this ItemSlot.
 /// </summary>
 /// <param name="itemToRefer">The Item this ItemSlot refers to.</param>
 /// <param name="inventoryToUse">The players inventory this ItemSlot is currently using.</param>
 /// <param name="bodytypeToUse">The bodypart type this ItemSlot is currently using.</param>
 /// <param name="itemDisplayerToUse">The ItemDisplayer this ItemSlot is a part of.</param>
 public void Initialize(Item itemToRefer, PlayerInventory inventoryToUse, System.Type bodytypeToUse, ItemDisplayer itemDisplayerToUse)
 {
     AssignedItem     = itemToRefer;
     relatedInventory = inventoryToUse;
     relatedBodyType  = bodytypeToUse;
     owner            = itemDisplayerToUse;
 }
コード例 #5
0
 public void OnSelect(ItemDisplayer displayer)
 {
     if (displayer.isInventory && EventSystemModifier.Current.IsUsingMouse == false)
     {
         FocusScroll(displayers[displayer.itemIndex]);
     }
 }
コード例 #6
0
    private void DisplayAllItems()
    {
        Vector2 size = InventorySize;

        ItemDisplayer.Fill(R, slotPrefab, uiMask.transform, items, slots,
                           INVENTORY_SLOT_SIZE, INVENTORY_SLOT_SPACE, ClickEvent, HoverEvent, HoverExitEvent);
    }
コード例 #7
0
    private void UpdateEntry(int index, InventoryEntry entry)
    {
        ItemDisplayer displayer = displayers[index];

        displayer.itemIndex = index;
        displayer.SetCount(entry.count);
        displayer.SetIcon(entry.item.icon);
    }
コード例 #8
0
    private IEnumerator WaitAndDoIt()
    {
        yield return(new WaitForSeconds(0.2f));

        currentItemDisplayer.transform.SetParent(currentItemDisplayer.item.itemObject.transform);
        currentItemDisplayer.transform.position = currentItemDisplayer.item.itemObject.transform.position;
        currentItemDisplayer = null;
        discoveredScreen.SetActive(false);
    }
コード例 #9
0
 public void ShowItemInDiscoveredScreen(ItemDisplayer itemDisplayer)
 {
     discoveredScreen.SetActive(true);
     itemDisplayer.transform.SetParent(itemHolder.transform);
     itemDisplayer.transform.position = itemHolder.transform.position;
     descriptionBox.text  = itemDisplayer.item.discoverDescription;
     currentItemDisplayer = itemDisplayer;
     Inventory.inst.AddNewDiscoveredItem(itemDisplayer.item);
 }
コード例 #10
0
    public void SelectEntry(ItemDisplayer displayer)
    {
        var item = displayer.isInventory ?
                   playerEquipment.inventory[displayer.itemIndex].item :
                   playerEquipment.GetArms(displayer.itemIndex).armsScriptable;

        informationPanel.SetItem(item);
        itemGridPanel.OnSelect(displayer);
    }
コード例 #11
0
    /// <summary>
    /// When the player leaves the selectable area of the highlighted item, it become deselected
    /// </summary>
    /// <param name="other"></param>
    private void TryRemoveHighlightItem(Collider2D other)
    {
        ItemDisplayer item = other.GetComponent <ItemDisplayer>();

        if (item != null && this.itemToSelect != null && item.Equals(this.itemToSelect))
        {
            this.itemToSelect.DisableHighlight();
            this.itemToSelect = null;
        }
    }
コード例 #12
0
 public void ActualStart()
 {
     animator         = transform.GetChild(0).GetComponent <Animator>();
     itemDisplayer    = transform.GetChild(0).GetComponent <ItemDisplayer>();
     rectTransform    = GetComponent <RectTransform>();
     itemDragerParent = GameObject.FindGameObjectWithTag("ItemDragerParent");
     workSpace        = GameObject.FindGameObjectWithTag("WorkSpace");
     grid             = GameObject.FindGameObjectWithTag("Grid");
     rawImage         = transform.GetChild(0).GetComponent <RawImage>();
 }
コード例 #13
0
    public void OnDrop(PointerEventData eventData)
    {
        ItemDisplayer dragged = master.GetDragged;

        if (dragged != null)
        {
            master.EndDrag(InventoryPanel.EndDragPosition.original);

            if (dragged.isInventory)
            {
                master.playerEquipment.EquipArms(dragged.itemIndex, slot);
            }
            else
            {
                var            equipment       = master.playerEquipment;
                Armament.Slot  draggedFromSlot = (Armament.Slot)dragged.itemIndex;
                ArmamentPrefab prefab          = equipment.GetArms(draggedFromSlot);

                if (prefab == null)
                {
                    Debug.LogError("dragged equipment slot is invalid", this);
                }

                foreach (var equippedSlot in prefab.usedSlots)
                {
                    if (equippedSlot == slot)
                    {
                        return;
                    }
                }

                prefab.armsScriptable.EquipRequirements(equipment, slot, out _, out bool onlyEmpty);
                if (onlyEmpty && equipment.CanUnequip())
                {
                    ArmamentPrefab previous     = equipment.GetArms(slot);
                    bool           hasPrevious  = previous != null;
                    Armament       previousArms = null;
                    if (hasPrevious)
                    {
                        previousArms = previous.armsScriptable;
                    }

                    if (equipment.EquipArms(prefab.armsScriptable, slot))
                    {
                        equipment.UnequipArms(draggedFromSlot, -1, true);
                        if (hasPrevious)
                        {
                            equipment.FindItem(previousArms, out _, out int previousIndex);
                            equipment.EquipArms(previousIndex, draggedFromSlot);
                        }
                    }
                }
            }
        }
    }
コード例 #14
0
    private void InsertEntry(int index, InventoryEntry entry)
    {
        ItemDisplayer displayer = master.displayersPool.GenerateObject(displayersGrid.transform, index)
                                  .GetComponent <ItemDisplayer>();

        displayers.Insert(index, displayer);
        displayer.master      = master;
        displayer.isInventory = true;

        UpdateEntry(index, entry);
        UpdateInventoryIndexes(index + 1);
    }
コード例 #15
0
    private SoundManager soundManagerSE;       //サウンドエフェクト用のサウンドマネージャー

    //================================================================
    //コンポーネント参照用
    private void ComponentRef()
    {
        manager          = GameObject.Find("Manager").GetComponent <Manager>();
        parameterManager = GameObject.Find("ParameterManager").GetComponent <ParameterManager>();
        cursor           = transform.Find("Frame/Cursor").gameObject;
        frame            = transform.Find("Frame").gameObject;
        itemDisplayer    = transform.parent.parent.GetComponent <ItemDisplayer>();
        textBox          = GameObject.Find("Canvas/TextBox").GetComponent <TextBox>();
        inputManager     = GameObject.Find("InputManager").GetComponent <InputManager>();
        actionSaver      = GameObject.Find("ActionSaver").GetComponent <ActionSaver>();
        soundManagerSE   = GameObject.Find("SoundManagerSE").GetComponent <SoundManager>();
    }
コード例 #16
0
    public void EndDrag(EndDragPosition endPosition = EndDragPosition.newPosition)
    {
        if (GetDragged == null)
        {
            return;
        }

        var copy = GetDragged;

        GetDragged = null;

        itemGridPanel.EndDrag(copy, endPosition);
    }
コード例 #17
0
    private void UpdateTrade()
    {
        ///show player items
        ItemDisplayer.Fill(
            playerUI.rect,
            slotPrefab,
            playerUI.transform,
            playerInv.items,
            playerSlot,
            UiInventory.INVENTORY_SLOT_SIZE,
            UiInventory.INVENTORY_SLOT_SPACE,
            OnClickPlayerItem,
            (i) => i.RuntimeRef.canBeSoled);

        ///show npc items
        ItemDisplayer.Fill(
            npcUI.rect,
            slotPrefab,
            npcUI.transform,
            npcInv.items,
            npcSlot,
            UiInventory.INVENTORY_SLOT_SIZE,
            UiInventory.INVENTORY_SLOT_SPACE,
            OnClickNpcItem
            );

        ///show player trading items
        ItemDisplayer.Fill(
            playerTradeUI.rect,
            slotPrefab,
            playerTradeUI.transform,
            playerTradingItems,
            playerTradeSlot,
            UiInventory.INVENTORY_SLOT_SIZE,
            UiInventory.INVENTORY_SLOT_SPACE,
            OnClickPlayerTradingItem
            );

        ///show npc trading items
        ItemDisplayer.Fill(
            npcTradeUI.rect,
            slotPrefab,
            npcTradeUI.transform,
            npcTradingItems,
            npcTradeSlot,
            UiInventory.INVENTORY_SLOT_SIZE,
            UiInventory.INVENTORY_SLOT_SPACE,
            OnClickNpcTradingItem
            );
    }
コード例 #18
0
    public Item NewItemFromRecipe(Recipe recipe, byte slotNumber)
    {
        GameObject    itemObject    = Instantiate(itemObjectPrefab, outputSlotObject.transform.position, Quaternion.identity, outputSlotObject.transform);
        ItemDisplayer itemDisplayer = itemObject.transform.GetChild(0).GetComponent <ItemDisplayer>();
        Animator      animator      = itemDisplayer.GetComponent <Animator>();

        itemDisplayer.item = recipe.resultItems[slotNumber];
        SetOutputSlot(itemDisplayer.item);
        itemDisplayer.ActualStart();
        itemObject.GetComponent <DragHandler>().ActualStart();

        bool isItemInInventory = false;

        foreach (Item item in Inventory.inst.itemsInInventory)
        {
            if (item.name == itemDisplayer.item.name)
            {
                isItemInInventory = true;
                itemInQueuRecipe  = null;
                itemDisplayer.DisableItem();
                break;
            }
        }

        itemDisplayer.SetItemObject();

        if (!isItemInInventory)
        {
            animator.SetTrigger("NewItem");
        }

        bool isItemInDiscoveredItems = false;

        foreach (Item item in Inventory.inst.discoveredItems)
        {
            if (item.name == itemDisplayer.item.name)
            {
                isItemInDiscoveredItems = true;
                break;
            }
        }

        if (!isItemInDiscoveredItems)
        {
            DiscoveredScreen.inst.ShowItemInDiscoveredScreen(itemDisplayer);
        }

        return(itemDisplayer.item);
    }
コード例 #19
0
    /// <summary>
    /// When the player is getting to a lootable position, the item is getting highlighted and can be picked up
    /// </summary>
    /// <param name="other"></param>
    private void TryHighlightItem(Collider2D other)
    {
        ItemDisplayer item = other.GetComponent <ItemDisplayer>();

        if (item != null)
        {
            if (this.itemToSelect != null)
            {
                this.itemToSelect.DisableHighlight();
            }

            this.itemToSelect = item;
            this.itemToSelect.EnableHighlight();
        }
    }
コード例 #20
0
    public void EndDrag(ItemDisplayer draggedCopy, EndDragPosition endPosition)
    {
        if (draggedMouse)
        {
            emptyPlaceholder.SetParent(emptyPlaceholderStorage);

            if (draggedCopy.isInventory)
            {
                draggedCopy.transform.SetParent(displayersGrid.transform);
            }
        }
        else
        {
            draggedCopy.SetBobbing(false);
            draggedCopy.SetNavigation(true);
            draggedCopy.selectable.Select();
        }

        if (endPosition == EndDragPosition.newPosition)
        {
            var equipment = master.playerEquipment;

            if (draggedCopy.isInventory)
            {
                //this will induce further callbacks which corrects the dragged sibling index
                equipment.Reorder(draggedCopy.itemIndex, draggedSiblingIndex);
            }
            else if ((draggedInside &&
                      //this will induce further callbacks which corrects the position
                      equipment.UnequipArms((Armament.Slot)draggedCopy.itemIndex, draggedSiblingIndex))
                     == false)
            {
                master.equipmentPanel.ResetPosition((Armament.Slot)draggedCopy.itemIndex);
            }
        }
        else if (endPosition == EndDragPosition.original)
        {
            if (draggedCopy.isInventory)
            {
                draggedCopy.transform.SetSiblingIndex(draggedCopy.itemIndex);
            }
            else
            {
                master.equipmentPanel.ResetPosition((Armament.Slot)draggedCopy.itemIndex);
            }
        }
    }
コード例 #21
0
    private void OnEquipmentUpdate(Armament.Slot slot, ArmamentPrefab prefab)
    {
        ItemDisplayer displayer = itemDisplayers[(int)slot];

        if (prefab == null)
        {
            if (displayer == null)
            {
                //no changes needed
                return;
            }
            else
            {
                //displayer needs to be removed
                master.displayersPool.RemoveObject(displayer.gameObject);
                itemDisplayers[(int)slot] = null;
            }
        }
        else
        {
            ItemDisplayer itemDisplayer;
            Armament      arms = prefab.armsScriptable;

            if (displayer == null)
            {
                //displayer needs to be created
                itemDisplayer = itemDisplayers[(int)slot] = master.displayersPool.GenerateObject(equipmentSlots[(int)slot], 0)
                                                            .GetComponent <ItemDisplayer>();
                itemDisplayer.transform.localPosition = Vector3.zero;

                itemDisplayer.master      = master;
                itemDisplayer.isInventory = false;
                itemDisplayer.itemIndex   = (int)slot;
                itemDisplayer.SetIcon(arms.icon);
            }
            else
            {
                itemDisplayer = itemDisplayers[(int)slot];
            }

            itemDisplayer.SetCount(prefab.usedSlots.Length);
        }
    }
コード例 #22
0
ファイル: ItemDetails.aspx.cs プロジェクト: vatsal/getputs
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        DirectContactButton.Visible = false;

        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        categories = Categories.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            user = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(user))
        {
            //  Response.Redirect(links.LoginLink, false);
            MessageLabel.Text = gui.RedFontStart + "Please login to enter a comment." + gui.RedFontEnd;
        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (string.IsNullOrEmpty(Request.QueryString["IID"]))
        {
            Response.Redirect(links.FrontPageLink, false);
        }
        else
        {
            iid = Request.QueryString["IID"].Trim().ToLower();
        }

        if (!general.IsValidInt(iid))
        {

        }
        else
        {
            LoadItemDetails(iid);
            LoadComments(iid);
        }
    }
コード例 #23
0
ファイル: getputs_A.master.cs プロジェクト: vatsal/getputs
    protected override void OnInit(EventArgs e)
    {
        try
        {
            links = Links.Instance;
            gui = GUIVariables.Instance;
            dbOps = DBOperations.Instance;
            categories = Categories.Instance;
            log = Logger.Instance;
            engine = ProcessingEngine.Instance;
            general = General.Instance;
            imageEngine = ImageEngine.Instance;
            gui = GUIVariables.Instance;
            itemDisplayer = ItemDisplayer.Instance;

            if (Request != null)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["category"]))
                {
                    requestedTag = Request.QueryString["category"].Trim();
                }
            }

            #region CookieAlreadyExists
            //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

            if (Request.Cookies["getputsCookie"] != null)
            {
                HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
                UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
            }

            //TopAboutLabel.Text = "getputs is a utility for discovering, sharing and recommending user generated content."
            //    + gui.LineBreak
            //    + "Read/Post the latest/hottest news and classified submissions, ask queries, discuss your views!";

            TopAboutLabel.Text = gui.GrayFontStart
                + "getputs is a utility for discovering, sharing, and recommending news."
                + gui.GrayFontEnd;

            if (string.IsNullOrEmpty(UID))
            {
                TopAboutTable.Visible = true;

                //  If the Page is SLogin.aspx, then the LoginTable will not be visible.
                //  Else it is going to be visible in anycase.
                //  LoginTable.Visible = true;

                UsernameTB.Focus();
                Page.Form.DefaultButton = LoginButton.ID;

                //LoginHL.Visible = true;
                //RegisterHL.Visible = true;

                //  SubmitHL.Visible = false;
                SubmitHL.Visible = true;
                SavedHL.Visible = false;
                UserAccountHL.Visible = false;
                MyNewsHL.Visible = false;

                LogoutHL.Visible = false;

                UserWelcomeLabel.Text = "";

                PostItDiv.Visible = true;

            }
            else
            {
                TopAboutTable.Visible = false;

                LoginTable.Visible = false;

                //LoginHL.Visible = false;
                //RegisterHL.Visible = false;

                SubmitHL.Visible = true;
                SavedHL.Visible = true;
                UserAccountHL.Visible = true;
                MyNewsHL.Visible = true;

                LogoutHL.Visible = true;
                UserAccountHL.NavigateUrl = links.UserDetailsPageLink + "?UID=" + UID;

                //  UserWelcomeLabel.Text = gui.GrayFontStart + "Welcome " + UID + gui.GrayFontEnd;
                UserWelcomeLabel.Text = gui.BoldFontStart + gui.GreenFontStart + "Welcome " + UID + gui.GreenFontEnd + gui.BoldFontEnd;

                PostItDiv.Visible = false;

                //  Vatsal Shah | 2009-08-08 | LogVisitor() Throws a lot of errors. Thus commented for now.
                //  LogVisitor(UID);
            }

            //  PopularCategoriesLabel.Visible = false;
            //  CategoryDiv.Visible = false;
            //  MoreHL.Visible = false;

            //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
            #endregion CookieAlreadyExists

            RandomNewsHL.Text = gui.BlueFontStart + "Bored? " + gui.BlueFontEnd
                //  + gui.LineBreak
                + gui.GreenFontStart + "Read random stuff" + gui.GreenFontEnd;

            CopyrightLabel.Text = gui.SmallFontStart + gui.GrayFontStart
                + copyrightText
                + gui.GrayFontEnd + gui.SmallFontEnd;

            #region RandomQuoteFact
            Random randomQuoteFact = new Random();
            int randomQuoteFactInt = randomQuoteFact.Next(0, 100);

            if (randomQuoteFactInt % 2 == 0)    //  Serve Facts
            {
                gp.Files.FileLoader.FilePath = HttpRuntime.AppDomainAppPath + ConfigurationManager.AppSettings["FilesPath"];
                string randomFact = gp.Files.FactDB.Instance.GetRandomFact();
                if (!string.IsNullOrEmpty(randomFact))
                {
                    QuoteFactLiteral.Text = gui.BoldFontStart + gui.GreenFontStart + "getputs Fact: " + gui.GreenFontEnd + gui.BoldFontEnd + gui.LineBreak
                        + gui.GrayFontStart + randomFact + gui.GrayFontEnd;
                }
            }
            else    //  Serve Quotes
            {
                gp.Files.FileLoader.FilePath = HttpRuntime.AppDomainAppPath + ConfigurationManager.AppSettings["FilesPath"];
                string randomQuote = gp.Files.QuoteDB.Instance.GetRandomQuote();
                if (!string.IsNullOrEmpty(randomQuote))
                {
                    randomQuote = randomQuote.Replace("|", gui.LineBreak + " - <i>") + "</i>";
                    QuoteFactLiteral.Text = gui.BoldFontStart + gui.GreenFontStart + "getputs Quote: " + gui.GreenFontEnd + gui.BoldFontEnd + gui.LineBreak
                        + gui.GrayFontStart + randomQuote + gui.GrayFontEnd;
                }
            }
            #endregion RandomQuoteFact

            #region RandomTip

            gp.Files.FileLoader.FilePath = HttpRuntime.AppDomainAppPath + ConfigurationManager.AppSettings["FilesPath"];
            string randomTip = gp.Files.TipsDB.Instance.GetRandomTip();
            if (!string.IsNullOrEmpty(randomTip))
            {
                //  TipLiteral.Text = gui.MediumFontStart + gui.GrayFontStart + randomTip + gui.GrayFontEnd + gui.MediumFontEnd;
                TipLiteral.Text = randomTip;
            }

            #endregion RandomTip

            GetNavigationTableURL();
            LoadCategoryTable(UID);
            AddMouseEffects();

            //  Load the Carousels only for the Front-Page (Default.aspx)
            //  For all other pages CarouselDiv would be invisible.
            CarouselDiv.Visible = false;
            //  Make the TopAboutTable Invisible for any page other than the Front-Page (Default.aspx)
            TopAboutTable.Visible = false;

            StringBuilder strScript = new StringBuilder();
            strScript.Append("var itemImageList = [];");
            strScript.Append("var itemContentList = [];");
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "CarouselJavaScript", strScript.ToString(), true);

            //List<Item> itemList = engine.LoadItemDB(ProcessingEngine.Sort.New);
            //if (itemList != null && itemList.Count > 0)
            //{
            //    LoadItemImageCarousel(itemList);
            //    LoadItemNewsCarousel(itemList);
            //}

            ////  string pagename = System.IO.Path.GetFileName(Request.ServerVariables["SCRIPT_NAME"]);
            //string pagename = Path.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath);
            //if (links.FrontPageLink.EndsWith(pagename))     //  Load the Carousels only for the Front-Page (Default.aspx)
            //{
            //    List<Item> itemList = engine.LoadItemDB(ProcessingEngine.Sort.New);
            //    if (itemList != null && itemList.Count > 0)
            //    {
            //        LoadItemImageCarousel(itemList);
            //        LoadItemNewsCarousel(itemList);
            //    }

            //}
            //else    //  Do not show the CarouselDiv.
            //{
            //    CarouselDiv.Visible = false;

            //    //  Instantiate Empty JavaScriptLists so as to avoid Client Side Exceptions.
            //    StringBuilder strScript = new StringBuilder();
            //    strScript.Append("var itemImageList = [];");
            //    strScript.Append("var itemContentList = [];");
            //    Page.ClientScript.RegisterClientScriptBlock(GetType(), "CarouselJavaScript", strScript.ToString(), true);

            //    //  Make the TopAboutTable Invisible for any page other than the Front-Page (Default.aspx)
            //    TopAboutTable.Visible = false;
            //}

            //  SearchTB.Attributes.Add("onkeypress", "if ((event.which ? event.which : event.keyCode) == 13){var sendElem = document.getElementById(\"SearchButton\"); if(!sendElem.disabled) DoSearch(); }");
            //  SearchTB.Attributes.Add("onkeypress", "if ((event.which ? event.which : event.keyCode) == 13){document.getElementById('SearchButton').click()}");
            //  SearchTB.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + SearchButton.ID + "').click();return false;}} else {return true}; ");

        }
        catch (Exception ex)
        {
            if (log.isLoggingOn && log.isAppLoggingOn)
            {
                log.Log("Error in getputs.master: OnInit() Method: ");
                log.Log(ex);
            }
        }
    }
コード例 #24
0
    /// <summary>
    /// Make sure the selected item displayers is within the scroll view. Adjust the scroll view as necessary.
    /// </summary>
    public void FocusScroll(ItemDisplayer selected, int levelShift = 0)
    {
        RectTransform selectedRect = selected.RectTransform;
        bool          instantSnap;
        float         displayerTop;

        //anchor y positive goes up, negative down
        if (selected == master.GetDragged && draggedMouse)
        {
            if (selectedRect.position.x < displayersGridRect.position.x ||
                displayersGridRect.position.x + gridViewport.rect.width < selectedRect.anchoredPosition.x)
            {
                return;
            }

            RectTransformUtility.ScreenPointToLocalPointInRectangle(
                displayersGridRect, selectedRect.position, null, out Vector2 localPoint);

            localPoint.y += selectedRect.rect.height / 2.0f;

            float anchorY = displayersGridRect.anchoredPosition.y;

            displayerTop = Mathf.Clamp(
                anchorY + localPoint.y,
                anchorY - displayersGridRect.rect.height,
                anchorY);

            //slowly scroll towards the selected
            instantSnap = false;
        }
        else
        {
            displayerTop =
                displayersGridRect.anchoredPosition.y +
                selectedRect.anchoredPosition.y +
                selectedRect.rect.height / 2.0f -
                levelShift * (displayersGrid.cellSize.y + displayersGrid.spacing.y);

            //snap to the selected instantly
            instantSnap = true;
        }

        if (0 < displayerTop)
        {
            //selected is above the viewport

            Vector2 gridPosition = displayersGridRect.anchoredPosition;

            if (instantSnap)
            {
                gridPosition.y -= displayerTop + displayersGrid.padding.top;
            }
            else
            {
                gridPosition.y -= gridScrollRect.scrollSensitivity * Time.deltaTime * displayersGrid.cellSize.y;
            }

            displayersGridRect.anchoredPosition = gridPosition;
            return;
        }

        //this is negative
        float displayerBottom = -(displayerTop - selectedRect.rect.height);
        float viewPortHeight  = gridViewport.rect.height;

        if (viewPortHeight < displayerBottom)
        {
            //selected is bellow the bottom of the viewport

            Vector2 gridPosition = displayersGridRect.anchoredPosition;

            if (instantSnap)
            {
                gridPosition.y += displayerBottom - viewPortHeight + displayersGrid.padding.bottom;
            }
            else
            {
                gridPosition.y += gridScrollRect.scrollSensitivity * Time.deltaTime * displayersGrid.cellSize.y;
            }

            displayersGridRect.anchoredPosition = gridPosition;
            return;
        }
    }
コード例 #25
0
ファイル: Search.aspx.cs プロジェクト: vatsal/getputs
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected override void OnInit(EventArgs e)
    {
        // Create dynamic controls here.

        //  Default Search Parameters.
        query = String.Empty;
        sType = SearchEngine.SearchType.Title;
        sCategory = "All Categories";
        sTime = SearchEngine.SearchTime.Today;

        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        searchEngine = SearchEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }

        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        LoadSearchDDL();
        GetQueryParameters();

        if (!string.IsNullOrEmpty(SearchTB.Text))
        {
            query = SearchTB.Text.Trim();
        }

        string sTypeDDLValue = SearchTypeDDL.SelectedValue;
        string sCategoryDDLValue = SearchCategoryDDL.SelectedValue;
        string sTimeDDLValue = SearchTimeDDL.SelectedValue;

        Control MasterPageSearchTable = this.Master.FindControl("SearchTable");
        MasterPageSearchTable.Visible = false;

        SearchTB.Focus();
        Page.Form.DefaultButton = SearchButton.ID;

        if (!string.IsNullOrEmpty(query))
        {
            SearchTB.Text = query;

            if (sType == SearchEngine.SearchType.Comments)
            {
                sType = SearchEngine.SearchType.Title;
                List<Item> itemList = searchEngine.LoadSearchResults(query, sType, sCategory, sTime);
                LoadItemTable(itemList);
            }
            else
            {

                //  List<Item> itemList = searchEngine.LoadSearchResults(query);
                List<Item> itemList = searchEngine.LoadSearchResults(query, sType, sCategory, sTime);

                //  LoadItemTable(itemList);

                ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
                    | ItemDisplayer.ShowItemsOptions.ShowTime
                    | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
                    | ItemDisplayer.ShowItemsOptions.ShowSaveLink
                    | ItemDisplayer.ShowItemsOptions.ShowEMailLink
                    | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
                    | ItemDisplayer.ShowItemsOptions.ShowImage
                    | ItemDisplayer.ShowItemsOptions.ShowRatings
                    | ItemDisplayer.ShowItemsOptions.ShowTags
                    | ItemDisplayer.ShowItemsOptions.CountClicks
                    | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

                string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.SearchPageLink.Replace("~\\", ""));
                ItemDiv.InnerHtml = itemTable;

            }
        }

        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        //  InitializeComponent();
        base.OnInit(e);
    }
コード例 #26
0
ファイル: MyNews.aspx.cs プロジェクト: vatsal/getputs
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        MyAccountLink.Visible = false;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {
            Response.Redirect(links.FrontPageLink, false);
        }
        else
        {
            string queryString = "SELECT PreferredCategories FROM user WHERE UID='" + UID + "';";
            MySqlDataReader retList = dbOps.ExecuteReader(queryString);

            string prefferedCategoriesStr = string.Empty;
            if (retList != null && retList.HasRows)
            {
                while (retList.Read())
                {
                    prefferedCategoriesStr = Convert.ToString(retList["PreferredCategories"]);
                }
                retList.Close();
            }

            if (string.IsNullOrEmpty(prefferedCategoriesStr))
            {
                MessageLabel.Text = "Please visit the My Account Page and select the Categories that you would like to read more news from.";
                MyAccountLink.Visible = true;
                MyAccountLink.NavigateUrl = links.UserDetailsPageLink + "?UID=" + UID;
            }
            else
            {
                MyAccountLink.Visible = false;

                List<string> preferredCategoriesList = GetPreferredCategoriesList(prefferedCategoriesStr);
                List<Item> itemList = LoadItemDB(sort, preferredCategoriesList);
                if (itemList != null && itemList.Count > 0)
                {
                    MessageLabel.Text = gui.GreenFontStart + "Personalized Items for " + gui.GreenFontEnd + gui.BlueFontStart + UID + gui.BlueFontEnd;

                    //  LoadItemTable(itemList);

                    ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
                        | ItemDisplayer.ShowItemsOptions.ShowTime
                        | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
                        | ItemDisplayer.ShowItemsOptions.ShowSaveLink
                        | ItemDisplayer.ShowItemsOptions.ShowEMailLink
                        | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
                        | ItemDisplayer.ShowItemsOptions.ShowImage
                        | ItemDisplayer.ShowItemsOptions.ShowRatings
                        | ItemDisplayer.ShowItemsOptions.ShowTags
                        | ItemDisplayer.ShowItemsOptions.CountClicks
                        | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;
                    string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.MyNewsPageLink.Replace("~\\", ""));
                    ItemDiv.InnerHtml = itemTable;
                }
                else
                {
                    MessageLabel.Text = "getputs did not find anything worth your attention today!";
                }
            }
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists
    }
コード例 #27
0
    public void processTapGesture(Vector2 tapPos)
    {
        if (foundItem && Managers.Player.Alive)
        {
            recalculateNumbers();
            LevelTile foundLT = foundItem.levelTile;
            if (foundLT.tileType != LevelTile.TileType.MAP)
            {
                //Reveal the found LT
                revealTile(foundLT, true);
                //Reveal the tiles around the found LT
                foreach (LevelTile levelTile in getSurroundingTiles(foundLT))
                {
                    if (levelTile.Revealed)
                    {
                        revealTile(levelTile, true);
                    }
                }
                //Check if goals have been achieved
                if (Managers.Player.GoalAchieved)
                {
                    //Check if map has been completed
                    if (Managers.Player.completedMap())
                    {
                        //Go to latest revealed location
                        Managers.Camera.moveTo(
                            FindObjectOfType <MapLineUpdater>().LastRevealedSpot
                            );
                    }
                    else
                    {
                        //Go to start
                        Managers.Camera.moveTo(Managers.Start);
                    }
                }
            }
            else
            {
                //Check if map has been completed
                if (Managers.Player.completedMap())
                {
                    //Go to latest revealed location
                    Managers.Camera.moveTo(
                        FindObjectOfType <MapLineUpdater>().LastRevealedSpot
                        );
                }
            }
            foundItem.retire();
            foundItem = null;
            return;
        }
        if (checkReset(tapPos))
        {
            return;
        }
        LevelTile lt = getTile(tapPos);

        if (lt != null)
        {
            //If it's revealed
            if (lt.Revealed)
            {
                //Auto-Reveal
                //If the count of surrounding flags equals
                //the count of surrounding trap tiles,
                int itemCount = getAdjacentCount(lt, LevelTile.TileType.TRAP);
                itemCount += getAdjacentCount(lt, LevelTile.TileType.TREASURE);
                if (lt.Empty && lt.tileType != LevelTile.TileType.MAP &&
                    getAdjacentFlagCount(lt) == itemCount)
                {
                    //Reveal the surrounding non-flagged tiles
                    foreach (LevelTile neighbor in getSurroundingTiles(lt))
                    {
                        if (!neighbor.Flagged && !neighbor.Revealed)
                        {
                            if (neighbor.tileType == LevelTile.TileType.TRAP)
                            {
                                Managers.Player.takeHit();
                            }
                            if (neighbor.tileType == LevelTile.TileType.TREASURE)
                            {
                                Managers.Player.findTrophy();
                            }
                            revealTile(neighbor);
                        }
                    }
                    if (!Managers.Player.Alive)
                    {
                        revealBoard();
                    }
                }
                //Auto-Flag
                //If the count of surrounding unrevealed tiles equals
                //the count of surrounding trap tiles,
                if (lt.Empty && lt.tileType != LevelTile.TileType.MAP &&
                    getAdjacentRevealedCount(lt, true) == itemCount)
                {
                    //Flag the surrounding non-revealed tiles
                    foreach (LevelTile neighbor in getSurroundingTiles(lt))
                    {
                        if (!neighbor.Flagged && !neighbor.Revealed)
                        {
                            //Flag it
                            processFlagGesture(neighbor.transform.position);
                        }
                    }
                }
            }
            //If it's not flagged
            if (!lt.Flagged)
            {
                if (!anyRevealed)
                {
                    generateLevelPostTap(tapPos);
                    anyRevealed = true;
                }
                if ((!lt.Revealed) || lt.DetectedAny)
                {
                    Managers.Effect.highlightChange(lt);
                }
                LevelTile.TileType revealedItem = LevelTile.TileType.EMPTY;
                bool shouldRevealBoard          = false;
                bool prevRevealed = lt.Revealed;
                if (lt.tileType == LevelTile.TileType.TRAP)
                {
                    revealedItem = LevelTile.TileType.TRAP;
                    if (!Managers.Player.takeHit())
                    {
                        shouldRevealBoard = true;
                    }
                }
                if (lt.tileType == LevelTile.TileType.TREASURE)
                {
                    revealedItem = LevelTile.TileType.TREASURE;
                    Managers.Player.findTrophy();
                }
                if (!LevelTile.empty(revealedItem))
                {
                    lt.Revealed = true;
                    Managers.Effect.highlightChange(lt);
                    if (shouldRevealBoard)
                    {
                        revealBoard();
                    }
                    generatePostItemReveal(revealedItem);
                }
                else
                {
                    revealTile(lt);
                }
                if (lt.tileType == LevelTile.TileType.MAP)
                {
                    //if it's already been revealed
                    //but not activated yet
                    if (prevRevealed && !lt.Activated)
                    {
                        lt.Activated = true;
                        Managers.Effect.highlightChange(lt);
                        generatePostItemReveal(LevelTile.TileType.MAP);
                    }
                }
            }
        }
    }
コード例 #28
0
ファイル: Submitted.aspx.cs プロジェクト: vatsal/getputs
    int startItem = 0; //  Default Value;

    #endregion Fields

    #region Methods

    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        links = Links.Instance;
        gui = GUIVariables.Instance;
        dbOps = DBOperations.Instance;
        categories = Categories.Instance;
        log = Logger.Instance;
        engine = ProcessingEngine.Instance;
        general = General.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            loggedUID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }

        if (string.IsNullOrEmpty(loggedUID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (string.IsNullOrEmpty(Request.QueryString["UID"]))
        {

        }
        else
        {
            queryStringUID = Request.QueryString["UID"].Trim().ToLower();
        }

        string message = string.Empty;
        MessageLabel.Text = string.Empty;
        if (string.IsNullOrEmpty(queryStringUID))
        {
            message = gui.GreenFontStart + "No such User exists." + gui.GreenFontEnd;
        }
        else
        {
            List<Item> itemList = engine.LoadItemDB(sort, queryStringUID);
            if (itemList != null && itemList.Count > 0)
            {
                message = gui.GreenFontStart + "Most recent submissions by " + queryStringUID + gui.GreenFontEnd;

                //  LoadItemTable(itemList);

                ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
                    | ItemDisplayer.ShowItemsOptions.ShowTime
                    | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
                    | ItemDisplayer.ShowItemsOptions.ShowSaveLink
                    | ItemDisplayer.ShowItemsOptions.ShowEMailLink
                    | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
                    | ItemDisplayer.ShowItemsOptions.ShowImage
                    | ItemDisplayer.ShowItemsOptions.ShowRatings
                    | ItemDisplayer.ShowItemsOptions.ShowTags
                    | ItemDisplayer.ShowItemsOptions.CountClicks
                    | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

                string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, queryStringUID, sort, links.SubmittedPageLink.Replace("~\\", "") + "?UID=" + queryStringUID);
                ItemDiv.InnerHtml = itemTable;
            }
            else
            {
                message = gui.GreenFontStart + queryStringUID + " has not made any submissions yet." + gui.GreenFontEnd;
            }
        }
        MessageLabel.Text = message;
    }
コード例 #29
0
ファイル: Category.aspx.cs プロジェクト: vatsal/getputs
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        //  requestedTag = Request.QueryString["category"].Trim();
        requestedCategory = Request.QueryString.Get("category");

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (string.IsNullOrEmpty(requestedCategory))
        {
            LoadGenericCategoryTable();
        }
        else if (!(categories.CategoriesList.Contains(requestedCategory) || categories.CategoriesList.Contains(requestedCategory.ToLower())))
        {
            MessageLabel.Text = gui.RedFontStart + "Invalid Category" + gui.RedFontEnd;
        }
        else
        {
            string currentCategory = requestedCategory;
            if (imageEngine.IsIconsOn)
            {
                string iconLocation = imageEngine.LoadIconLocation(currentCategory);
                if (!string.IsNullOrEmpty(iconLocation))
                {
                    System.Web.UI.WebControls.Image icon = new System.Web.UI.WebControls.Image();
                    //  icon.ImageUrl = links.DomainLink + iconLocation;
                    icon.ImageUrl = iconLocation;
                    icon.ToolTip = currentCategory;
                    CategoryDiv.Controls.Add(icon);
                    CategoryDiv.Controls.Add(new LiteralControl(" "));
                }
            }
            MessageLabel.Text = gui.GreenFontStart + requestedCategory + gui.GreenFontEnd;
            //  MessageLabel.Text = gui.WhiteFontStart + requestedCategory + gui.WhiteFontEnd;
            LoadCategoryTable(requestedCategory, sort);
        }
    }
コード例 #30
0
ファイル: AutoTag.aspx.cs プロジェクト: vatsal/getputs
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["tag"]))
        {
            tag = Request.QueryString["tag"].Trim();
        }
        else
        {
            Response.Redirect(links.FrontPageLink, true);
        }

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        List<Item> itemList = GetSimilarlyTaggedItems(tag);
        if (itemList != null && itemList.Count > 0)
        {
            //  LoadItemTable(itemList);

            ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
            | ItemDisplayer.ShowItemsOptions.ShowTime
            | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
            | ItemDisplayer.ShowItemsOptions.ShowSaveLink
            | ItemDisplayer.ShowItemsOptions.ShowEMailLink
            | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
            | ItemDisplayer.ShowItemsOptions.ShowImage
            | ItemDisplayer.ShowItemsOptions.ShowRatings
            | ItemDisplayer.ShowItemsOptions.ShowTags
            | ItemDisplayer.ShowItemsOptions.CountClicks
            | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

            string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.AutoTagPageLink.Replace("~\\", "") + "?tag=" + tag);
            ItemDiv.InnerHtml = itemTable;

            MessageLabel.Text = gui.GreenFontStart + "Items automatically tagged with the tag: " + gui.GreenFontEnd + tag;
        }
        else
        {
            MessageLabel.Text = gui.GreenFontStart + "No items carry the tag: " + gui.GreenFontEnd + tag;
        }
    }
コード例 #31
0
ファイル: ItemDisplayer.cs プロジェクト: kimKIKI/2DGame_Card
 private void Start()
 {
     instance_ItemDisplayer = this;
     init();
 }
コード例 #32
0
ファイル: Saved.aspx.cs プロジェクト: vatsal/getputs
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {
            Response.Redirect(links.LoginLink, false);
        }
        else
        {
            MessageLabel.Text = gui.GreenFontStart + UID + "'s Saved Items" + gui.GreenFontEnd;
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        LoadItemDB(sort);
    }
コード例 #33
0
ファイル: Default.aspx.cs プロジェクト: vatsal/getputs
    protected void Page_Load(object sender, EventArgs e)
    {
        //dbOps = DBOperations.Instance;
        //links = Links.Instance;
        //general = General.Instance;
        //gui = GUIVariables.Instance;
        //categories = Categories.Instance;
        //engine = ProcessingEngine.Instance;
        //imageEngine = ImageEngine.Instance;
        //tagger =Tagger.Instance;

        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;
        //  seperator = gui.BlueFontStart + " | " + gui.BlueFontEnd;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        //if (!string.IsNullOrEmpty(Request.QueryString["layout"]))
        //{
        //    string layoutStr = Convert.ToString(Request.QueryString["layout"]);
        //    itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(layoutStr);
        //}

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        List<Item> itemList = engine.LoadItemDB(sort);
        //  Using ASP.NET Controls.
        //  LoadItemTable(itemList);

        //  Using HTML
        ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
            | ItemDisplayer.ShowItemsOptions.ShowTime
            | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
            | ItemDisplayer.ShowItemsOptions.ShowSaveLink
            | ItemDisplayer.ShowItemsOptions.ShowEMailLink
            | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
            | ItemDisplayer.ShowItemsOptions.ShowImage
            | ItemDisplayer.ShowItemsOptions.ShowRatings
            | ItemDisplayer.ShowItemsOptions.ShowTags
            | ItemDisplayer.ShowItemsOptions.CountClicks
            | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

        string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.FrontPageLink.Replace("~\\", ""));
        ItemDiv.InnerHtml = itemTable;

        //  Master Page ItemImage and ItemContent Carousels are invisble. Make them visible only for this page.
        Control MasterPageCarouselDiv = this.Master.FindControl("CarouselDiv");
        MasterPageCarouselDiv.Visible = true;
        Control MasterPageTopAboutTable = this.Master.FindControl("TopAboutTable");
        MasterPageTopAboutTable.Visible = true;

        //  List<Item> itemList = engine.LoadItemDB(ProcessingEngine.Sort.New);
        if (itemList != null && itemList.Count > 0)
        {
            LoadItemImageCarousel(itemList);
            LoadItemNewsCarousel(itemList);
        }

        //  Load Item Content Carousel JavaScript START
        //if (itemList != null && itemList.Count > 0)
        //{
        //    LoadItemNewsCarousel(itemList);
        //}
        //  Load Item Content Carousel JavaScript END
    }