Ejemplo n.º 1
0
    public void SetUpMailbox(List <FacebookAppRequest> appRequests)
    {
        foreach (Transform childTransform in this.Grid.transform)
        {
            Destroy(childTransform.gameObject);
        }

        foreach (FacebookAppRequest appRequest in appRequests)
        {
            string appDataTypeString = FacebookAppRequestDataParser.GetAppDataType(appRequest.Data);

            FacebookAppRequest.AppDataType appDataType = FacebookAppRequest.AppDataType.MonsterUnlock;

            // Ignore unknown types for future proofing
            if (appDataType.TryParse(appDataTypeString, out appDataType))
            {
                GameObject item = NGUITools.AddChild(this.Grid.gameObject, this.FacebookAcceptItem.gameObject);

                FacebookItem facebookItem = item.GetComponent <FacebookItem>();
                facebookItem.SetItem(appRequest);
                facebookItem.Grid = this.Grid;

                UIWidget widgetItem = item.GetComponent <UIWidget>();
                widgetItem.leftAnchor   = this.LeftAnchor;
                widgetItem.rightAnchor  = this.RightAnchor;
                widgetItem.topAnchor    = this.TopAnchor;
                widgetItem.bottomAnchor = this.BottomAnchor;
                widgetItem.ResetAnchors();
            }
        }

        this.Grid.Reposition();
    }
Ejemplo n.º 2
0
 private void ProcessGift(FacebookAppRequest appRequest)
 {
     switch (FacebookAppRequestDataParser.GetAppDataType(appRequest.Data))
     {
     default:
         break;
     }
 }
Ejemplo n.º 3
0
    private void ProcessRequest(FacebookAppRequest appRequest)
    {
        string appRequestObject = FacebookAppRequestDataParser.GetAppRequestObject(appRequest.Data);
        string appDataType      = FacebookAppRequestDataParser.GetAppDataType(appRequest.Data);
        string dataString       = FacebookAppRequestDataParser.GenerateDataString(
            FacebookAppRequest.AppRequestType.Gift, appDataType, appRequestObject);

        switch (appDataType)
        {
        default:
            break;
        }
    }
Ejemplo n.º 4
0
    public void ProcessAppRequest(FacebookAppRequest appRequest)
    {
        switch (FacebookAppRequestDataParser.GetAppRequestType(appRequest.Data))
        {
        case FacebookAppRequest.AppRequestType.Request:
            this.ProcessRequest(appRequest);
            break;

        case FacebookAppRequest.AppRequestType.Gift:
            this.ProcessGift(appRequest);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 5
0
    public void SetItem(FacebookAppRequest appRequest)
    {
        this.AppRequest = appRequest;

        string description;
        string person = appRequest.FromName;

        string data     = FacebookAppRequestDataParser.GetAppRequestObject(appRequest.Data);
        string dataType = FacebookAppRequestDataParser.GetAppDataType(appRequest.Data);

        switch (dataType)
        {
        case "MonsterUnlock":
            description = data;
            break;

        case "Inventory":
            description = ShopManager.VirtualGoodsDictionary[data].Name;

            break;

        default:
            description = "Unknown";
            break;
        }

        switch (FacebookAppRequestDataParser.GetAppRequestType(appRequest.Data))
        {
        case FacebookAppRequest.AppRequestType.Gift:
            this.Message.text     = string.Format("Accept {0} from {1}", description, person);
            this.ButtonLabel.text = "Accept";
            break;

        case FacebookAppRequest.AppRequestType.Request:
            this.Message.text     = string.Format("Send {0} to {1}", description, person);
            this.ButtonLabel.text = "Send";
            break;
        }
    }