public void SetSearchBox(long backGroundId, UserData userData,
                             Func <KeyValuePair <long, long>, KeyValuePair <long, long>, UserData> onUpdateHaveItems,
                             Func <KeyValuePair <long, long>, UserData> onUpdateUsedItem)
    {
        _onUpdateHaveItems = onUpdateHaveItems;
        _onUpdateUsedItem  = onUpdateUsedItem;

        _userData       = userData;
        _backGroundData = ResourceManager.Instance.LoadMasterData <BackGroundData, BackGroundDataObjectList>(backGroundId);
        ChangeBackGroundForIndex(_backGroundIndex);
        //searchPanel生成
        ClearBox();
        var searchPanel = ResourceManager.Instance.InstantiateSearchPanel(_searchPanelContent, backGroundId);

        if (searchPanel != null)
        {
            searchPanel.InitRoomLayout(_backGroundIndex, OnSearchPanelTapped);
        }


        _objSearchAction.SetActive(false);

        _backGroundId = backGroundId;

        _buttonCancel.onClick.RemoveAllListeners();
        _buttonCancel.onClick.AddListener(delegate {
            _objSearchAction.SetActive(false);
        });

        _input.onValueChanged.RemoveAllListeners();
        _input.onValueChanged.AddListener(delegate {
            if (_itemData.Answer == _input.text)
            {
                UseItem(_onUpdateHaveItems, _onUpdateUsedItem);
                //action後の説明があれば表示する
                if (_itemData.AfterActionDescription.Length > 0)
                {
                    _textDescription.text   = _itemData.AfterActionDescription[0];
                    _imageSearchItem.sprite = _itemData.UsedItemSprite;
                    _objSelectionBox.SetActive(false);
                    _objSearchAction.SetActive(true);
                    SetTapArea(_itemData.AfterActionDescription);
                }
                else
                {
                    _objSearchAction.SetActive(false);
                    _tapArea.gameObject.SetActive(false);
                }
            }
        });
        _buttonHaveItem1.SetIndividualInfo(OnItemButtonTapped);
        _buttonHaveItem2.SetIndividualInfo(OnItemButtonTapped);


        SetRightAndLeftButton(searchPanel);
    }
Example #2
0
    private void Initialize(int modelindex, float modelrotation, string model, string bodytone, string eye, GameController gameController, string dress = "", string wig = "", string ornament = "", string shoe = "")
    {
        dressData      = new DressData();
        femaleWigData  = new FemaleWigData();
        ornamentData   = new OrnamentData();
        shoeData       = new ShoeData();
        backgroundData = new BackGroundData();

        modelindex    = modelIndex;
        modelRotation = modelrotation;
        modelNameame  = model;
        bodytoneName  = bodytone;
        eyeName       = eye;
        dressName     = dress;
        wigName       = wig;
        ornamentName  = ornament;
        shoeName      = shoe;
        gameController.currentBackgroundProperty.CopyTo(ref backgroundProperty);
        backgroundName = backgroundProperty.backGroundName;
        isShowingMale  = gameController.isShowingMale;
    }
