public void TriggerDamagePart()
    {
        BoxColor box      = Utilities.GetRandomEnum <BoxColor>();
        ItemPart itemPart = Utilities.GetRandomEnum <ItemPart>();

        DamagePart(itemPart, box);
    }
Example #2
0
    /// <summary>
    /// Create ItemPart object and add it to dictionary.
    /// </summary>
    public void SetupItemPart(Transform t)
    {
        ItemPart bp = new ItemPart
        {
            rb          = t.GetComponent <Rigidbody>(),
            joint       = t.GetComponent <ConfigurableJoint>(),
            startingPos = t.position,
            startingRot = t.rotation
        };

        bp.rb.maxAngularVelocity = 100;

        // Add & setup the ground contact script
        bp.groundContact = t.GetComponent <MLAgents.GroundContact>();
        if (!bp.groundContact)
        {
            bp.groundContact       = t.gameObject.AddComponent <MLAgents.GroundContact>();
            bp.groundContact.agent = gameObject.GetComponent <MLAgents.Agent>();
        }
        else
        {
            bp.groundContact.agent = gameObject.GetComponent <MLAgents.Agent>();
        }

        // Add & setup the target contact script
        bp.targetContact = t.GetComponent <MLAgents.TargetContact>();
        if (!bp.targetContact)
        {
            bp.targetContact = t.gameObject.AddComponent <MLAgents.TargetContact>();
        }

        bp.thisJDController = this;
        ItemPartsDict.Add(t, bp);
        ItemPartsList.Add(bp);
    }
    //Ask the manager's list if the items on the list are owned.
    public void SetAvailabilityUsingManager()
    {
        for (int i = 0; i < listOfTorso.Capacity && i < equip.torsoAvailability.Length; i++)
        {
            ItemPart item = listOfTorso[i].GetComponent <ItemPart>();
            item.owned = equip.torsoAvailability[i];
        }
        for (int i = 0; i < listofHeads.Capacity && i < equip.headAvailability.Length; i++)
        {
            ItemPart item = listofHeads[i].GetComponent <ItemPart>();
            item.owned = equip.headAvailability[i];
        }

        for (int i = 0; i < listofLeftArms.Capacity && i < equip.leftArmAvailability.Length; i++)
        {
            ItemPart item = listofLeftArms[i].GetComponent <ItemPart>();
            item.owned = equip.leftArmAvailability[i];

            item       = listofRightArms[i].GetComponent <ItemPart>();
            item.owned = equip.rightArmAvailability[i];
        }

        for (int i = 0; i < listofLeftLegs.Capacity && i < equip.leftLegAvailability.Length; i++)
        {
            ItemPart item = listofLeftLegs[i].GetComponent <ItemPart>();
            item.owned = equip.leftLegAvailability[i];

            item       = listofRightLegs[i].GetComponent <ItemPart>();
            item.owned = equip.rightLegAvailability[i];
        }
    }
Example #4
0
        protected override void OnItemClicked(Item item, ItemPart itemPart, MouseButtons mouseButtons)
        {
            if (item.Tag is DocumentWorkspace dw)
            {
                switch (itemPart)
                {
                case ItemPart.None:
                    // do nothing
                    break;

                case ItemPart.CloseButton:
                    if (mouseButtons == MouseButtons.Left)
                    {
                        OnDocumentClicked(dw, DocumentClickAction.Close);
                    }
                    break;

                case ItemPart.Image:
                    if (mouseButtons == MouseButtons.Left)
                    {
                        SelectedDocument = dw;
                    }
                    else if (mouseButtons == MouseButtons.Right)
                    {
                        // TODO: right click menu
                    }
                    break;

                default:
                    throw new InvalidEnumArgumentException();
                }
            }

            base.OnItemClicked(item, itemPart, mouseButtons);
        }
Example #5
0
        // Token: 0x060022D2 RID: 8914 RVA: 0x000C74DC File Offset: 0x000C56DC
        public static void AddIrmInformation(Infobar infobar, ItemPart itemPart, bool addRemoveLink)
        {
            if (infobar == null)
            {
                throw new ArgumentNullException("infobar");
            }
            if (itemPart == null)
            {
                throw new ArgumentNullException("itemPart");
            }
            if (!itemPart.IrmInfo.IsRestricted || itemPart.IrmInfo.DecryptionStatus.Failed)
            {
                return;
            }
            SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>();
            string str = string.Format(LocalizedStrings.GetNonEncoded(-500320626), itemPart.IrmInfo.TemplateName, itemPart.IrmInfo.TemplateDescription);

            sanitizingStringBuilder.Append(str);
            if (addRemoveLink)
            {
                sanitizingStringBuilder.Append(" <a id=\"aIbRR\" href=\"#\">");
                sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(540836651));
                sanitizingStringBuilder.Append("</a>");
            }
            infobar.AddMessage(sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>(), InfobarMessageType.Informational, "divCmplIB");
        }
