Ejemplo n.º 1
0
        private void RenderItemsContainer()
        {
            List <int> equipedItems = new List <int>()
            {
                creature.Data.AttackItemIndex, creature.Data.DefendItemIndex
            };

            itemControlls = new List <ItemControl>();

            for (int index = 0; index < creature.Data.Items.Count; index++)
            {
                int  itemId    = this.creature.Data.Items[index];
                bool isEquiped = equipedItems.Contains(index);

                /*
                 * ItemControl itemControl = GameObjectExtension.CreateFromPrefab<ItemControl>("Prefabs/ItemControl");
                 * itemControl.Initialize(this.canvas, itemId, isEquiped);
                 * itemControl.transform.parent = anchorItems[index].transform;
                 * itemControl.transform.localPosition = new Vector3(0, 0, 0);
                 */

                int         cIndex      = index;
                ItemControl itemControl = GameObjectExtension.CreateFromPrefab <ItemControl>("Prefabs/ItemControl");
                itemControl.Initialize(this.canvas, itemId, isEquiped, () => { this.OnSelectedItem(cIndex); });
                itemControl.transform.parent        = anchorItems[index].transform;
                itemControl.transform.localPosition = new Vector3(0, 0, 0);
                itemControl.transform.localScale    = new Vector3(1, 1, 1);

                itemControlls.Add(itemControl);
            }
        }
Ejemplo n.º 2
0
        public void Initialize(Camera camera, FDCreature creature, ShowType showType, Action <int> callback)
        {
            this.gameObject.name = "CreatureDialog";

            canvas.worldCamera = camera;
            this.camera        = camera;

            this.creature   = creature;
            this.showType   = showType;
            this.onCallback = callback;

            containerBase = this.transform.Find("Canvas/ContainerBase");
            Clickable clickable = containerBase.GetComponent <Clickable>();

            clickable.Initialize(() => { this.OnClicked(); });

            creatureDetailBase = this.transform.Find("Canvas/CreatureDetail");
            clickable          = creatureDetailBase.gameObject.GetComponent <Clickable>();
            clickable.Initialize(() => { this.OnCancelled(); });
            datoBase    = this.transform.Find("Canvas/DatoBase");
            datoControl = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl");
            datoControl.Initialize(datoBase, creature.Definition.AnimationId, new Vector2(0, 0));
            //// datoControl.transform.localPosition = new Vector3(0, 0, 0);

            RenderDetails();

            if (IsItemDialog)
            {
                RenderItemsContainer();
            }
            else
            {
                RenderMagicsContainer();
            }
        }
Ejemplo n.º 3
0
        public void ShowConversationDialog(FDCreature creature, ConversationId conversation)
        {
            // Canvas
            if (currentDialog != null)
            {
                Destroy(currentDialog);
                currentDialog = null;
            }

            // Move the map to corresponding location

            // Show dialog
            int animationId = creature?.Definition?.AnimationId ?? 0;

            string message = LocalizedStrings.GetConversationString(conversation);
            //Debug.Log("Showing message dialog: " + message);
            Vector3 popupPosition = Vector3.zero;

            if (creature != null)
            {
                UICreature uiCreature = GetUICreature(creature.CreatureId);
                Vector3    viewPoint  = mainCamera.WorldToViewportPoint(uiCreature.transform.position);

                RectTransform canvasRect = GameCanvas.GetComponent <RectTransform>();

                popupPosition = new Vector3(
                    viewPoint.x * canvasRect.sizeDelta.x - canvasRect.sizeDelta.x * 0.5f,
                    viewPoint.y * canvasRect.sizeDelta.y - canvasRect.sizeDelta.y * 0.5f,
                    0);
            }
            MessageDialog messageDialog = GameObjectExtension.CreateFromPrefab <MessageDialog>("Prefabs/MessageDialog");

            messageDialog.Initialize(uiCamera, popupPosition, animationId, message, (index) => { this.OnDialogCallback(index); }, this.ChapterId);
            currentDialog = messageDialog.gameObject;
        }
