Пример #1
0
    void XhTakeCard()
    {
        bool pass1 = true;
        bool pass2 = true;

        XH.timePointEvent = (a) =>
        {
            if (a >= 18 && a <= 20 && pass1)
            {
                pass1 = false;
                XHCtrl   ctrl      = XH.GetComponent <XHCtrl>();
                string   name      = SwapModel.GetInstance().CurReinforcement.pData.name;
                Material matSource = SwapModel.GetInstance().GetTuKa("tuka_" + name).GetComponent <MeshRenderer>().materials[1];
                Material matTar    = ctrl.r_tuka2.transform.Find("tuka2 1").GetComponent <MeshRenderer>().materials[1];
                matTar.CopyPropertiesFromMaterial(matSource);
                xhTk.gameObject.SetActive(false);
                ctrl.r_tuka2.gameObject.SetActive(true);
            }
            if (a >= 50 && a <= 52 && pass2)
            {
                pass2             = false;
                XH.timePointEvent = null;
                XH.OnPause();
                XhTakeCardCallback();
            }
        };
        XH.PlayForward("TY_XH_NKDK");
    }
Пример #2
0
    /// <summary>
    /// 选择强化物界面ok按钮回调用
    /// </summary>
    void SelectUIOkBtnCallback(int selectObj)
    {
        //设置当前选择的强化物
        PropsData pData = SwapModel.GetInstance().GetObj(selectObj).GetComponent <PropsObject>().pData;

        SwapModel.GetInstance().CurReinforcement = new Reinforcement(pData);
        ResetAll();
    }
Пример #3
0
    void ShowSpeakContent()
    {
        CancelInvoke("ClickmicroPhoneTip");
        Dialog dlog = UIManager.Instance.GetUI <Dialog>("Dialog");

        UIManager.Instance.SetUIDepthTop("Dialog");
        string curObjName = SwapModel.GetInstance().CurReinforcement.pData.name_cn;

        dlog.SetDialogMessage("小华要" + curObjName + "呀");
        CancelInvoke("LsGiveInit");
        Invoke("LsGiveInit", 2);
    }
Пример #4
0
    /// <summary>
    /// 辅导老师抓手拿卡回调
    /// </summary>
    void FdlsDragHandTakeCardCallback()
    {
        //FDLS.PlayForward("idle");
        XHCtrl   ctrl      = XH.GetComponent <XHCtrl>();
        string   name      = SwapModel.GetInstance().CurReinforcement.pData.name;
        Material matSource = SwapModel.GetInstance().GetTuKa("tuka_" + name).GetComponent <MeshRenderer>().materials[1];
        Material matTar    = ctrl.r_tuka2.transform.Find("tuka2 1").GetComponent <MeshRenderer>().materials[1];

        matTar.CopyPropertiesFromMaterial(matSource);
        ctrl.r_tuka2.gameObject.SetActive(true);
        //Invoke("HideDeskTK", 1f);
        ClickFdlsDikaHandTip();
    }
Пример #5
0
    void CloseSelectUICallback()
    {
        //Debug.Log("close");
        Reinforcement rfc = SwapModel.GetInstance().CurReinforcement;

        if (rfc == null)
        {
            swapUI.SetButtonVisiable(SwapUI.BtnName.chooseButton, true);
            UIFlah uf = swapUI.GetChooseBtn.gameObject.GetUIFlash();
            uf.StartFlash();
        }
        //ReDo();
    }
Пример #6
0
 private void StartPro()
 {
     com.SetComUITitle("第一阶段 以物换物");
     SwapModel.GetInstance().hpUI.gameObject.SetActive(false);
     spACtrl = ResManager.GetPrefab("Prefabs/Swap/SwapA").GetComponent <SwapCtrlA>();
     spACtrl.transform.SetParent(transform);
     spACtrl.evtFinished += OnSpACtrlFinished;
     spACtrl.evtRedo     += OnSpACtrlRedo;
     //Debug.Log("fsfds");
     //spBCtrl = ResManager.GetPrefab("Prefabs/Swap/SwapB").GetComponent<SwapCtrlB>();
     //spBCtrl.transform.SetParent(transform);
     //spBCtrl.evtFinished += OnSpBCtrlFinished;
     //spBCtrl.evtRedo += OnSpBCtrlRedo;
     //spCCtrl = ResManager.GetPrefab("Prefabs/Swap/SwapC").GetComponent<SwapCtrlC>();
     //spCCtrl.transform.SetParent(transform);
     //spCCtrl.evtFinished += OnSpCCtrlFinished;
     //spCCtrl.evtRedo += OnSpCCtrlRedo;
 }
