コード例 #1
0
    public static void SetViewToTextOptions(TextMessageCollection.CollectionType collectionType)
    {
        if (collectionType == TextMessageCollection.CollectionType.Inbox)
        {
            cs.ResetAllLines ();
            cs.SetLineContent (1, "Reply", selectOptionAtIndex == 0);
            cs.SetLineContent (2, "Delete", selectOptionAtIndex == 1);
            PhoneState.SetState(PhoneState.State.TextMessageOptions);
            indexOfTextInOptions = selectOptionAtIndex;
            cs.SetNavLeftText ("Back");
            cs.SetNavRightText ("Select");
            m_collectionType = TextMessageCollection.CollectionType.Inbox;

            lowerIndexTextInView = 0;
            upperIndexTextInView = 1;
            optionsAmount = 2;
        }
        else if (collectionType == TextMessageCollection.CollectionType.Outbox)
        {
            cs.ResetAllLines ();
            cs.SetLineContent (1, "Delete", selectOptionAtIndex == 0);
            PhoneState.SetState(PhoneState.State.TextMessageOptions);
            indexOfTextInOptions = selectOptionAtIndex;
            cs.SetNavLeftText ("Back");
            cs.SetNavRightText ("Select");
            m_collectionType = TextMessageCollection.CollectionType.Outbox;

            lowerIndexTextInView = 0;
            upperIndexTextInView = 0;
            optionsAmount = 1;
        }
        else if (collectionType == TextMessageCollection.CollectionType.Drafts)
        {
            cs.ResetAllLines ();
            cs.SetLineContent (1, "Enter contact", selectOptionAtIndex == 0);
            cs.SetLineContent (2, "Enter number", selectOptionAtIndex == 1);
            cs.SetLineContent (3, "Save draft and quit", selectOptionAtIndex == 2);
            cs.SetLineContent (4, "Back to drafts menu", selectOptionAtIndex == 3);
            cs.SetLineContent (5, "Delete draft", selectOptionAtIndex == 4);
            PhoneState.SetState(PhoneState.State.TextMessageOptions);
            indexOfTextInOptions = selectOptionAtIndex;
            cs.SetNavLeftText ("Back");
            cs.SetNavRightText ("Select");
            //m_collectionType = CollectionType.Create;
            m_collectionType = TextMessageCollection.CollectionType.Drafts;

            lowerIndexTextInView = 0;
            upperIndexTextInView = 0;
            optionsAmount = 5;
        }
        else if (collectionType == TextMessageCollection.CollectionType.Create)
        {
            cs.ResetAllLines ();
            cs.SetLineContent (1, "Select from contacts", selectOptionAtIndex == 0);
            cs.SetLineContent (2, "Enter number", selectOptionAtIndex == 1);
            cs.SetLineContent (3, "Save to drafts and quit", selectOptionAtIndex == 2);
            cs.SetLineContent (4, "Back to message", selectOptionAtIndex == 3);
            PhoneState.SetState(PhoneState.State.TextMessageOptions);
            indexOfTextInOptions = selectOptionAtIndex;
            cs.SetNavLeftText ("Back");
            cs.SetNavRightText ("Select");
            m_collectionType = TextMessageCollection.CollectionType.Create;

            lowerIndexTextInView = 0;
            upperIndexTextInView = 0;
            optionsAmount = 4;
        }
    }
コード例 #2
0
    // Use this for initialization
    //TurnOnPhone()
    void Start()
    {
        tsc = gameObject.GetComponent<TextStringCreation>();
        cs = (CanvasScript) canvas.GetComponent<CanvasScript>();
        cs.ResetAllLines ();

        tmm = new TextMessageMenu();
        mm = new MainMenu ();

        inboxTexts = new TextMessageCollection (inboxTextsJson, TextMessageCollection.CollectionType.Inbox);
        outboxTexts = new TextMessageCollection (outboxTextsJson, TextMessageCollection.CollectionType.Outbox);
        draftTexts = new TextMessageCollection (draftTextsJson, TextMessageCollection.CollectionType.Drafts);
        newlyWrittenText = new TextMessageCollection ("", TextMessageCollection.CollectionType.Create);

        cc = new ContactsCollection ();
        cc.LoadSavedContacts ();

        MainMenu.SetState (MainMenu.MainMenuState.Messages);
        TextMessageMenu.SetState (TextMessageMenu.TextMessageMenuState.Inbox);
        numberOnScreen = "";

        HandleHasUnreadMessages ();
        SetViewToHomeScreen ();

        if (hasReception)
        {
            receptionIcon.GetComponent<SpriteRenderer> ().sprite = hasReceptionSprite;
        }
        else
        {
            receptionIcon.GetComponent<SpriteRenderer> ().sprite = noReceptionSprite;
        }

        //example of adding a new contact
        //Contact c5 = new Contact ("lisa", "1234567");
        //cc.AddContactToContacts (c5, true);

        //example of adding a new inbox text
        //TextMessage txt1 = new TextMessage ("1234", "content txt1");
        //inboxTexts.HandleNewIncomingText(txt1, true);

        //example of adding a new outbox text
        //TextMessage outText = new TextMessage ("me", "my text message");
        //outboxTexts.AddTextToTexts(outText);
    }