1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
using System;
using UnityEngine;
public class PurchaseButton : MonoBehaviour
{
public StoreMenu Parent { get; set; }
public SpriteRenderer PurchasedIcon;
public TextRenderer NameText;
public SpriteRenderer HatImage;
public Sprite MannequinFrame;
public SpriteRenderer Background;
public IBuyable Product;
public bool Purchased;
public string Name;
public string Price;
public string ProductId;
public void SetItem(IBuyable product, string productId, string name, string price, bool purchased)
{
this.Product = product;
this.Purchased = purchased;
this.Name = name;
this.Price = price;
this.ProductId = productId;
this.PurchasedIcon.enabled = this.Purchased;
if (this.Product is HatBehaviour)
{
HatBehaviour hat = (HatBehaviour)this.Product;
this.NameText.gameObject.SetActive(false);
this.HatImage.transform.parent.gameObject.SetActive(true);
PlayerControl.SetHatImage(hat, this.HatImage);
this.SetSquare();
return;
}
if (this.Product is SkinData)
{
SkinData skin = (SkinData)this.Product;
this.NameText.gameObject.SetActive(false);
this.HatImage.transform.parent.gameObject.SetActive(true);
this.HatImage.transform.parent.GetComponent<SpriteRenderer>().sprite = this.MannequinFrame;
this.HatImage.transform.parent.localPosition = new Vector3(0f, 0f, -0.01f);
this.HatImage.transform.parent.localScale = Vector3.one * 0.3f;
this.HatImage.transform.localPosition = new Vector3(0f, 0f, -0.01f);
this.HatImage.transform.localScale = Vector3.one * 2f;
PlayerControl.SetSkinImage(skin, this.HatImage);
this.SetSquare();
return;
}
if (this.Product is PetBehaviour)
{
PetBehaviour petBehaviour = (PetBehaviour)this.Product;
this.NameText.gameObject.SetActive(false);
this.HatImage.transform.parent.gameObject.SetActive(true);
this.HatImage.transform.parent.GetComponent<SpriteRenderer>().enabled = false;
this.HatImage.material = new Material(petBehaviour.rend.sharedMaterial);
PlayerControl.SetPetImage(petBehaviour, (int)SaveManager.BodyColor, this.HatImage);
this.SetSquare();
return;
}
this.NameText.Text = this.Name;
}
private void SetSquare()
{
this.Background.size = new Vector2(0.7f, 0.7f);
this.Background.GetComponent<BoxCollider2D>().size = new Vector2(0.7f, 0.7f);
this.PurchasedIcon.transform.localPosition = new Vector3(0f, 0f, -1f);
}
internal void SetPurchased()
{
this.Purchased = true;
this.PurchasedIcon.enabled = true;
}
public void DoPurchase()
{
this.Parent.SetProduct(this);
}
}
|