Esempio n. 1
0
    private void Awake()
    {
        AndroidBackKeyManager.Instance.DisableBackKey();

        GetComponent <M4uContextRoot>().Context = this;

        GameObject rootObject = WindowRoot.gameObject;

        if (SceneObjReferMainMenu.HasInstance)
        {
            m_UnitNamePanel   = UnityUtil.SetupPrefab <UnitNamePanel>(SceneObjReferMainMenu.Instance.m_UnitNamePanel, MainCanvas);
            m_UnitParamPanel  = UnityUtil.SetupPrefab <UnitParamPanel>(SceneObjReferMainMenu.Instance.m_UnitParamPanel, rootObject);
            m_UnitStoryPanel  = UnityUtil.SetupPrefab <UnitStoryPanel>(SceneObjReferMainMenu.Instance.m_UnitStoryPanel, m_UnitParamPanel.gameObject);
            m_UnitSkillPanel  = UnityUtil.SetupPrefab <UnitSkillPanel>(SceneObjReferMainMenu.Instance.m_UnitSkillPanel, rootObject);
            m_UnitLinkPanel   = UnityUtil.SetupPrefab <UnitLinkPanel>(SceneObjReferMainMenu.Instance.m_UnitLinkPanel, rootObject);
            m_UnitEvolvePanel = UnityUtil.SetupPrefab <UnitEvolveList>(SceneObjReferMainMenu.Instance.m_UnitEvolveListPanel, rootObject);
            m_UnitDetailPanel = UnityUtil.SetupPrefab <UnitDetailPanel>(SceneObjReferMainMenu.Instance.m_UnitDetailPanel, rootObject);
        }
        else
        {
            m_UnitNamePanel   = UnityUtil.SetupPrefab <UnitNamePanel>("Prefab/UnitNamePanel/UnitNamePanel", MainCanvas);
            m_UnitParamPanel  = UnityUtil.SetupPrefab <UnitParamPanel>("Prefab/UnitParamPanel/UnitParamPanel", rootObject);
            m_UnitStoryPanel  = UnityUtil.SetupPrefab <UnitStoryPanel>("Prefab/UnitStoryPanel/UnitStoryPanel", m_UnitParamPanel.gameObject);
            m_UnitSkillPanel  = UnityUtil.SetupPrefab <UnitSkillPanel>("Prefab/UnitSkillPanel/UnitSkillPanel", rootObject);
            m_UnitLinkPanel   = UnityUtil.SetupPrefab <UnitLinkPanel>("Prefab/UnitLinkPanel/UnitLinkPanel", rootObject);
            m_UnitEvolvePanel = UnityUtil.SetupPrefab <UnitEvolveList>("Prefab/UnitEvolveList/UnitEvolveList", rootObject);
            m_UnitDetailPanel = UnityUtil.SetupPrefab <UnitDetailPanel>("Prefab/UnitDetailPanel/UnitDetailPanel", rootObject);
        }

        //
        LayoutElement element = m_UnitStoryPanel.gameObject.AddComponent <LayoutElement>();

        element.ignoreLayout = true;

        m_MainCanvas = MainCanvas.GetComponent <Canvas>();

        IsViewInfo = true;
        ToggleList = new List <UnitDetailToggleContext>();
        ToggleList.Add(new UnitDetailToggleContext(ToggleType.Status, new Vector2(-128, -8), "status", OnSelectToggle, 1));
        ToggleList.Add(new UnitDetailToggleContext(ToggleType.Skill, new Vector2(0, -17), "skill", OnSelectToggle, 10));
        ToggleList.Add(new UnitDetailToggleContext(ToggleType.Link, new Vector2(128, -8), "link", OnSelectToggle, 1));
        ToggleList.Add(new UnitDetailToggleContext(ToggleType.Evolve, new Vector2(256, 13), "evol", OnSelectToggle, -20));
        m_UnitDetailPanel.selectTogglr   = OnSelectToggle;
        m_UnitDetailPanel.selectSkill    = OnSelectMainUnitSkillButton;
        m_UnitDetailPanel.selectLoupe    = OnSelectCharaScreen;
        m_UnitDetailPanel.selectLink     = OnSelectLinkButton;
        m_UnitDetailPanel.selectFavorite = OnSelectFavorite;

        m_UnitDetailPanel.IsViewFavorite = false;
        FavoriteLabel   = "お気に入り";
        IllustratorName = "";

        ReturnImage = ResourceManager.Instance.Load("back2");

        if (SafeAreaControl.HasInstance)
        {
            Transform canvasTransform = gameObject.transform.Find("Canvas");
            Transform transform       = canvasTransform.Find("ReturnButton");
            SafeAreaControl.Instance.addLocalYPos(transform);
        }

        m_MainCanvas.enabled = false;
        //UnityUtil.SetObjectLayer( gameObject, LayerMask.NameToLayer("DRAW_CLIP"));

        AndroidBackKeyManager.Instance.StackPush(gameObject, OnSelectReturn);
    }