Example #6
0
 protected virtual void OnItemClicked(Item item, ItemPart itemPart, MouseButtons mouseButtons)
 {
     if (ItemClicked != null)
     {
         ItemClicked(this, new EventArgs <Triple <Item, ItemPart, MouseButtons> >(
                         new Triple <Item, ItemPart, MouseButtons>(item, itemPart, mouseButtons)));
     }
 }
    //Check if the part has an ability, and increment it.
    void CheckPart(GameObject a_part)
    {
        if (a_part == null)
        {
            return;
        }

        ItemPart part = a_part.GetComponent <ItemPart>();

        abilities[(int)part.ability]++;

        return;
    }
Example #8
0
    internal void ReadyPart()
    {
        combinedShop.Refresh = true;

        GameObject currentPart = combinedShop.getPart();


        if (currentPart == null)
        {
            return;
        }
        ItemPart part = currentPart.GetComponent <ItemPart>();

        if (preview != null)
        {
            Destroy(preview);
        }

        preview = Instantiate(currentPart, previewParent.transform, false);


        if (combinedShop.currentType == partType.LeftArm || combinedShop.currentType == partType.RightArm)
        {
            previewParent.transform.eulerAngles = new Vector3(180, 0, 0);
            preview.transform.localPosition     = new Vector3(0, -0.5f);
            preview.transform.localScale        = new Vector3(1.5f, 1.5f, 1.5f);
        }
        else
        {
            previewParent.transform.eulerAngles = new Vector3(0, 0, 0);
        }


        if (abilities == null)
        {
            abilities = FindObjectOfType <AbilitiesManager>();
        }

        abilityText.text = abilities.displayPower(part.ability);

        if (part.ability != abilityTypes.None)
        {
            abilityImage.enabled = true;
            int ico = (int)part.ability - 1;
            abilityImage.sprite = combinedShop.parts.iconsList[ico];
        }
        else
        {
            abilityImage.enabled = false;
        }
    }
    private void DamagePart(ItemPart itemPart, BoxColor box)
    {
        Item item;

        switch (itemPart)
        {
        case ItemPart.Battery:
            item = _itemBattery;
            break;

        case ItemPart.CircuitBoard:
            item = _itemCircuitBoard;
            break;

        case ItemPart.Gear:
            item = _itemGear;
            break;

        default:
            item = _itemBattery;
            break;
        }

        BoxContainer boxContainer;

        switch (box)
        {
        case BoxColor.Red:
            boxContainer = redBox;
            break;

        case BoxColor.Blue:
            boxContainer = blueBox;
            break;

        case BoxColor.Green:
            boxContainer = redBox;
            break;

        default:
            boxContainer = redBox;
            break;
        }

        bool success = _bubble.TriggerBubble(boxContainer.boxColor, item.itemIcon);

        if (success)
        {
            boxContainer.AddRequiredItemtoBox(item);
        }
    }
    public void EquipOrBuy()
    {
        ItemPart part = currentPart.GetComponent <ItemPart>();

        if (part.owned)
        {
            parts.addLimb();
        }
        else
        {
            shop.buyPart();
        }
        Refresh = true;
    }
Example #11
0
    /// <summary>
    /// Reset body part to initial configuration.
    /// </summary>
    public void Reset(ItemPart bp)
    {
        bp.rb.transform.position = bp.startingPos;
        bp.rb.transform.rotation = bp.startingRot;
        bp.rb.velocity           = Vector3.zero;
        bp.rb.angularVelocity    = Vector3.zero;
        if (bp.groundContact)
        {
            bp.groundContact.touchingGround = false;
        }

        if (bp.targetContact)
        {
            bp.targetContact.touchingTarget = false;
        }
    }