Пример #7
0
    /// <summary>
    /// 初始化桌子上的涂卡
    /// </summary>
    void GetTukaObject()
    {
        Reinforcement rfc = SwapModel.GetInstance().CurReinforcement;

        //rfc = new Reinforcement(new PropsData("chips", 2, PropsType.reinforcement, "薯片"));//测试代码
        if (rfc != null)
        {
            Debug.Log("GetTukaObject");

            int objId = rfc.pData.id;
            qhw = ObjectsManager.instanse.GetQHW();
            qhw.transform.SetParent(transform);
            string qhwName = ((PropsTag)objId).ToString();
            qhw.name = qhwName;
            QHWCtrl qhwCtrl = qhw.GetComponent <QHWCtrl>();
            qhwCtrl.ShowObj(qhwName);

            string     _tuka     = "tuka_" + ((PropsTag)objId).ToString();
            Material   matSource = SwapModel.GetInstance().GetTuKa(_tuka).GetComponent <MeshRenderer>().materials[1]; //图卡材质
            GameObject deskTuka  = ObjectsManager.instanse.GetdeskTuka();                                             //桌面图卡
            deskTuka.transform.SetParent(transform);
            deskTuka.name = _tuka;

            TukaCtrl tukaCtrl = deskTuka.GetComponent <TukaCtrl>();
            xhTk = tukaCtrl.ShowObj("XH_ZS_TUKA");
            Material matTar = xhTk.GetComponent <MeshRenderer>().materials[1];
            matTar.CopyPropertiesFromMaterial(matSource);

            lsTk   = tukaCtrl.GetObj("LS_JZS_TUKA");
            matTar = lsTk.GetComponent <MeshRenderer>().materials[1];
            matTar.CopyPropertiesFromMaterial(matSource);

            Invoke("XhTakeCard", 1);
        }
        else
        {
            Tip();
        }
    }
Пример #8
0
    void Introduct()
    {
        com = UIManager.Instance.GetUI <CommonUI>("CommonUI");
        //com.SetComUITitle("第一阶段 以物换物");
        com.SetComUITitle("首页");
        //Canvas canvas = UIManager.Instance.GetComponent<Canvas>();
        //com.transform.SetParent(canvas.transform);

        if (SwapModel.GetInstance().hpUI == null)
        {
            HomePageUI homePageUI        = UIManager.Instance.GetUI <HomePageUI>("HomePageUI");
            SwapModel.GetInstance().hpUI = homePageUI;
            homePageUI.transform.SetParent(UIManager.Instance.transform, false);
            Button startButton = homePageUI.transform.Find("Button").GetComponent <Button>();//开始按钮
            startButton.onClick.AddListener(StartPro);
            startButton.gameObject.GetUIFlash().StartFlash();

            SwapModel.GetInstance().CurReinforcement = null;
        }
        else
        {
            StartPro();
        }
    }