Ejemplo n.º 4
0
 protected override void Awake()
 {
     if (this.cachedBasicSprite == null)
     {
         this.cachedBasicSprite = GameObjectExtension.GetComponentEvenIfDeactive <UIBasicSprite>(base.gameObject);
     }
 }
Ejemplo n.º 5
0
    /// <summary>
    /// @brief 継承先で個別に実装する初期化
    /// </summary>
    protected virtual void MarkerInitialize()
    {
        markerList = new List <GameObject>();

        lineMarkerList = new List <GameObject>();

        hitMarkerList = new List <GameObject>();

        // 親オブジェクトを取得し
        markerObjName = GameObject.Find("MarkerObj");

        // 取得した親オブジェクトの子も取得する(Marker)
        markerList = GameObjectExtension.GetGameObject(markerObjName, "Marker");

        //取得した親オブジェクトの子も取得する(AINormal) (PlayerのLineように使います)
        lineMarkerList = GameObjectExtension.GetGameObject(markerObjName, "AINormal");

        // 取得した親オブジェクトの子も取得する(GameObject)
        hitMarkerList = GameObjectExtension.GetGameObject(markerObjName);

        // 取得したブイの当り判定の棒を透明にする
        GameObjectExtension.HideGameObject(markerObjName);

        isGoal = false;
    }
Ejemplo n.º 6
0
 private void GetCurrentBullets(string bulletName, int hits)
 {
     if (hits == -1)
     {
         Hits = 0;
         while (true)
         {
             GameObject child = GameObjectExtension.GetChild(partGameObject, string.Format("{0}{1:000}", bulletName, Hits + 1));
             if (child == null)
             {
                 break;
             }
             Hits++;
         }
     }
     else
     {
         Hits = hits;
         int num = Hits + 1;
         while (true)
         {
             GameObject child2 = GameObjectExtension.GetChild(partGameObject, string.Format("{0}{1:000}", bulletName, num));
             if (child2 == null)
             {
                 break;
             }
             GameObject.Destroy(child2);
             num++;
         }
     }
 }
Ejemplo n.º 7
0
        public PartCamera(Part thisPart, string resourceScanning, string bName, int hits, string rotZ, string rotY, string _zoommer, float _stepper, string cameraName, int _allowedScanDistance, int windowSize, bool isOnboard, bool isLookAtMe, bool isLookAtMeAutoZoom, bool isFollowMe, bool isTargetCam, float isFollowMeOffsetX, float isFollowMeOffsetY, float isFollowMeOffsetZ, float targetOffset, string windowLabel = "Camera") : base(thisPart, (float)windowSize, windowLabel)
        {
            List <string> list = resourceScanning.Split(new char[]
            {
                '.'
            }).ToList <string>();

            resourceName        = list[0];
            resourceUsage       = int.Parse(list[1]);
            bulletName          = bName;
            rotatorZ            = GameObjectExtension.GetChild(partGameObject.gameObject, rotZ);
            rotatorY            = GameObjectExtension.GetChild(partGameObject.gameObject, rotY);
            zoommer             = GameObjectExtension.GetChild(partGameObject.gameObject, _zoommer);
            camObject           = GameObjectExtension.GetChild(partGameObject.gameObject, cameraName);
            stepper             = _stepper;
            allowedScanDistance = _allowedScanDistance;
            lastZoom            = CurrentZoom;
            IsOnboard           = isOnboard;
            IsLookAtMe          = isLookAtMe;
            IsFollowMe          = isFollowMe;
            IsLookAtMeAutoZoom  = isLookAtMeAutoZoom;
            IsTargetCam         = isTargetCam;
            IsFollowMeOffsetX   = isFollowMeOffsetX;
            IsFollowMeOffsetY   = isFollowMeOffsetY;
            IsFollowMeOffsetZ   = isFollowMeOffsetZ;
            TargetOffset        = targetOffset;
            GameEvents.onGameSceneLoadRequested.Add(new EventData <GameScenes> .OnEvent(LevelWasLoaded));
            GetCurrentBullets(bName, hits);
        }
