예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        isResolved = false;
        mItemsBox  = FindObjectOfType <ItemsBox>();
        var childCodes = this.transform.Find("Codes");

        for (int i = 0; i < childCodes.childCount; i++)
        {
            mCodes.Add(new Code(childCodes.GetChild(i).gameObject, mInitialCode[i].ToString().ToUpper()));
        }
        for (int i = 0; i < mAllCodes.Length; i++)
        {
            string spriteName = mAllCodes[i].ToString().ToUpper();
            Debug.Log(RESOURCES_PATH + "/" + spriteName);
            var sp = Instantiate(Resources.Load <Sprite>(RESOURCES_PATH + "/" + spriteName)) as Sprite;
            mCodeVSSprite.Add(spriteName, sp);
        }
        mCodeSeq = mAllCodes;
        mNowCode = mInitialCode;
        RenderCode();
        Debug.Assert(mCodeVSSprite.Count == mAllCodes.Length);
        Debug.Assert(mCodes.Count == mInitialCode.Length);
        //foreach(var obj in mCodes)
        //{
        //    Debug.Log(obj.obj.name);
        //}
    }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        mCurrCaptureIndex = -1;
        mCurrReviewIndex  = -1;
        mSpR          = this.transform.Find("Screen").GetComponent <SpriteRenderer>();
        mScreenWidth  = mSpR.sprite.texture.width;
        mScreenHeight = mSpR.sprite.texture.height;
        //mSpR.sprite = mSpBackGournd;

        //mSpriteSize = new Vector2(
        //    mSpR.transform.localScale.x * mSpR.sprite.textureRect.width / mSpR.sprite.pixelsPerUnit,
        //    mSpR.transform.localScale.y * mSpR.sprite.textureRect.height / mSpR.sprite.pixelsPerUnit
        //    );
        GameObject[] rootGameObjects = SceneManager.GetActiveScene().GetRootGameObjects();
        foreach (var rootGameObject in rootGameObjects)
        {
            ICapturable[] childrenInterfaces = rootGameObject.GetComponentsInChildren <ICapturable>(true);
            foreach (var childInterface in childrenInterfaces)
            {
                mCapturable.Add(childInterface);
            }
        }
        mItemsBox  = FindObjectOfType <ItemsBox>();
        mSceneCtrl = FindObjectOfType <SceneCtrl>();
    }
예제 #3
0
 // Start is called before the first frame update
 void Start()
 {
     mEnding = FindObjectOfType <Ending>();
     Debug.Assert(mEnding != null);
     cntReceived   = 0;
     itemsBox      = FindObjectOfType <ItemsBox>();
     quizReception = this.transform.Find("Area").GetComponent <QuizReception>();
 }
예제 #4
0
 // Start is called before the first frame update
 void Start()
 {
     mSpVide        = Instantiate(this.GetComponent <SpriteRenderer>().sprite);
     mStGreen       = STATE.HAS;
     mStRed         = STATE.HAS;
     mItemsBox      = FindObjectOfType <ItemsBox>();
     mQuizReception = this.GetComponent <QuizReception>();
 }
예제 #5
0
 // Start is called before the first frame update
 void Start()
 {
     mPhase   = 0;
     isGaved  = false;
     itemsBox = FindObjectOfType <ItemsBox>();
     mArea    = this.transform.Find("Area").gameObject;
     mSpR     = mArea.GetComponent <SpriteRenderer>();
 }
예제 #6
0
 public static bool TryClose()
 {
     if (ItemsBox.mInstance != null)
     {
         ItemsBox.mInstance.Close();
         ItemsBox.mInstance = null;
         return true;
     }
     return false;
 }