Example #12
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            bool raisedClickEvent = false;

            if (this.mouseDownButton == e.Button)
            {
                Point clientPt  = new Point(e.X, e.Y);
                Point viewPt    = ClientPointToViewPoint(clientPt);
                int   itemIndex = ViewPointToItemIndex(viewPt);

                if (itemIndex >= 0 && itemIndex < this.items.Count)
                {
                    Item     item     = this.items[itemIndex];
                    Point    itemPt   = ViewPointToItemPoint(itemIndex, viewPt);
                    ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                    if (itemIndex == this.mouseDownIndex && itemPart == this.mouseDownItemPart)
                    {
                        if (itemPart == ItemPart.CloseButton && !item.Checked)
                        {
                            // Can only close 'checked' images, just like how tab switching+closing works in IE7
                            itemPart = ItemPart.Image;
                        }

                        OnItemClicked(item, itemPart, this.mouseDownButton);
                        raisedClickEvent = true;
                    }

                    this.mouseOverApplyRendering = true;
                    this.mouseOverItemPart       = itemPart;
                    this.mouseOverIndex          = itemIndex;
                }

                this.mouseDownApplyRendering = false;
                this.mouseDownButton         = MouseButtons.None;

                MouseStatesToItemStates();
                Refresh();
            }

            if (raisedClickEvent)
            {
                ForceMouseMove();
            }

            base.OnMouseUp(e);
        }
    internal void ByPassRestrictions()
    {
        NewGame();

        for (int i = 0; i < 5; i++)
        {
            equip.completedLevels[i] = 16;
        }
        equip.shards = 999999;

        for (int i = 0; i < equip.torsoAvailability.Length; i++)
        {
            ItemPart item = listOfTorso[i].GetComponent <ItemPart>();
            item.owned = true;
        }
        foreach (GameObject item in listofHeads)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = true;
        }

        foreach (GameObject item in listofLeftArms)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = true;
        }
        foreach (GameObject item in listofRightArms)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = true;
        }

        foreach (GameObject item in listofLeftLegs)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = true;
        }

        foreach (GameObject item in listofRightLegs)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = true;
        }
    }
Example #14
0
            public void SetPartRenderState(ItemPart itemPart, UI.ButtonState renderState)
            {
                switch (itemPart)
                {
                case ItemPart.None:
                    break;

                case ItemPart.CloseButton:
                    CloseRenderState = renderState;
                    break;

                case ItemPart.Image:
                    ImageRenderState = renderState;
                    break;

                default:
                    throw new InvalidEnumArgumentException();
                }
            }
Example #15
0
    //Purchase your part. No need for money/owned/available check, as this was done above.
    public void buyPart()
    {
        if (combinedShop.currentPart == null)
        {
            return;
        }
        ItemPart part = combinedShop.currentPart.GetComponent <ItemPart>();

        gUI.UINeedsUpdate = true;


        manager.shards -= part.cost;

        purchase.volume = PlayerPrefs.GetFloat("Volume", 0.3f);

        purchase.Play();

        part.owned = true;
        ReadyPart();
    }
Example #16
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (this.mouseDownButton == MouseButtons.None)
            {
                Point clientPt  = new Point(e.X, e.Y);
                Point viewPt    = ClientPointToViewPoint(clientPt);
                int   itemIndex = ViewPointToItemIndex(viewPt);

                if (itemIndex >= 0 && itemIndex < this.items.Count)
                {
                    Item     item     = this.items[itemIndex];
                    Point    itemPt   = ViewPointToItemPoint(itemIndex, viewPt);
                    ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                    if (itemPart == ItemPart.Image)
                    {
                        OnItemClicked(item, itemPart, e.Button);

                        this.mouseDownApplyRendering = false;
                        this.mouseOverIndex          = itemIndex;
                        this.mouseOverItemPart       = itemPart;
                        this.mouseOverApplyRendering = true;
                    }
                    else
                    {
                        this.mouseDownIndex          = itemIndex;
                        this.mouseDownItemPart       = itemPart;
                        this.mouseDownButton         = e.Button;
                        this.mouseDownApplyRendering = true;
                        this.mouseOverApplyRendering = false;
                    }

                    MouseStatesToItemStates();
                    Refresh();
                }
            }

            base.OnMouseDown(e);
        }
