Ejemplo n.º 1
0
    public void AddInsPost(string NPCName, Sprite postImg)
    {
        GameObject newPost = Instantiate(PosturePostPrefabNew, postParent.transform);

        NPC thisNPC     = SpriteLoader.NPCDic[NPCName];
        var profile     = newPost.transform.Find("ProfilePhoto").gameObject;
        var profileName = newPost.transform.Find("ProfileName").gameObject.GetComponent <TextMeshProUGUI>();

        profile.GetComponent <Button>().onClick.AddListener(() => ClickProfilePhoto(NPCName));
        profile.GetComponent <Image>().sprite = thisNPC.profile;
        profileName.text = thisNPC.name;
        newPost.transform.Find("Post").gameObject.GetComponent <Image>().sprite = postImg;

        newPost.transform.SetAsFirstSibling();

        if (NPCName == "Karara")
        {
            thisNPC.Add2KararaPostList(postImg);
        }
    }