예제 #7
0
 // Start is called before the first frame update
 void Start()
 {
     mEnding = FindObjectOfType <Ending>();
     Debug.Assert(mEnding != null);
     cntReceived   = 0;
     itemsBox      = FindObjectOfType <ItemsBox>();
     quizReception = this.transform.Find("Area").GetComponent <QuizReception>();
     mShowName     = new List <ShowName>(this.transform.Find("Area").GetComponents <ShowName>());
     mShowName[0].SetActive(true);
     mShowName[1].SetActive(false);
 }
예제 #8
0
 // Start is called before the first frame update
 void Start()
 {
     mPhase = 0;
     mPart1.SetActive(false);
     mPart2.SetActive(false);
     mItemsBox = FindObjectOfType <ItemsBox>();
     mSpR      = this.GetComponent <SpriteRenderer>();
     for (int i = 0; i < 4; i++)
     {
         var sp = Instantiate(Resources.Load <Sprite>(RESOURCES_PATH + "/" + i.ToString())) as Sprite;
         mSps.Add(sp);
     }
 }
예제 #9
0
    // Update is called once per frame
    void Update()
    {
        if ((mQuizElec == null || mQuizElec.mPhase != 2) &&
            !mIsSetup)
        {
            this.gameObject.GetComponent <Collider2D>().enabled = false;
        }
        else
        {
            mIsSetup = true;
            this.gameObject.GetComponent <Collider2D>().enabled = true;
        }
        mItemsBox = FindObjectOfType <ItemsBox>();
        for (int i = 0; i < 3; i++)
        {
            var sp = Instantiate(Resources.Load <Sprite>(RESOURCES_PATH + "/" + i.ToString())) as Sprite;
            mSps.Add(sp);
        }
        switch (mStage)
        {
        case 0:
            mSpR.sprite               = mSpScene[0];
            mSceneObj.relatedQuiz     = mQuizComputer;
            mSceneObj.relatedQuizArea = mQuizComputer.transform.Find("Area").gameObject;
            break;

        case 1:
            mSpR.sprite = mSpScene[1];
            this.transform.localScale = new Vector3(1, 1, 1);
            this.transform.position   = new Vector3(0, 0, 0);
            this.GetComponent <BoxCollider2D>().offset = new Vector2(-2.96f, -2.65f);
            this.GetComponent <BoxCollider2D>().size   = new Vector2(1.42f, 0.92f);
            mSceneObj.relatedQuiz     = mQuizRotate;
            mSceneObj.relatedQuizArea = mQuizRotate.transform.Find("Area").gameObject;
            break;

        case 2:
            mSpR.sprite = mSpScene[2];
            this.transform.localScale = new Vector3(1, 1, 1);
            this.transform.position   = new Vector3(0, 0, 0);
            this.GetComponent <BoxCollider2D>().offset = new Vector2(-2.96f, -2.65f);
            this.GetComponent <BoxCollider2D>().size   = new Vector2(1.42f, 0.92f);
            mSceneObj.relatedQuiz     = mQuizPoints;
            mSceneObj.relatedQuizArea = mQuizPoints.transform.Find("Area").gameObject;
            break;

        default:
            Debug.LogError("UNKOWN STAGE");
            break;
        }
    }
예제 #10
0
        private void UpdateItemsBox()
        {
            for (int i = ItemsBox.Items.Count - 1; i >= 0; i--)
            {
                ItemsBox.Items.RemoveAt(i);
            }

            for (int i = 0; i < data.GetItems().Count(); i++)
            {
                BudgetCalcItem item = data.GetItems().ElementAt(i).Value;
                ItemsBox.Items.Add(item.ItemName);
                ItemsBox.SetItemChecked(ItemsBox.Items.IndexOf(item.ItemName), item.Selected);
            }
        }