Example #17
0
        public void LoadItemParts(IConversationTree conversationTree, IList <StoreObjectId> storeIds, string searchString, CultureInfo cultureinfo, out List <IConversationTreeNode> nodes)
        {
            Util.ThrowOnNullOrEmptyArgument(storeIds, "storeIds");
            nodes = new List <IConversationTreeNode>(0);
            this.ConversationDataExtractor.LoadItemParts(conversationTree, new Collection <StoreObjectId>(storeIds));
            if (string.IsNullOrEmpty(searchString))
            {
                nodes = this.MatchAllNodes(storeIds);
                return;
            }
            IList <string> words = null;

            if (this.InternalTryAqsMatch(storeIds, searchString, cultureinfo, out words, out nodes))
            {
                return;
            }
            bool flag = false;

            foreach (StoreObjectId storeObjectId in storeIds)
            {
                ItemPart itemPart = this.ConversationDataExtractor.GetItemPart(conversationTree, storeObjectId);
                if (itemPart.UniqueFragmentInfo != null && itemPart.UniqueFragmentInfo.IsMatchFound(words))
                {
                    IConversationTreeNode item = null;
                    if (conversationTree.TryGetConversationTreeNode(storeObjectId, out item))
                    {
                        nodes.Add(item);
                        flag = true;
                    }
                }
            }
            if (!flag)
            {
                nodes = this.MatchAllNodes(storeIds);
            }
        }
    //Build the arrays for the equipmentlists, and set everything to false/0/null.
    void NewGame()
    {
        equip.StarsAcquired = new int[75];

        PlayerPrefs.SetInt("Transitions", 1);

        equip.shards           = 0;
        equip.tutorialComplete = false;

        equip.completedLevels = new int[5];

        equip.equippedParts = new int[6];

        for (int i = 0; i < 5; i++)
        {
            equip.completedLevels[i] = 0;

            if (i < 4)
            {
                equip.equippedParts[i] = -2;
            }
        }

        equip.torsoAvailability    = new bool[listOfTorso.Capacity];
        equip.headAvailability     = new bool[listofHeads.Capacity];
        equip.leftArmAvailability  = new bool[listofLeftArms.Capacity];
        equip.rightArmAvailability = new bool[listofRightArms.Capacity];

        equip.leftLegAvailability  = new bool[listofLeftLegs.Capacity];
        equip.rightLegAvailability = new bool[listofRightLegs.Capacity];

        for (int i = 0; i < equip.torsoAvailability.Length; i++)
        {
            ItemPart item = listOfTorso[i].GetComponent <ItemPart>();
            item.owned = false;
        }

        foreach (GameObject item in listOfTorso)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = false;
        }
        foreach (GameObject item in listofHeads)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = false;
        }

        foreach (GameObject item in listofLeftArms)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = false;
        }
        foreach (GameObject item in listofRightArms)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = false;
        }

        foreach (GameObject item in listofLeftLegs)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = false;
        }

        foreach (GameObject item in listofRightLegs)
        {
            ItemPart mod = item.GetComponent <ItemPart>();
            mod.owned = false;
        }

        EquipDefault();

        Save();
    }
Example #19
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            bool raisedClickEvent = false;

            if (this.mouseDownButton == e.Button)
            {
                Point clientPt = new Point(e.X, e.Y);
                Point viewPt = ClientPointToViewPoint(clientPt);
                int itemIndex = ViewPointToItemIndex(viewPt);

                if (itemIndex >= 0 && itemIndex < this.items.Count)
                {
                    Item item = this.items[itemIndex];
                    Point itemPt = ViewPointToItemPoint(itemIndex, viewPt);
                    ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                    if (itemIndex == this.mouseDownIndex && itemPart == this.mouseDownItemPart)
                    {
                        if (itemPart == ItemPart.CloseButton && !item.Checked)
                        {
                            // Can only close 'checked' images, just like how tab switching+closing works in IE7
                            itemPart = ItemPart.Image;
                        }

                        OnItemClicked(item, itemPart, this.mouseDownButton);
                        raisedClickEvent = true;
                    }

                    this.mouseOverApplyRendering = true;
                    this.mouseOverItemPart = itemPart;
                    this.mouseOverIndex = itemIndex;
                }

                this.mouseDownApplyRendering = false;
                this.mouseDownButton = MouseButtons.None;

                MouseStatesToItemStates();
                Refresh();
            }

            if (raisedClickEvent)
            {
                ForceMouseMove();
            }

            base.OnMouseUp(e);
        }
Example #20
0
 protected virtual void OnItemClicked(Item item, ItemPart itemPart, MouseButtons mouseButtons)
 {
     ItemClicked?.Invoke(this, new EventArgs <Triple <Item, ItemPart, MouseButtons> >(
                             Triple.Create(item, itemPart, mouseButtons)));
 }
Example #21
0
 public void AddPart(ItemPart part)
 {
     if (itemParts.Contains(part))
         return;
     itemParts.Add(part);
 }
Example #22
0
 public void RemovePart(ItemPart part)
 {
     if (!itemParts.Contains(part))
         return;
     itemParts.Remove(part);
 }
Example #23
0
 public void PerformItemClick(Item item, ItemPart itemPart, MouseButtons mouseButtons)
 {
     OnItemClicked(item, itemPart, mouseButtons);
 }
 public void Destroy(ItemPart item)
 {
     TW.Data.RemoveObject(item);
 }