Ejemplo n.º 8
0
        void Awake()
        {
            _ins         = this;
            MessageQueue = new Queue <Tuple <string, int> >();

            //pToast = GameObjectExtension.InstantiateFromPacket("ui_toast", "Toast", root.gameObject);

            //var iToast = Instantiate(pToast, root) as GameObject;
            var iToast = GameObjectExtension.InstantiateFromPacket("ui_toast", "Toast", root.gameObject);

            iToast.transform.localPosition = position;
            iToast.transform.localScale    = Vector3.one;
            wToast       = iToast.GetComponent <UIWidget>();
            wToast.color = new Color(wToast.color.r, wToast.color.g, wToast.color.b, 0);

            Queue_sq = DOTween.Sequence();
            Queue_sq.SetAutoKill(false).SetRecyclable(true);
            Queue_splashTweener = DOTween.ToAlpha(() => wToast.color, color => wToast.color = color, 1, 0.35f);
            Queue_fadeTweener   = DOTween.ToAlpha(() => wToast.color, color => wToast.color = color, 0, 0.35f);
            Queue_splashTweener.SetRecyclable(true);
            Queue_fadeTweener.SetRecyclable(true);

            Queue_sq.Append(Queue_splashTweener);
            Queue_sq.AppendInterval(Queue_TimeInterval);
            Queue_sq.Append(Queue_fadeTweener);
            Queue_sq.AppendCallback(checkQueue);
            Queue_sq.TogglePause();
        }