예제 #11
0
        /// <summary>
        /// Constructor.
        /// </summary>
        ///
        /// <param name="Text">         . </param>
        /// <param name="Prompt">       . </param>
        /// <param name="Input">        . </param>
        /// <param name="Items">        The items. </param>
        /// <param name="CheckedItems"> The checked items. </param>
        public InputSelectDialog(String Text, String Prompt, String Input, IEnumerable <Object> Items, IEnumerable <Object> CheckedItems)
            : this(Text, Prompt, Input, Items)
        {
            for (Int32 i = 0; i < ItemsBox.Items.Count; i++)
            {
                ItemsBox.SetItemChecked(i, false);
            }

            foreach (Object item in CheckedItems)
            {
                Int32 ndx = ItemsBox.Items.IndexOf(item);
                ItemsBox.SetItemChecked(ndx, true);
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     enable    = false;
     mItemsBox = FindObjectOfType <ItemsBox>();
     Debug.Assert(mItemsBox != null);
     mCurrObj  = null;
     mCurrObj2 = null;
     for (int i = 0; i < mObjs.Count; i++)
     {
         Debug.Assert(mObjs[i] != null && mShows[i] != null);
         Debug.Assert(mShows[i].transform.Find("Area").gameObject != null);
         mObjVSShow.Add(mObjs[i], mShows[i]);
     }
 }
예제 #13
0
 // Start is called before the first frame update
 void Start()
 {
     mPhase            = 0;
     mIdxSpScene       = mIdxSpQuiz = 1;
     mNeedSetLayerMask = false;
     Common.Utils.SetActiveLayer("Default");
     mSRender = this.GetComponent <SpriteRenderer>();
     itemsBox = FindObjectOfType <ItemsBox>();
     Debug.Assert(itemsBox != null);
     if (relatedQuiz != null)
     {
         relatedQuizArea = relatedQuiz.transform.Find("Area").gameObject;
         Debug.Assert(relatedQuizArea != null);
     }
 }
예제 #14
0
 // Start is called before the first frame update
 void Start()
 {
     mNeedSetLayerMask = false;
     mSRender          = this.GetComponent <SpriteRenderer>();
     mSRender.enabled  = visiable;
     itemsBox          = FindObjectOfType <ItemsBox>();
     Debug.Assert(itemsBox != null);
     // TODO a more complete assertion
     //Debug.Assert(pickable && objToGive != null);
     Debug.Assert(!receiveItems || relatedQuiz != null);
     Debug.Assert(pickable || draguable || visiable);
     Debug.Assert(pickable == false || relatedItem != null);
     if (relatedQuiz != null)
     {
         relatedQuizArea = relatedQuiz.transform.Find("Area").gameObject;
         Debug.Assert(relatedQuizArea != null);
     }
 }
예제 #15
0
 // Start is called before the first frame update
 void Start()
 {
     mItemsBox = FindObjectOfType <ItemsBox>();
     string[] rsName = { "1x3", "1x2", "3x1", "2x1", "target" };
     foreach (var name in rsName)
     {
         var sp = Instantiate(Resources.Load <Sprite>(RESOURCES_PATH + "/" + name)) as Sprite;
         mSps.Add(name, sp);
     }
     if (mStage2)
     {
         Clear();
         Set2();
     }
     else
     {
         Clear();
         Set1();
     }
 }
예제 #16
0
 public static void Show(List<RewardData> rewards, string title = null, bool showNum = false)
 {
     if (rewards == null)
     {
         global::Debug.LogError(new object[]
         {
             "rewards is null"
         });
         return;
     }
     if (rewards.Count == 0)
     {
         global::Debug.LogError(new object[]
         {
             "rewards count == 0"
         });
         return;
     }
     GameObject prefab = Res.LoadGUI("GUI/ItemsBox");
     GameObject gameObject = NGUITools.AddChild(GameUIManager.mInstance.uiCamera.gameObject, prefab);
     gameObject.transform.localPosition = new Vector3(0f, 0f, 4000f);
     if (ItemsBox.mInstance != null)
     {
         ItemsBox.TryClose();
     }
     ItemsBox.mInstance = gameObject.AddComponent<ItemsBox>();
     if (string.IsNullOrEmpty(title))
     {
         title = Singleton<StringManager>.Instance.GetString("showRewardLb");
     }
     else
     {
         title = Singleton<StringManager>.Instance.GetString(title);
     }
     ItemsBox.mInstance.Init(rewards, title, showNum);
 }
예제 #17
0
 public void InitWithBaseScene(ItemsBox basebox)
 {
     this.mBaseBox = basebox;
     this.CreateObjects();
 }
예제 #18
0
 private void ItemsBox_DropDownClosed(object sender, EventArgs e)
 {
     this.BeginInvoke(new Action(() => { ItemsBox.Select(0, 0); }));
 }
예제 #19
0
 public void Init(ItemsBox basebox)
 {
     this.mBaseBox = basebox;
 }
예제 #20
0
 // Start is called before the first frame update
 void Start()
 {
     isGaved  = false;
     itemsBox = FindObjectOfType <ItemsBox>();
 }
예제 #21
0
        public Window(Inventory inventory)
            : this(new Builder("window.ui"))
        {
            Inventory = inventory;

            // load the menues and toolbars
            uiManager = new UIManager();

            // create the file actions
            Gtk.Action saveInventoryAction = new Gtk.Action("saveFile","Save","Save the active inventory",Stock.Save);
            saveInventoryAction.Activated += OnSaveInventory;
            Gtk.Action printLabelsAction = new Gtk.Action("printLabels","Print Labels","Print labels for items.",Stock.Print);
            printLabelsAction.Activated += OnPrintLabels;
            Gtk.Action quitAction = new Gtk.Action("quit","Quit","Quit the application",Stock.Quit);
            quitAction.Activated += OnQuit;
            Gtk.Action fileAction = new Gtk.Action("file","File");
            ActionGroup fileActionGroup = new ActionGroup("file");
            fileActionGroup.Add(saveInventoryAction);
            fileActionGroup.Add(printLabelsAction);
            fileActionGroup.Add(quitAction);
            fileActionGroup.Add(fileAction);
            uiManager.InsertActionGroup(fileActionGroup,0);

            // create items box
            itemsBox = new ItemsBox(inventory.Items, uiManager);
            itemsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            itemsBox.ShowMe += OnShowItemsBox;
            itemsAlign.Add(itemsBox);

            // create locations box
            locationsBox = new LocationsBox(inventory.Locations, uiManager);
            locationsBox.DrawDescriptionEntry += OnDrawDescriptionEntry;
            locationsBox.ShowMe += OnShowLocationsBox;
            locationsBox.GotoItem += OnGotoLocationsItem;
            locationsAlign.Add(locationsBox);

            // create tags box
            tagsBox = new TagsBox(inventory.Tags, uiManager);
            tagsBox.ShowMe += OnShowTagsBox;
            tagsAlign.Add(tagsBox);

            // create tool and menubar
            uiManager.AddUiFromResource("window_menues.xml");
            menuBar = (MenuBar) uiManager.GetWidget("/menuBar");
            toolbar = (Toolbar) uiManager.GetWidget("/toolbar");
            toolbar.IconSize = IconSize.LargeToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Both;

            mainBox.PackStart(menuBar,false,true,0);
            mainBox.PackStart(toolbar,false,true,0);

            // laod category icons
            itemsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).ItemsTabIcon;
            locationsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).LocationsTabIcon;
            tagsTabImage.Pixbuf = ((GtkSettings)Inventory.Settings).TagsTabIcon;

            this.Icon = ((GtkSettings)Inventory.Settings).WindowIcon;
            this.Resize(((GtkSettings)Inventory.Settings).MainWindowWidth,((GtkSettings)Inventory.Settings).MainWindowHeight);
        }
예제 #22
0
 // Start is called before the first frame update
 void Start()
 {
     mPhase   = 0;
     itemsBox = FindObjectOfType <ItemsBox>();
 }