Example #25
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (this.mouseDownButton == MouseButtons.None)
            {
                Point clientPt = new Point(e.X, e.Y);
                Point viewPt = ClientPointToViewPoint(clientPt);
                int itemIndex = ViewPointToItemIndex(viewPt);

                if (itemIndex >= 0 && itemIndex < this.items.Count)
                {
                    Item item = this.items[itemIndex];
                    Point itemPt = ViewPointToItemPoint(itemIndex, viewPt);
                    ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                    if (itemPart == ItemPart.Image)
                    {
                        OnItemClicked(item, itemPart, e.Button);

                        this.mouseDownApplyRendering = false;
                        this.mouseOverIndex = itemIndex;
                        this.mouseOverItemPart = itemPart;
                        this.mouseOverApplyRendering = true;
                    }
                    else
                    {
                        this.mouseDownIndex = itemIndex;
                        this.mouseDownItemPart = itemPart;
                        this.mouseDownButton = e.Button;
                        this.mouseDownApplyRendering = true;
                        this.mouseOverApplyRendering = false;
                    }

                    MouseStatesToItemStates();
                    Refresh();
                }
            }

            base.OnMouseDown(e);
        }
 // Token: 0x06001E1B RID: 7707 RVA: 0x000AE464 File Offset: 0x000AC664
 internal static ArrayList GetAttachmentInformation(OwaStoreObjectId owaConversationId, ItemPart itemPart, bool isLoggedOnFromPublicComputer, bool isEmbeddedItem, bool forceEnableItemLink)
 {
     if (itemPart.Attachments == null || itemPart.Attachments.Count == 0)
     {
         return(null);
     }
     return(AttachmentUtility.GetAttachmentList(owaConversationId, itemPart, isLoggedOnFromPublicComputer, isEmbeddedItem, true, forceEnableItemLink));
 }
Example #27
0
 public void PerformItemClick(Item item, ItemPart itemPart, MouseButtons mouseButtons)
 {
     OnItemClicked(item, itemPart, mouseButtons);
 }
Example #28
0
 // Token: 0x060022C3 RID: 8899 RVA: 0x000C6D20 File Offset: 0x000C4F20
 internal ItemPartRecipientWell(ItemPart itemPart)
 {
     this.itemPart = itemPart;
 }
    public void addLimb()
    {
        combinedShop.Refresh = true;

        changed = true;

        GameObject adding;

        GameObject currentPart = combinedShop.currentPart; //The object, found at the index inside the list.

        int currentIndex = combinedShop.currentIndex;

        partType currentType = combinedShop.currentType;



        if (currentPart == null)
        {
            return;
        }


        if (currentType == partType.Torso)
        {
            addingTorso();
            return;
        }

        if (TorsoEquipped == null)
        {
            return;
        }

        switch (currentType)
        {
        case partType.Head:
            if (headEquipped != null && currentPart.name == headEquipped.gameObject.name)
            {
                return;
            }
            if (headEquipped != null)
            {
                Destroy(headEquipped.gameObject);
            }

            adding       = Instantiate(currentPart, TorsoEquipped.neckForHead.transform, false);
            headEquipped = adding.GetComponent <ItemPart>();
            list.ChangeEquip(currentPart, partType.Head, currentIndex);
            adding.name = currentPart.name;
            break;

        case partType.LeftArm:
            if (leftArmEquipped != null && currentPart.name == leftArmEquipped.gameObject.name)
            {
                return;
            }
            if (leftArmEquipped != null)
            {
                leftArmEquipped.deleteArm();
            }
            adding          = Instantiate(currentPart, TorsoEquipped.LeftArmUpper.transform, false);
            leftArmEquipped = adding.GetComponent <ArmPart>();
            leftArmEquipped.EquipArm(TorsoEquipped, TorsoEquipped.LeftArmUpper, TorsoEquipped.LeftArmFore, TorsoEquipped.LeftArmHand);

            adding.name = currentPart.name;
            list.ChangeEquip(currentPart, partType.LeftArm, currentIndex);
            adding = null;
            break;

        case partType.RightArm:
            if (rightArmEquipped != null && currentPart.name == rightArmEquipped.gameObject.name)
            {
                return;
            }
            if (rightArmEquipped != null)
            {
                rightArmEquipped.deleteArm();
            }
            adding = Instantiate(currentPart, TorsoEquipped.RightArmUpper.transform, false);


            rightArmEquipped = adding.GetComponent <ArmPart>();
            rightArmEquipped.EquipArm(TorsoEquipped, TorsoEquipped.RightArmUpper, TorsoEquipped.RightArmFore, TorsoEquipped.RightArmHand);


            adding.name = currentPart.name;
            list.ChangeEquip(currentPart, partType.RightArm, currentIndex);
            adding = null;
            break;

        case partType.LeftLeg:
            if (leftLegEquipped != null && currentPart.name == leftLegEquipped.gameObject.name)
            {
                return;
            }
            if (leftLegEquipped != null)
            {
                leftLegEquipped.DeleteLeg();
            }
            adding          = Instantiate(currentPart, TorsoEquipped.RightUpperThigh.transform, false);
            leftLegEquipped = adding.GetComponent <LegPart>();
            leftLegEquipped.EquipLeg(TorsoEquipped.LeftUpperThigh, TorsoEquipped.Leftshin, TorsoEquipped.LefttAnkle, TorsoEquipped.LeftFoot);


            list.ChangeEquip(currentPart, partType.LeftLeg, currentIndex);
            adding.name = currentPart.name;
            adding      = null;
            break;

        case partType.RightLeg:
            if (rightLegEquipped != null && currentPart.name == rightLegEquipped.gameObject.name)
            {
            }
            if (rightLegEquipped != null)
            {
                rightLegEquipped.DeleteLeg();
            }
            adding           = Instantiate(currentPart, TorsoEquipped.RightUpperThigh.transform, false);
            rightLegEquipped = adding.GetComponent <LegPart>();
            rightLegEquipped.EquipLeg(TorsoEquipped.RightUpperThigh, TorsoEquipped.Rightshin, TorsoEquipped.RightAnkle, TorsoEquipped.RightFoot);


            list.ChangeEquip(currentPart, partType.RightLeg, currentIndex);
            adding.name = currentPart.name;
            adding      = null;
            break;

        default:
            break;
        }

        if (TorsoEquipped.bodyType == BodyType.FourArm)
        {
            Destroy(TorsoEquipped.gameObject);
            list.BuildCharacter(parentOfTorso, this);
            return;
        }
    }