Пример #9
0
    void LsJieka()
    {
        CancelInvoke("ClickLsHandTip");
        HighLightCtrl.GetInstance().FlashOff(jshand);
        ClickDispatcher.Inst.EnableClick = false;

        LS.Complete += LsGiveObjCallback;

        bool pause = true;
        bool pass1 = true;
        bool pass2 = true;
        bool pass3 = true;
        bool pass4 = true;
        bool pass5 = true;

        LS.timePointEvent = (a) =>
        {
            if (a >= 51 && a <= 53 && pass1)//老师接卡
            {
                pass1 = false;
                LSCtrl   ctrl      = LS.GetComponent <LSCtrl>();
                string   name      = SwapModel.GetInstance().CurReinforcement.pData.name;
                Material matSource = SwapModel.GetInstance().GetTuKa("tuka_" + name).GetComponent <MeshRenderer>().materials[1];
                Material matTar    = ctrl.ls_tuka2.transform.Find("LS_tuka2 1").GetComponent <MeshRenderer>().materials[1];
                matTar.CopyPropertiesFromMaterial(matSource);
                ctrl.ls_tuka2.gameObject.SetActive(true);

                XHCtrl xctrl = XH.GetComponent <XHCtrl>();
                xctrl.r_tuka2.gameObject.SetActive(false);
                XH.OnContinue();
            }

            if (a >= 81 && a <= 83 && pass2)//老师桌子放卡片
            {
                pass2 = false;
                LSCtrl ctrl = LS.GetComponent <LSCtrl>();//手上卡隐藏,桌子上的卡显示
                ctrl.ls_tuka2.gameObject.SetActive(false);

                lsTk.gameObject.SetActive(true);
            }

            if (a >= 94 && a <= 96 && pause)
            {
                pause = false;
                LS.OnPause();      //在某一帧停止时,下一次还会从该帧执行

                LsJiekaCallback(); //提示
            }

            if (a >= 122 && a <= 124 && pass3)//强化物挂到老师手上
            {
                pass3 = false;

                LSCtrl ctrl = LS.GetComponent <LSCtrl>();
                ctrl.SetJoint(qhw);
            }

            if (a >= 145 && a <= 147 && pass4)//小华接受物体时间点
            {
                //
                LS.timePointEvent = null;
                //Debug.LogError("xh");
                pass4 = false;

                LegacyAnimationOper go = ResManager.GetPrefab("Prefabs/AnimationKa/TY_XH_JG_KA").GetLegacyAnimationOper();
                go.transform.SetParent(transform);
                XH.timePointEvent = (b) =>//小华接过物品 挂载强化物
                {
                    if (b >= 42 && b <= 44 && pass5)
                    {
                        pass5 = false;
                        //XHCtrl xhCtrl = XH.GetComponent<XHCtrl>();
                        //xhCtrl.SetJoint(qhw);
                        XhQHW xhqhw = go.GetComponent <XhQHW>();
                        xhqhw.ShowObj(qhw.name);
                        qhw.gameObject.SetActive(false);
                        //Debug.LogError("xh");
                    }
                };
                XH.PlayForward("TY_XH_JG");
                go.PlayForward("TY_XH_JG_KA");
            }
        };
        LS.PlayForward("TY_LS_JKDW");//LS_tuka/LS_tuka 1  //tuka2
    }
Пример #10
0
        /// <summary>
        /// Finds and renames prefabs so that they are on different layers
        /// </summary>
        /// <param name="map">The reference to a <see cref="GridMap"/> type.</param>
        /// <param name="index">The index of the layer.</param>
        /// <param name="newIndex">The index of the other layer.</param>
        /// <param name="callback">A callback that will be called with the map, and game objects that will be affected by the swap.</param>
        /// <param name="completedCallback">A callback that will be called with the map, and game objects that were affected by the swap.</param>
        /// <remarks>The <see cref="callback"/> and <see cref="completedCallback"/> parameters will be called with the fallowing arguments (Map, LayerIndex, NewLayerIndex, LayerA, LayerB).</remarks>
        public static void SwapLayers(this GridMap map, int index, int newIndex, Action <SwapModel> callback, Action <SwapModel> completedCallback)
        {
            // find list of objects to delete
            var layerA = new List <GameObject>();
            var layerB = new List <GameObject>();

            for (var col = 0; col < map.Columns; col++)
            {
                for (var row = 0; row < map.Rows; row++)
                {
                    var obj = map.SearchForExistingPrefab(index, col, row);
                    if (obj != null)
                    {
                        layerA.Add(obj);
                    }

                    obj = map.SearchForExistingPrefab(newIndex, col, row);
                    if (obj != null)
                    {
                        layerB.Add(obj);
                    }
                }
            }

            var layerAObjects = layerA.ToArray();
            var layerBObjects = layerB.ToArray();
            var swapModel     = new SwapModel()
            {
                Map = map, LayerIndex = index, NewLayerIndex = newIndex, LayerAObjects = layerAObjects, LayerBObjects = layerBObjects
            };

            if (callback != null)
            {
                callback(swapModel);
            }

            // setup variables
            const string NameFormat = "{0}_l{1}_c{2}_r{3}";

            // setup processor callback
            var changeNames = new Action <List <GameObject>, int>(
                (stack, layerIndex) =>
            {
                foreach (var item in stack)
                {
                    string name;
                    int layer;
                    int column;
                    int row;
                    if (!item.name.TryParsePrefabName(out name, out layer, out column, out row))
                    {
                        continue;
                    }

                    // give the prefab a name that represents it's location within the grid map
                    item.name = string.Format(NameFormat, name, layerIndex, column, row);

                    // move prefab into proper layer position
                    var transform      = item.transform;
                    var position       = transform.localPosition;
                    position.y         = layerIndex * map.Depth;
                    transform.position = position;
                }
            });

            // change names
            changeNames(layerA, newIndex);
            changeNames(layerB, index);

            // change model indexes
            var model = map.Layers[index];

            map.Layers[index]    = map.Layers[newIndex];
            map.Layers[newIndex] = model;

            if (completedCallback != null)
            {
                completedCallback(swapModel);
            }
        }