Ejemplo n.º 9
0
    static int FindChild(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Transform), typeof(string)))
            {
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1);
                string arg1             = ToLua.ToString(L, 2);
                UnityEngine.Transform o = GameObjectExtension.FindChild(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Transform), typeof(string[])))
            {
                UnityEngine.Transform arg0 = (UnityEngine.Transform)ToLua.ToObject(L, 1);
                string[] arg1           = ToLua.CheckStringArray(L, 2);
                UnityEngine.Transform o = GameObjectExtension.FindChild(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: GameObjectExtension.FindChild"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Ejemplo n.º 10
0
        /// <summary>
        /// Fix for the blue ghost lines showing invalid outlines when cloning or symmetry-placing fairing bases in the editor.
        /// Find any already assigned (copied) LineRenderers and delete them.
        /// </summary>

        void DestroyAllLineRenderers()
        {
            LineRenderer [] lr = FindObjectsOfType <LineRenderer>();

            if (lr != null)
            {
                for (int i = 0; i < lr.Length; i++)
                {
                    Transform _transform = lr[i].transform;

                    if (_transform != null)
                    {
                        Transform _parent = _transform.parent;

                        if (_parent != null)
                        {
                            GameObject _gameObject = _parent.gameObject;

                            if (_gameObject)
                            {
                                if ((_gameObject.Equals(this) ? true : _gameObject.Equals(gameObject)))
                                {
                                    GameObjectExtension.DestroyGameObject(lr [i].gameObject);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void Initialize(Camera camera, int animationId, string message, Action <int> callback)
        {
            this.gameObject.name = "PromptDialog";

            canvas.worldCamera   = camera;
            this.onClickCallback = callback;


            GameObject messageBoxBase = this.transform.Find("Canvas/MessageBase").gameObject;

            messageBoxBase.transform.localPosition = new Vector2(0, -150);
            Clickable clickable = messageBoxBase.AddComponent <Clickable>();

            clickable.Initialize(() => { this.OnClicked(); });

            localizedMessage = message;

            localizedMessage = localizedMessage.Replace("#", "\r\n");
            datoControl      = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl");
            datoControl.Initialize(messageBoxBase.transform, animationId, new Vector2(-230, -150), true);

            textObj = FontAssets.ComposeTextMeshObject(localizedMessage);


            Transform textAnchor = this.transform.Find("Canvas/TextAnchor");

            textObj.transform.parent        = textAnchor;
            textObj.transform.localPosition = new Vector3(0, 0, 0);
            textObj.transform.localScale    = new Vector3(5, 5, 1);
            textObj.gameObject.layer        = 5;
            // textObj.fontSize = 20;

            displayLength = 4;
            textObj.text  = localizedMessage.Substring(0, 4);
        }
Ejemplo n.º 12
0
    private eAISequence AISequence; // @brief 現在のジグザグのシーケンス

    #endregion

    #region 初期化

    /// <summary>
    /// @brief MarkerBaseの実装
    /// </summary>
    protected override void MarkerInitialize()
    {
        base.MarkerInitialize();

        // リストの初期化
        markerPos    = new List <Vector2>();
        AIMarkerList = new List <GameObject>();
        AIMarkerList = GameObjectExtension.GetGameObject(markerObjName, DecideAIStrength());

        // コンポーネントの取得
        me           = this.gameObject;
        mySail       = me.transform.Find("Sail").gameObject;
        myHuman      = me.transform.Find("Human").gameObject;
        getWindParam = GameObjectExtension.Find("UIWind").GetComponent <GetWindParam>();

        // 変数の初期化
        myRadius         = transform.localEulerAngles.y;
        currentMarker    = 0;
        currentHitMarker = 1;

        AIStatus   = eAIStatus.NULL;
        AISequence = eAISequence.NULL;

        GetMarkerVec2();
        currentDistance = Distance(myPos, markerPos[currentHitMarker]);

        NextPointDeg();
        SailRotate(getWindParam.ValueWind, me.transform.localEulerAngles.y);
    }
Ejemplo n.º 13
0
    public GameObject FindWidget(string objName)
    {
        string[] name_path = objName.Split('/');

        Transform tf = GameObjectExtension.FindChild(m_wndObj.transform, name_path);

        return((tf == null) ? null : tf.gameObject);
    }
Ejemplo n.º 14
0
    public IEnumerator Init()
    {
        //初始化romcfg
        GameObject wndConfig = GameObjectExtension.InstantiateFromPacket("rom_share", "WndConfig", null);

        GameObject.DontDestroyOnLoad(wndConfig);

        yield break;
    }
Ejemplo n.º 15
0
    private GameObject markerSign; // @brief 今目指すべきマーカーを示す矢印

    protected override void MarkerInitialize()
    {
        base.MarkerInitialize();
        markerSign = GameObjectExtension.Find("yajirusi");
        MoveMakerPoint();
        currentMarker = 0;

        Singleton <GameInstance> .Instance.IsGoal = false;
    }
Ejemplo n.º 16
0
    //弹出一个消息
    public void PopMsg(string msg, Color color)
    {
        float minY = m_StartY + (float)m_PopingObjs.Count * m_ItemHeight;

        if (IsSameItem(msg))
        {
            return;
        }

        //将一些过矮的元素提升
        foreach (TipItem curr in m_PopingObjs)
        {
            GameObject obj = curr.obj;
            if (obj.transform.localPosition.y < minY)
            {
                Vector3 pos = obj.transform.localPosition;
                pos.y = minY;
                obj.transform.localPosition = pos;
            }

            minY -= m_ItemHeight;
        }

        //创建item对象
        GameObject item = GameObjectExtension.InstantiateFromPreobj(m_ItemMB, m_ItemMB.transform.parent.gameObject);

        item.SetActive(true);
        NGUITools.MarkParentAsChanged(item);

        TipItem newItem = new TipItem()
        {
            lostTime = 0, obj = item
        };

        m_PopingObjs.Add(newItem);

        //设置标签
        string[] findpath = new string[1];
        findpath[0] = "Label";

        GameObject lableObj = GameObjectExtension.FindChild(item.transform, findpath).gameObject;
        UILabel    cmlabel  = lableObj.GetComponent <UILabel>();

        cmlabel.text  = msg;
        cmlabel.color = color;

        //解除位置绑定关系
        UIRect cm_rect = item.GetComponent <UIRect>();

        cm_rect.SetAnchor((GameObject)null);

        if (!m_CoroutineIsDoing)
        {
            CoroutineManage.Single.StartCoroutine(coUpdate());
        }
    }
Ejemplo n.º 17
0
            public CRealAuthenticate(GameObject obj)
            {
                mUIObject = obj;

                mReturn   = GameObjectExtension.FindChild(obj.transform, "back_btn").gameObject;
                mCardTab  = new CCardTab(GameObjectExtension.FindChild(obj.transform, "idcard_page").gameObject);
                mPhoneTab = new CPhoneTab(GameObjectExtension.FindChild(obj.transform, "mobileregister_page").gameObject);

                UIEventListener.Get(mReturn).onClick += OnBack;
            }
Ejemplo n.º 18
0
        void Start()
        {
            gameObject.Show()
            .Layer(0)                     // 0 is default
            .Name("Example");

            gameObject.DestroySelf();

            GameObjectExtension.DestroySelf(gameObject);
        }
Ejemplo n.º 19
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        GameObject go = GameObjectExtension.Create(TalentDescGO, TalentFrameGO);

        desc = go;
        go.transform.Find("desc").GetComponent <TextMeshProUGUI>().text = info.Desc;
        Rect rect = this.GetComponent <RectTransform>().rect;

        go.transform.localPosition = new Vector3(transform.localPosition.x + rect.width / 2 + 10, transform.localPosition.y + rect.height / 2);
    }
Ejemplo n.º 20
0
    /////////////////结束/////////////////
    public void GetUIPrefab(string assetName, GameObject parent, LuaTable luaTable, LuaFunction luaCallBack)
    {
        if (mResManager == null)
        {
            return;
        }

        GameObject go = GameObjectExtension.InstantiateFromPacket(assetName, assetName + ".prefab", parent);

        go.name  = assetName;
        go.layer = LayerMask.NameToLayer("UI");
        go.transform.SetParent(parent.transform, false);

        LuaBehaviour tmpBehaviour = go.AddComponent <LuaBehaviour>();

        tmpBehaviour.Init(luaTable);

        if (luaCallBack != null)
        {
            luaCallBack.BeginPCall();
            luaCallBack.Push(go);
            luaCallBack.PCall();
            luaCallBack.EndPCall();
        }
        //Debug.Log("CreatePanel::>> " + assetName + " " + prefab);
        //mUIList.Add(go);


        //mResManager.LoadPrefab("pack_res/ui_login", "ui_login", delegate(UnityEngine.Object[] objs)
        //    {
        //        if (objs.Length == 0) return;
        //        GameObject prefab = objs[0] as GameObject;
        //        if (prefab == null)
        //        {
        //            return;
        //        }
        //        GameObject go = UnityEngine.GameObject.Instantiate(prefab) as GameObject;
        //        go.name = assetName;
        //        go.layer = LayerMask.NameToLayer("UI");
        //go.transform.SetParent(parent, false);

        //        LuaBehaviour tmpBehaviour = go.AddComponent<LuaBehaviour>();
        //        tmpBehaviour.Init(luaTable);

        //        if (luaCallBack != null)
        //        {
        //            luaCallBack.BeginPCall();
        //            luaCallBack.Push(go);
        //            luaCallBack.PCall();
        //            luaCallBack.EndPCall();
        //        }
        //        Debug.Log("CreatePanel::>> " + assetName + " " + prefab);
        //        //mUIList.Add(go);
        //    });
    }
Ejemplo n.º 21
0
    private GameObject CreateAndRotateItemMesh(GameObject mesh, string prefabName, string title, Rect displayRect, float rotateSpeed)
    {
        mesh.RotateItemMeshInGUI(rotateSpeed, title, displayRect);

        if (null == meshToDisplay)
        {
            mesh = GameObjectExtension.CreateItemMesh(prefabName, displayRect);
        }

        return(mesh);
    }
Ejemplo n.º 22
0
 protected override void Awake()
 {
     if (this.cachedAtlasSkinner == null)
     {
         this.cachedAtlasSkinner = GameObjectExtension.GetComponentEvenIfDeactive <UIAtlasSkinner>(base.gameObject);
     }
     if (this.cachedAtlas == null)
     {
         this.cachedAtlas = GameObjectExtension.GetComponentEvenIfDeactive <UISprite>(base.gameObject);
     }
 }
Ejemplo n.º 23
0
    public IEnumerator Init()
    {
        MonoEX.Debug.LogoutHandle = MonoEXLogout;//设定日志输出回调

        //初始化数据表管理器
        new TabReaderManage(new U3dTabFactory());

        //挂载协程管理组件
        CoroutineManage.AutoInstance();
        yield return(null);//等待携程管理器初始化完成

        //资源引用管理器
        //new ResourceRefManage();

        //挂载TimeLine组件
        UROMSystem.Single.AddComponent <UTimeLine>();


        //挂载场景管理组件
        //UROMSystem.Single.AddComponent<SceneManage>();


        //挂载UI景深渲染组件

        /*
         * GameObject UIForegroundCameraObj = GameObject.Find("/UIRoot/UICameras/Camera_UIForeground");
         * UIForegroundScreenTexture cmUIForegroundScreenTexture = UIForegroundCameraObj.AddComponent<UIForegroundScreenTexture>();
         * cmUIForegroundScreenTexture.m_camera = UIForegroundCameraObj.GetComponent<Camera>();
         * cmUIForegroundScreenTexture.m_targetUITexture =  GameObject.Find("/UIRoot/UIForegroundLayer/UIForegroundTexture");
         */

        //装载rom资源
        {
            List <string> packs = new List <string>();
            packs.Add("packets");
            packs.Add("rom_upd");   //更新界面所需要资源
            packs.Add("rom_share"); //更新界面和逻辑公共资源
            PacketLoader loader = new PacketLoader();
            loader.Start(PackType.Res, packs, null);

            //等待资源装载完成
            while (loader.Result == PacketLoader.ResultEnum.Loading)
            {
                yield return(null);
            }
        }


        //初始化romcfg
        GameObject gameConfig = GameObjectExtension.InstantiateFromPacket("rom_share", "GameConfig", null);

        GameObject.DontDestroyOnLoad(gameConfig);
        yield return(null);
    }
Ejemplo n.º 24
0
    ///// <summary>
    ///// 当绘制单位时设置shader
    ///// TODO 解决加载单位没有shader问题
    ///// </summary>
    //private void OnWillRenderObject()
    //{
    //    if (!isSetShader)
    //    {
    //        isSetShader = true;
    //        var rander = GetComponent<Renderer>();
    //        if (rander != null)
    //        {
    //            var core = PacketManage.Single.GetPacket("core");
    //            if (core != null)
    //            {
    //                var shader = core.Load("Avatar_N.shader") as Shader;
    //                if (shader != null)
    //                {
    //                    rander.material.shader = shader;
    //                }
    //            }

    //        }
    //    }
    //}

    /// <summary>
    /// 加载
    /// </summary>
    private void LoadSource()
    {
        NowWorldCamera = GameObject.Find("/PTZCamera/SceneryCamera").GetComponent <Camera>();
        Head           = transform.Find("head").gameObject.transform;
        GameObject parent = GameObject.Find("ui_fightU/bloodParent");

        bloodBar = GameObjectExtension.InstantiateFromPacket("ui_fightu", "blood.prefab", parent).transform;
        bloodBar.localPosition = Vector3.zero;
        bloodBar.localScale    = Vector3.one;
        bloodBarCom            = bloodBar.gameObject.AddComponent <BloodBar>();
        //ModelRander = gameObject.GetComponent<MFAModelRender>();
    }
Ejemplo n.º 25
0
            public CBindUI(GameObject obj)
            {
                mUIObject = obj;

                mAccount    = GameObjectExtension.FindChild(obj.transform, "id/txt").gameObject.GetComponent <UIInput>();
                mPassword   = GameObjectExtension.FindChild(obj.transform, "key/txt").gameObject.GetComponent <UIInput>();
                mRePassword = GameObjectExtension.FindChild(obj.transform, "key_define/txt").gameObject.GetComponent <UIInput>();
                mCloseBtn   = GameObjectExtension.FindChild(obj.transform, "close_btn").gameObject;
                mRegBtn     = GameObjectExtension.FindChild(obj.transform, "register_btn").gameObject;

                UIEventListener.Get(mCloseBtn).onClick += OnClose;
            }
Ejemplo n.º 26
0
            public CLoginEntry(GameObject obj)
            {
                mUIObject = obj;

                mQuickLogin   = GameObjectExtension.FindChild(obj.transform, "quicklogin_btn").gameObject;
                mAccountLogin = GameObjectExtension.FindChild(obj.transform, "idlogin_btn").gameObject;
                mRegAccount   = GameObjectExtension.FindChild(obj.transform, "idregister_btn").gameObject;

                UIEventListener.Get(mQuickLogin).onClick   = OnQuickLogin;
                UIEventListener.Get(mRegAccount).onClick   = OnRegAccount;
                UIEventListener.Get(mAccountLogin).onClick = OnAccountLogin;
            }
Ejemplo n.º 27
0
        internal void SetupRenderPipelinePreviewLight(Light light)
        {
            HDLightTypeAndShape hdLightTypeAndShape = (light.type == LightType.Point) ? HDLightTypeAndShape.Point : HDLightTypeAndShape.ConeSpot;

            HDAdditionalLightData hdLight = GameObjectExtension.AddHDLight(light.gameObject, hdLightTypeAndShape);

            hdLight.SetIntensity(20000f, LightUnit.Lumen);

            hdLight.affectDiffuse     = true;
            hdLight.affectSpecular    = false;
            hdLight.affectsVolumetric = false;
        }
Ejemplo n.º 28
0
        public void popToast(string messageToShow, TweenCallback callback)
        {
            /**
             * 遍历数组中的旧消息,并使它们都做向上移动的动画
             **/
            int i = tail;

            while (i != head)
            {
                if (circleTable[i].Item1.IsPlaying())
                {
                    var moveY         = circleTable[i].Item2.GetComponent <UIWidget>().height;
                    var ToastPosition = circleTable[i].Item2.transform.position;
                    circleTable[i].Item1.Join(circleTable[i].Item2.transform.DOBlendableLocalMoveBy(
                                                  new Vector3(0, moveY, 0), 0.2f, true));
                }
                i = (i + 1 + LIMIT) % LIMIT;
            }

            //var iToast = Instantiate(pToast, root) as GameObject;
            GameObject iToast = GameObjectExtension.InstantiateFromPacket("ui_toast", "Toast", root.gameObject);

            iToast.name = head.ToString();
            iToast.transform.localPosition = position;
            iToast.transform.localScale    = Vector3.one;
            iToast.GetComponentInChildren <UILabel>().text = messageToShow;
            iToast.GetComponentInChildren <UILabel>().AssumeNaturalSize();
            iToast.GetComponentInChildren <UISprite>().width = iToast.GetComponentInChildren <UILabel>().width + 80;
            var iWidget = iToast.GetComponent <UIWidget>();

            iWidget.alpha = 0;

            var sq = DOTween.Sequence();
            var Upwards_splashTweener = DOTween.ToAlpha(() => iWidget.color, color => iWidget.color = color, 1, 0.5f);
            var Upwards_fadeTweener   = DOTween.ToAlpha(() => iWidget.color, color => iWidget.color = color, 0, 0.35f);

            sq.Append(Upwards_splashTweener);
            sq.AppendInterval(Upwards_TimeInterval);
            sq.Append(Upwards_fadeTweener);
            //动画完成时,使队尾索引向后移动
            callback += () => { tail = (tail + 1 + LIMIT) % LIMIT; Destroy(iToast); };
            sq.AppendCallback(callback);

            //队头索引向后移动
            circleTable[(head + LIMIT) % LIMIT] = Tuple.Create(sq, iToast);
            head = (head + 1 + LIMIT) % LIMIT;
            //当队头索引将要覆盖队尾时,让队尾元素提前完成逻辑并向前移动
            if ((head + LIMIT) % LIMIT == tail)
            {
                circleTable[tail].Item1.Complete(true);
            }
        }
Ejemplo n.º 29
0
 private T GetUICloseToScreenPosition <T>(Camera camera, Vector3 screenPosition, float proximityDistance) where T : Component
 {
     // TODO : very ugly, this of course is only temporary
     T[] list = GameObjectExtension.FindObjectsOfTypeAndLayer <T>(LayerMask.NameToLayer("UI"));
     foreach (var o in list)
     {
         if (camera.GetWorldPosCloseToScreenPos(o.transform.position, screenPosition, proximityDistance))
         {
             return(o);
         }
     }
     return(null);
 }
Ejemplo n.º 30
0
        public void Initialize(Camera camera, Vector2 popupPosition, int animationId, string message, Action <int> callback, int forChapterId = 0)
        {
            this.gameObject.name = "MessageDialog";

            canvas.worldCamera   = camera;
            this.onClickCallback = callback;

            if (animationId > 500)
            {
                dialogPosition = MessageDialogPosition.UP;
            }

            messageBoxBase = this.transform.Find("Canvas/MessageBase").gameObject;
            messageBoxBase.transform.localPosition = GetBasePosition(dialogPosition);
            Clickable clickable = messageBoxBase.GetComponent <Clickable>();

            clickable.Initialize(() => { this.OnClicked(); });

            PopUp popUp = messageBoxBase.GetComponent <PopUp>();

            popUp.Initialize(popupPosition);

            localizedMessage = message;

            localizedMessage = localizedMessage.Replace("#", "\r\n");
            datoControl      = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl");
            datoControl.Initialize(messageBoxBase.transform, animationId, GetDatoPosition(dialogPosition), (dialogPosition == MessageDialogPosition.DOWN));

            if (forChapterId > 0)
            {
                textObj = FontAssets.ComposeTextMeshObjectForChapter(forChapterId, localizedMessage);
            }
            else
            {
                textObj = FontAssets.ComposeTextMeshObject(localizedMessage);
            }

            Transform textAnchor = this.transform.Find("Canvas/MessageBase/TextAnchor");

            textAnchor.localPosition = GetTextPosition(dialogPosition);

            textObj.transform.parent = textAnchor;
            //textObj.transform.localPosition = new Vector2(190, -50);
            textObj.transform.localPosition = new Vector3(0, 0, 0);
            textObj.transform.localScale    = new Vector3(5, 5, 1);
            textObj.gameObject.layer        = 5;
            // textObj.fontSize = 20;

            displayLength = 1;
            textObj.text  = localizedMessage.Substring(0, 1);
        }
Ejemplo n.º 31
0
        private GameObjectExtension TryGetExtension(IntPtr handle)
        {
            if (handle == IntPtr.Zero)
                return null;

            var extension = this.Extensions.FirstOrDefault(x => x.Handle == handle);
            if (extension == null)
            {
                extension = new GameObjectExtension
                {
                    Handle = handle,
                    Owner = this
                };

                this.Extensions.Add(extension);
            }

            return extension;
        }