Example #30
0
 protected virtual void OnItemClicked(Item item, ItemPart itemPart, MouseButtons mouseButtons)
 {
     if (ItemClicked != null)
     {
         ItemClicked(this, new EventArgs<Triple<Item, ItemPart, MouseButtons>>(
             Triple.Create(item, itemPart, mouseButtons)));
     }
 }
Example #31
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            GetFocus();

            Point clientPt = new Point(e.X, e.Y);

            if (clientPt != this.lastMouseMovePt)
            {
                Point viewPt = ClientPointToViewPoint(clientPt);
                int itemIndex = ViewPointToItemIndex(viewPt);

                if (this.mouseDownButton == MouseButtons.None)
                {
                    if (itemIndex >= 0 && itemIndex < this.items.Count)
                    {
                        Item item = this.items[itemIndex];
                        Point itemPt = ViewPointToItemPoint(itemIndex, viewPt);
                        ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                        this.mouseOverIndex = itemIndex;
                        this.mouseOverItemPart = itemPart;
                        this.mouseOverApplyRendering = true;
                    }
                    else
                    {
                        this.mouseOverApplyRendering = false;
                    }
                }
                else
                {
                    this.mouseOverApplyRendering = false;

                    if (itemIndex != this.mouseDownIndex)
                    {
                        this.mouseDownApplyRendering = false;
                    }
                    else if (itemIndex < 0 || itemIndex >= this.items.Count)
                    {
                        this.mouseDownApplyRendering = false;
                    }
                    else
                    {
                        Item item = this.Items[itemIndex];
                        Point itemPt = ViewPointToItemPoint(itemIndex, viewPt);

                        ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                        if (itemPart != this.mouseDownItemPart)
                        {
                            this.mouseDownApplyRendering = false;
                        }
                    }
                }

                MouseStatesToItemStates();
                Refresh();
            }

            this.lastMouseMovePt = clientPt;
            base.OnMouseMove(e);
        }
        public Stream GetData(BodyType type, long truncationSize, out long totalDataSize, out IEnumerable <AirSyncAttachmentInfo> attachments)
        {
            Item item = base.XsoItem as Item;

            attachments = null;
            if (item == null)
            {
                totalDataSize = 0L;
                return(null);
            }
            Stream stream;

            if (string.Equals(item.ClassName, "IPM.Note.SMIME", StringComparison.OrdinalIgnoreCase) && truncationSize != 0L)
            {
                string smimenotSupportedBodyHtml = XsoBodyPartProperty.GetSMIMENotSupportedBodyHtml(item.Session);
                stream        = new MemoryStream(Encoding.UTF8.GetBytes(smimenotSupportedBodyHtml));
                totalDataSize = stream.Length;
                return(stream);
            }
            switch (type)
            {
            case BodyType.None:
            case BodyType.PlainText:
            case BodyType.Rtf:
            case BodyType.Mime:
                throw new ConversionException(string.Format("Invalid body type requested: {0}", type));

            case BodyType.Html:
            {
                ConversationId valueOrDefault = item.GetValueOrDefault <ConversationId>(ItemSchema.ConversationId, null);
                if (valueOrDefault == null)
                {
                    throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, null, false)
                          {
                              ErrorStringForProtocolLogger = "NoConversationIdForItem"
                          };
                }
                Conversation conversation;
                bool         orCreateConversation = Command.CurrentCommand.GetOrCreateConversation(valueOrDefault, true, out conversation);
                if (conversation == null)
                {
                    throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, null, false)
                          {
                              ErrorStringForProtocolLogger = "ConversationObjectLoadFailedForItem"
                          };
                }
                if (orCreateConversation)
                {
                    conversation.LoadItemParts(new List <StoreObjectId>
                        {
                            item.StoreObjectId
                        });
                }
                IConversationTreeNode conversationTreeNode = null;
                if (!conversation.ConversationTree.TryGetConversationTreeNode(item.StoreObjectId, out conversationTreeNode))
                {
                    AirSyncDiagnostics.TraceError <StoreObjectId>(ExTraceGlobals.AirSyncTracer, this, "Cannot find itemId {0} in conversation tree!", item.StoreObjectId);
                    totalDataSize = 0L;
                    return(null);
                }
                bool flag = false;
                AirSyncDiagnostics.FaultInjectionTracer.TraceTest <bool>(3970313533U, ref flag);
                if (flag)
                {
                    totalDataSize = 0L;
                    return(null);
                }
                ItemPart itemPart = conversation.GetItemPart(item.StoreObjectId);
                if (!itemPart.DidLoadSucceed)
                {
                    AirSyncDiagnostics.TraceError(ExTraceGlobals.AirSyncTracer, this, "ItemPart.DidLoadSucceed is false!");
                    stream        = null;
                    totalDataSize = 0L;
                    return(stream);
                }
                using (AirSyncStream airSyncStream = new AirSyncStream())
                {
                    try
                    {
                        using (HtmlWriter htmlWriter = new HtmlWriter(airSyncStream, Encoding.UTF8))
                        {
                            itemPart.WriteUniquePart(htmlWriter);
                            htmlWriter.Flush();
                        }
                    }
                    catch (TextConvertersException innerException)
                    {
                        throw new AirSyncPermanentException(StatusCode.Sync_ClientServerConversion, null, innerException, false);
                    }
                    airSyncStream.Seek(0L, SeekOrigin.Begin);
                    stream = new AirSyncStream();
                    uint streamHash;
                    StreamHelper.CopyStream(airSyncStream, stream, Encoding.UTF8, (int)truncationSize, true, out streamHash);
                    ((AirSyncStream)stream).StreamHash = (int)streamHash;
                    totalDataSize = ((truncationSize < 0L || airSyncStream.Length < truncationSize) ? stream.Length : airSyncStream.Length);
                    Dictionary <AttachmentId, AirSyncAttachmentInfo> dictionary = null;
                    if (itemPart.Attachments != null && itemPart.Attachments.Count > 0)
                    {
                        dictionary = itemPart.Attachments.ToDictionary((AttachmentInfo x) => x.AttachmentId, (AttachmentInfo x) => new AirSyncAttachmentInfo
                            {
                                AttachmentId = x.AttachmentId,
                                IsInline     = x.IsInline,
                                ContentId    = x.ContentId
                            });
                    }
                    Dictionary <AttachmentId, string> dictionary2;
                    Command.CurrentCommand.InlineAttachmentContentIdLookUp.TryGetValue(item.Id.ObjectId, out dictionary2);
                    if (dictionary2 != null)
                    {
                        if (dictionary != null)
                        {
                            foreach (KeyValuePair <AttachmentId, string> keyValuePair in dictionary2)
                            {
                                AirSyncAttachmentInfo airSyncAttachmentInfo;
                                if (dictionary.TryGetValue(keyValuePair.Key, out airSyncAttachmentInfo) && airSyncAttachmentInfo != null)
                                {
                                    airSyncAttachmentInfo.IsInline  = true;
                                    airSyncAttachmentInfo.ContentId = keyValuePair.Value;
                                }
                                else
                                {
                                    dictionary[keyValuePair.Key] = new AirSyncAttachmentInfo
                                    {
                                        AttachmentId = keyValuePair.Key,
                                        IsInline     = true,
                                        ContentId    = keyValuePair.Value
                                    };
                                }
                            }
                            attachments = dictionary.Values;
                        }
                        else
                        {
                            attachments = from inlineAttachment in dictionary2
                                          select new AirSyncAttachmentInfo
                            {
                                AttachmentId = inlineAttachment.Key,
                                IsInline     = true,
                                ContentId    = inlineAttachment.Value
                            };
                        }
                    }
                    else
                    {
                        attachments = ((dictionary != null) ? dictionary.Values : null);
                    }
                    return(stream);
                }
                break;
            }
            }
            stream        = null;
            totalDataSize = 0L;
            return(stream);
        }