Example #3
0
    public void ReCheckData(GameController gameController)
    {
        Debug.Log("Recheck started");
        dressData      = new DressData();
        femaleWigData  = new FemaleWigData();
        ornamentData   = new OrnamentData();
        shoeData       = new ShoeData();
        backgroundData = new BackGroundData();
        maleData       = new MaleData();
        gameController.currentBackgroundProperty.CopyTo(ref backgroundProperty);
        maleData.maleIsShowing = isShowingMale = gameController.isShowingMale;
        this.bodyToneColor     = new float[] { 0.5f, gameController.femaleModelImageObject.GetComponent <Image>().color.g, 0.5f, 1f };


        try
        {
            Debug.Log("checking dress property");
            if (dressProperty != null || dressProperty.imgName != "" || dressProperty.imgName != null)
            {
                dressData.EncodeData(dressProperty, gameController.currentDressColor);
                Debug.Log(string.Format("Dress color is {0} {1} {2} {3}", dressData.pColor[0], dressData.pColor[1], dressData.pColor[2], dressData.pColor[3]));
                dressName = dressProperty.imgName;
            }
            Debug.Log("after if checking dress property");
        }
        catch //(Exception e)
        {
            Debug.Log("error checking dress property");
            Debug.Log(string.Format("Dress recheck Error : "));// {0}",e.Message));
        }


        try
        {
            Debug.Log("checking female wig property");
            if (femaleWigProperty != null || femaleWigProperty.imgName != "" || femaleWigProperty.imgName != null)
            {
                femaleWigData.EncodeData(femaleWigProperty, gameController.currentWigColor);

                wigName = femaleWigProperty.imgName;
            }
        }
        catch                                                // (Exception e)
        {
            Debug.Log(string.Format("Wig rechec Error : ")); // {0}",e.Message));
        }



        try
        {
            Debug.Log("checking ornament property");
            if (ornamentProperty != null || ornamentProperty.imgName != "" || ornamentProperty.imgName != null)
            {
                ornamentData.EncodeData(ornamentProperty);

                ornamentName = ornamentProperty.imgName;
            }
        }
        catch                                                     //(Exception e)
        {
            Debug.Log(string.Format("Ornament rechec Error : ")); // {0}",e.Message));
        }


        try
        {
            Debug.Log("checking shoe property");
            if (shoeProperty != null || shoeProperty.imgName != "" || shoeProperty.imgName != null)
            {
                shoeData.EncodeData(shoeProperty, gameController.currentShoeColor);

                shoeName = shoeProperty.imgName;
            }
        }
        catch //(Exception e)
        {
            Debug.Log("error checking shoe property");
            Debug.Log(string.Format("Shoe recheck Error "));// {0}",e.Message));
        }


        Debug.Log("Encoding male data");
        maleData.EncodeData(gameController);

        Debug.Log("Encoding background property");
        backgroundData.EncodeData(backgroundProperty);
        //Debug.Log(string.Format("Recheck data : background name :{0}  background path {1} ", backgroundData.backGroundName, backgroundData.backGroundPath));
        Debug.Log(string.Format("male data : male showing : {0}  Wearing wig : {1}  wearing tie : {2}", maleData.maleIsShowing, maleData.isWearingWig, maleData.isWearingTie));
    }
Example #4
0
    public void Initialize(int modelindex, float modelrotation, string model, string bodytone, string eye, GameController gameController, DressProperties dressproperty = null, FemaleWigProperties wigproperty = null, OrnamentProperties ornamentproperty = null, ShoeProperties shoeproperty = null)
    {
        Debug.Log("Initializing started");
        dressData              = new DressData();
        femaleWigData          = new FemaleWigData();
        ornamentData           = new OrnamentData();
        shoeData               = new ShoeData();
        backgroundData         = new BackGroundData();
        maleData               = new MaleData();
        modelIndex             = modelindex;
        modelRotation          = modelrotation;
        modelNameame           = model;
        bodytoneName           = bodytone;
        eyeName                = eye;
        this.dressProperty     = dressproperty;
        this.femaleWigProperty = wigproperty;
        this.ornamentProperty  = ornamentproperty;
        this.shoeProperty      = shoeproperty;
        this.bodyToneColor     = new float[] { 0.5f, gameController.femaleModelImageObject.GetComponent <Image>().color.g, 0.5f, 1f };
        gameController.currentBackgroundProperty.CopyTo(ref backgroundProperty);


        //gameController.currentBackgroundProperty.CopyTo(ref backgroundProperty);
        isShowingMale = gameController.isShowingMale;

        if (gameController.isShowingMale)
        {
            maleData.maleIsShowing = true;
            //maleWigProperty.Clone(gameController.currentMaleWigProperty);
            //maleTieProperty.Clone(gameController.currentMaleTieProperty);



            maleData.EncodeData(gameController);
        }
        else
        {
            maleData.maleIsShowing = false;
        }
        if (dressProperty != null)
        {
            Debug.Log("dress property  initialized");
            dressData.EncodeData(dressProperty, gameController.currentDressColor);

            dressName = dressProperty.imgName;
        }
        if (femaleWigProperty != null)
        {
            femaleWigData.EncodeData(femaleWigProperty, gameController.currentWigColor);

            wigName = femaleWigProperty.imgName;
        }
        if (ornamentProperty != null)
        {
            ornamentData.EncodeData(ornamentProperty);

            ornamentName = ornamentProperty.imgName;
        }
        if (shoeProperty != null)
        {
            shoeData.EncodeData(shoeProperty, gameController.currentShoeColor);

            shoeName = shoeProperty.imgName;
        }
        backgroundData.EncodeData(backgroundProperty);
        Debug.Log("Initialize completed");
    }