Example #33
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            GetFocus();

            Point clientPt = new Point(e.X, e.Y);

            if (clientPt != this.lastMouseMovePt)
            {
                Point viewPt    = ClientPointToViewPoint(clientPt);
                int   itemIndex = ViewPointToItemIndex(viewPt);

                if (this.mouseDownButton == MouseButtons.None)
                {
                    if (itemIndex >= 0 && itemIndex < this.items.Count)
                    {
                        Item     item     = this.items[itemIndex];
                        Point    itemPt   = ViewPointToItemPoint(itemIndex, viewPt);
                        ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                        this.mouseOverIndex          = itemIndex;
                        this.mouseOverItemPart       = itemPart;
                        this.mouseOverApplyRendering = true;
                    }
                    else
                    {
                        this.mouseOverApplyRendering = false;
                    }
                }
                else
                {
                    this.mouseOverApplyRendering = false;

                    if (itemIndex != this.mouseDownIndex)
                    {
                        this.mouseDownApplyRendering = false;
                    }
                    else if (itemIndex < 0 || itemIndex >= this.items.Count)
                    {
                        this.mouseDownApplyRendering = false;
                    }
                    else
                    {
                        Item  item   = this.Items[itemIndex];
                        Point itemPt = ViewPointToItemPoint(itemIndex, viewPt);

                        ItemPart itemPart = ItemPointToItemPart(item, itemPt);

                        if (itemPart != this.mouseDownItemPart)
                        {
                            this.mouseDownApplyRendering = false;
                        }
                    }
                }

                MouseStatesToItemStates();
                Refresh();
            }

            this.lastMouseMovePt = clientPt;
            base.OnMouseMove(e);
        }
Example #34
0
            public void SetPartRenderState(ItemPart itemPart, PushButtonState renderState)
            {
                switch (itemPart)
                {
                    case ItemPart.None:
                        break;

                    case ItemPart.CloseButton:
                        CloseRenderState = renderState;
                        break;

                    case ItemPart.Image:
                        ImageRenderState = renderState;
                        break;

                    default:
                        throw new InvalidEnumArgumentException();
                }
            }
Example #35
0
        protected override void OnItemClicked(Item item, ItemPart itemPart, MouseButtons mouseButtons)
        {
            DocumentWorkspace dw = item.Tag as DocumentWorkspace;

            if (dw != null)
            {
                switch (itemPart)
                {
                    case ItemPart.None:
                        // do nothing
                        break;

                    case ItemPart.CloseButton:
                        if (mouseButtons == MouseButtons.Left)
                        {
                            OnDocumentClicked(dw, DocumentClickAction.Close);
                        }
                        break;

                    case ItemPart.Image:
                        if (mouseButtons == MouseButtons.Left)
                        {
                            SelectedDocument = dw;
                        }
                        else if (mouseButtons == MouseButtons.Right)
                        {
                            // TODO: right click menu
                        }
                        break;

                    default:
                        throw new InvalidEnumArgumentException();
                }
            }

            base.OnItemClicked(item, itemPart, mouseButtons);
        }
    // Update is called once per frame
    void Update()
    {
        if (!Refresh)
        {
            return;
        }

        Refresh = false;

        if (monsterSteps && !monsterSteps.EnableEquip)
        {
            BuyOrEquip.interactable = false;
            displayCurrent.text     = "";
            return;
        }


        if (currentPart == null)
        {
            BuyOrEquip.interactable = false;
            displayCurrent.text     = "";
            return;
        }

        ItemPart part = currentPart.GetComponent <ItemPart>();


        if (part.owned)
        {
            CurrentButton.interactable = false;
            displayCurrent.text        = currentPart.gameObject.name;
        }
        else
        {
            CurrentButton.interactable = true;
            displayCurrent.text        = currentPart.gameObject.name;
        }

        if (part.owned)
        {
            BuyOrEquip.interactable = true;
            selectPart.SelectEquipButton(true);
            return;
        }
        else if (stars < part.starRequired)
        {
            displayCurrent.text     = "Not enough Stars.\n Needs " + part.starRequired + " Stars";
            BuyOrEquip.interactable = false;
            selectPart.SelectEquipButton(false);
        }

        else if (manager.shards < part.cost)
        {
            displayCurrent.text     = "Can't afford.\n Costs " + part.cost + " Shards";
            BuyOrEquip.interactable = false;
            selectPart.SelectEquipButton(false);
        }
        else
        {
            displayCurrent.text = "Buy " + currentPart.gameObject.name + "for " + part.cost + "?";

            BuyOrEquip.interactable = true;
            selectPart.SelectEquipButton(false);
        }
    }
Example #37
0
 public void PerformItemClick(int itemIndex, ItemPart itemPart, MouseButtons mouseButtons)
 {
     PerformItemClick(this.items[itemIndex], itemPart, mouseButtons);
 }
Example #38
0
 public void PerformItemClick(int itemIndex, ItemPart itemPart, MouseButtons mouseButtons)
 {
     PerformItemClick(this.items[itemIndex], itemPart, mouseButtons);
 }
Example #39
0
 public static void addPartToNPC(int npcType, ItemPart part)
 {
     addPartToNPC(npcType, part.item);
 }
Example #40
0
        internal static bool IsProtectedVoicemailItem(ItemPart itemPart)
        {
            string valueOrDefault = itemPart.StorePropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty);

            return(valueOrDefault.StartsWith("IPM.Note.RPMSG.Microsoft.Voicemail", StringComparison.OrdinalIgnoreCase));
        }