Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //Countdown for Dialog Pop up for idle mouse
        if (TenSecTimer && timeLeft > 0)
        {
            timeLeft -= Time.deltaTime;
        }
        if (TenSecTimer && timeLeft < 0)
        {
            // Create a Talisman Tip and call it here
            TipsDialog.PrintDialog("TalismanTip");
            TenSecTimer = false;
        }

        //按G生成技能物品
        if ((Input.GetKeyDown(KeyCode.G) || PickButton == 1) && display.activeSelf)
        {
            if (MakeItem())
            {
                dispManager.ToggleIcons(true, "talisman");
            }
            PickButton = 0;
        }
        //按删除键重置符箓
        else if ((Input.GetKeyDown(KeyCode.Backspace) || PickButton == 2) && display.activeSelf)
        {
            ResetCraft();
            // talis.SetTrigger("newTalis");
            PickButton = 0;
        }
    }
Ejemplo n.º 2
0
    IEnumerator Loading()
    {
        Debug.Log("LoadScene");
        yield return(new WaitForSeconds(1f));

        gameObject.SetActive(false);
        loadedLevel.Add(scene);
        print(scene + " is loaded");
        if (scene == "WaterLevelWell")
        {
            if (!isWaterLevelWellLoaded)
            {
                Destroy(GameObject.Find("Cover"));
                TipsDialog.PrintDialog("WaterLevelWellStart");
                isWaterLevelWellLoaded = true;
            }
        }
        else if (scene == "WaterLevelRoom" && !isWaterLevelRoomLoaded)
        {
            TipsDialog.PrintDialog("WaterLevelRoomStart");
            isWaterLevelRoomLoaded = true;
        }
        else if (scene == "WaterLevelGround" && !isWaterLevelGroundLoaded)
        {
            TipsDialog.PrintDialog("WaterLevelGroundStart");
            isWaterLevelGroundLoaded = true;
        }
    }
Ejemplo n.º 3
0
 void OnTriggerEnter(Collider collision)
 {
     // print("collide: " + collision.gameObject);
     if (collision.gameObject.name.CompareTo("RoomEntrance") == 0)
     {
         TipsDialog.PrintDialog("Leave Water Level Room");
     }
 }
Ejemplo n.º 4
0
    public static void SetTipsDialog(string text, string okText, string cancelText, Action okAction = null, Action cancelAction = null)
    {
        TipsDialog tipDialog = MainPanelMgr.Instance.ShowDialog("TipsDialog") as TipsDialog;

        if (null == tipDialog)
        {
            return;
        }

        tipDialog.DoSet(text, okText, cancelText, okAction, cancelAction);
    }
Ejemplo n.º 5
0
    public static void SetSimpleTipsDialog(string text, string buttonText, Action clickAction = null)
    {
        TipsDialog tipDialog = MainPanelMgr.Instance.ShowDialog("TipsDialog") as TipsDialog;

        if (null == tipDialog)
        {
            return;
        }

        tipDialog.DoSet(text, buttonText, clickAction);
    }
Ejemplo n.º 6
0
    public void OpenTalisman()
    {
        if (dispManager.brightTalisman)
        {
            // GameObject.Find("DarkBackground").GetComponent<LeaveIconBright>().DarkBackpack();
            dispManager.brightTalisman = false;
        }

        if (!display.activeSelf && !dialogShown && DontDestroyVariables.canOpenTalisman)
        {
            if (SceneManager.GetActiveScene().name != "SampleScene") //8块板子划划划,不知道有没有用
            // GameObject.Find("playerParticleEffect").GetComponent<castEffect>().castAni();
            {
                if (firstAccess)
                {
                    firstAccess = false;
                    display.transform.SetSiblingIndex(1);//设置图层顺序,以后应该需要改
                    TipsDialog.PrintDialog("Talisman 2");
                }
                else
                {
                    // Close any text box that is open
                    TipsDialog.HideTextBox();
                }
            }
            recipeBook = spelltreeManager.GetSpellBook();
            display.SetActive(true);
            // dispManager.ToggleIcons(false, "talisman");
            // dispManager.ToggleTalis(true);

            DisplaySpellList();
            curTime = timer;
            // UISoundScript.OpenTalisman();

            TenSecTimer = true;
            timeLeft    = countdownTime;
        }
        else if (!dialogShown && DontDestroyVariables.canOpenTalisman)
        {
            if (CloseDisplay())
            {
                // UISoundScript.OpenTalisman();
            }
        }
    }
Ejemplo n.º 7
0
    //Interaction changes happens here:

    /*
     *  tool: name of holding/spelling obj
     *  target: name of targeting obj
     *  toolObj: reference of the tool obj
     *  hitPoint: place on the screen where toolObj is dropped off
     *  targetObj: reference of target in OB
     *  isInEquipmentState: is targetObj currently equiped
     */
    public static void puzzleEffect(string tool, string target, Vector3 hitPoint, GameObject toolObj, GameObject targetObj, bool isInEquipmentState)
    {
        if (tool.CompareTo("重塑符") == 0 && target.CompareTo("Crutch") == 0)
        {
            targetObj.transform.GetChild(1).gameObject.SetActive(false);
            targetObj.transform.GetChild(0).gameObject.SetActive(true);
            replaceSprite(targetObj, targetObj.transform.GetChild(1).gameObject, isInEquipmentState, target);
            go.ob.GetComponent <ObManagement>().UpdateState(2);
            TipsDialog.PrintDialog("FirstCrutchFixed");
        }
        else if (tool.CompareTo("重塑符") == 0 && target.CompareTo("PickBurntCoal") == 0)
        {
            targetObj.transform.GetChild(1).gameObject.SetActive(true);
            targetObj.transform.GetChild(0).gameObject.SetActive(false);
            replaceSprite(targetObj, targetObj.transform.GetChild(1).gameObject, isInEquipmentState, "PickBurntCoal");
            go.ob.GetComponent <ObManagement>().UpdateState(2);
            // TipsDialog.PrintDialog("CoalFixed");
        }
        else if (tool.CompareTo("阳火符") == 0 && target.CompareTo("OilLight") == 0)
        {
            print("puzzle effect is inEquipmentState: " + isInEquipmentState);
            targetObj.transform.GetChild(1).gameObject.SetActive(false);
            targetObj.transform.GetChild(0).gameObject.SetActive(true);
            replaceSprite(targetObj, targetObj.transform.GetChild(1).gameObject, isInEquipmentState, target);
            print("12323");
            go.ob.GetComponent <ObManagement>().UpdateState(2);

            if (go.equipmentState.GetComponent <EquipmentState>().itemEquiped.ContainsKey("OilLight") &&
                go.equipmentState.GetComponent <EquipmentState>().itemEquiped["OilLight"] &&
                SceneManager.GetActiveScene().name == "WaterLevelWell")
            {
                TipsDialog.PrintDialog("FirstLightWell");
            }
        }
        else if (tool.CompareTo("现元符") == 0 && target.CompareTo("WCPlaceholder") == 0)
        {
            targetObj.GetComponent <SpriteRenderer>().enabled = false;
            targetObj.transform.GetChild(0).gameObject.SetActive(true);
            // targetObj.transform.GetChild(0).GetChild(0).gameObject.SetActive(true);
            TipsDialog.PrintDialog("EvilPrimeGod");
        }
    }
Ejemplo n.º 8
0
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        if (scene.name.CompareTo("Tutorial (With UI)") != 0)
        {
            ObStateSave();
            Destroy(ob);
            blackSceneDisp.SetActive(false);
        }
        if (scene.name.CompareTo("WaterLevelWell") == 0)
        {
            child = GameObject.Find("WCPlaceholder");
            if (levelLoader.isWaterLevelWellLoaded)
            {
                Destroy(child);
                //find if crutch is equipped
                if (equipmentState.GetComponent <EquipmentState>().itemEquiped.ContainsKey("OilLight") &&
                    equipmentState.GetComponent <EquipmentState>().itemEquiped["OilLight"] &&
                    equipmentState.GetComponent <EquipmentState>().equipedItemOb.correspondingOB.GetComponent <ObDisplay>().currentState == 2)
                {
                    TipsDialog.PrintDialog("FirstLightWell");
                }
            }
        }
        ob = GameObject.Find("OB");
        if (scene.name.CompareTo("Tutorial (With UI)") != 0)
        {
            ObStateRestore(scene);
        }
        ob.transform.SetParent(mainUI.transform);
        ob.transform.SetSiblingIndex(0);

        if (clickManagement.zoomInAllowedSceneWithRange.ContainsKey(scene.name))
        {
            characterCamera = GameObject.FindWithTag("MainCamera");
            clickManagement.zoomInAllowed    = true;
            clickManagement.currentZoomRange = clickManagement.zoomInAllowedSceneWithRange[scene.name];
        }
        else
        {
            clickManagement.zoomInAllowed = false;
        }
    }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        float cameraY = this.transform.localPosition.y;
        float cameraZ = this.transform.localPosition.z;

        // camera initial movement
        if (init)
        {
            if (cameraZ >= -40f)
            {
                init = false;                   // stops the loop when camera is in the correct position.
            }
            Vector3 offset = new Vector3(0f, -0.1f, 0.05f);
            this.transform.position += offset;
        }
        else if (!isPrinted)
        {
            TipsDialog.PrintDialog("Self Introduction");
            TipsDialog.introAppear = true;
            isPrinted = true;
        }
    }
Ejemplo n.º 10
0
    // 捡起物品,或者点击物品;在场景里点东西,代码都应放置于此
    public void ClickOnGround()
    {
        if (descShow)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;
            if (Physics.Raycast(ray, out hitInfo, (distanceToClick + cameraDistance), layerMask) && canAct)
            {
                GameObject clickObject = hitInfo.collider.gameObject;
                print("click:" + clickObject);
                if (clickObject.tag == "Pickable")
                {
                    if (clickObject.name.CompareTo("Cold Fire Seed") == 0)
                    {
                        // ItemEffects.s.UnlockElement(TalisDrag.Elements.FIRE);
                        Destroy(clickObject);
                        DontDestroyVariables.fireLevel = 0;
                    }
                    else if (go.backpack.GetComponent <Backpack>().CanAddItem())
                    {
                        go.ob.GetComponent <ObManagement>().TransferToBackpack(clickObject);
                        print("click transfer ob: " + go.ob.GetComponent <ObManagement>().transferToBackpackItemOB + ", " + go.ob.GetComponent <ObManagement>().transferToBackpackItemOB.transform.parent);
                        Sprite item = clickObject.GetComponent <SpriteRenderer>().sprite;
                        go.mainUI.GetComponent <FlyingOnUI>().FlyTowardsIcon(item, false, clickObject.name);

                        if (clickObject.name.CompareTo("Crutch") == 0 && clickObject.GetComponent <ObItem>().correspondingOB.GetComponent <ObDisplay>().currentState == 1)
                        {
                            TipsDialog.PrintDialog("FirstCrutchBroken");
                        }

                        // GameObject.Find("pickupEffect").GetComponent<pickupEffect>().castAni(clickObject.transform.position);
                        Destroy(clickObject);
                    }
                } //从这里开始点击GameObject触发对话)
                else if (clickObject.name.CompareTo("WCPlaceholder") == 0)
                {
                    TipsDialog.PrintDialog("Child");
                }
                // else if (clickObject.name.CompareTo("WaterLevelRope") == 0) {
                //     TipsDialog.PrintDialog("Rope");
                // }
                else if (clickObject.name.CompareTo("WaterLevelwellbricks01") == 0)
                {
                    TipsDialog.PrintDialog("bricks01");
                }
                else if (clickObject.name.CompareTo("WaterLevelwellbricks02") == 0)
                {
                    TipsDialog.PrintDialog("bricks02");
                }
                else if (clickObject.name.CompareTo("WaterLevelwellbricks03") == 0)
                {
                    TipsDialog.PrintDialog("bricks03");
                }
                else if (clickObject.name.CompareTo("WaterLevelwellbricks04") == 0)
                {
                    TipsDialog.PrintDialog("bricks04");
                }
                else if (clickObject.name.CompareTo("WaterLevelwellbricks05") == 0)
                {
                    TipsDialog.PrintDialog("bricks05");
                }
                else if (clickObject.name.CompareTo("WaterLevelwellbricks06") == 0)
                {
                    TipsDialog.PrintDialog("bricks06");
                }
                else if (clickObject.name.CompareTo("UndergroundEstuary") == 0)
                {
                    TipsDialog.PrintDialog("Estuary");
                }
                else if (clickObject.name.CompareTo("ShaftLiningWithPerspective") == 0)
                {
                    TipsDialog.PrintDialog("Matrix");
                }
                //else if (clickObject.name.CompareTo("WellCollider") == 0) {
                //TipsDialog.PrintDialog("GroundWell");
                //}
                else if (clickObject.name.CompareTo("HumanlikeGate") == 0)
                {
                    TipsDialog.PrintDialog("HumanGate");
                }
                else if (clickObject.name.CompareTo("BrushWoodIllusion") == 0)
                {
                    TipsDialog.PrintDialog("Illusion");
                }
                else if (clickObject.name.CompareTo("WindowCollider") == 0)
                {
                    TipsDialog.PrintDialog("WindowView");
                }
                else if (clickObject.name.CompareTo("WGPlaceholder") == 0)
                {
                    TipsDialog.PrintDialog("Grandmom");
                }
                else if (clickObject.name.CompareTo("WaterLevelRope") == 0)
                {
                    if (go.equipmentState.GetComponent <EquipmentState>().isLightWeighted)
                    {
                        go.levelLoader.LoadLevel("WaterLevelGround");
                    }
                    else
                    {
                        TipsDialog.PrintDialog("Rope");
                    }
                }
                else if (clickObject.name.CompareTo("WellCollider") == 0)
                {
                    if (go.equipmentState.GetComponent <EquipmentState>().isLightWeighted)
                    {
                        go.levelLoader.LoadLevel("WaterLevelWell");
                    }
                }
                else if (clickObject.name.CompareTo("RoomEntrance") == 0)
                {
                    TipsDialog.PrintDialog("Leave Water Level Room");
                }
                else if (clickObject.name.CompareTo("PickableTailsman") == 0)
                {
                    isTalismanPicked = true;
                    dispManager.ShowTalismanIcon();
                    EnableTalismanIfAvailable();
                    Destroy(clickObject);
                }
                else if (clickObject.name.CompareTo("PickableBrush") == 0)
                {
                    isBrushPicked = true;
                    dispManager.ShowTalismanIcon();
                    EnableTalismanIfAvailable();
                    Destroy(clickObject);
                }
                else if (clickObject.name.CompareTo("PickableGourd") == 0)
                {
                    isGourdPicked = true;
                    dispManager.ShowBackpackIcon();
                    Destroy(clickObject);
                }
            }
        }
        descShow = false;
    }
Ejemplo n.º 11
0
 public void Equip(GameObject equipmentItem)
 {
     isLightWeighted       = false;
     savedEquipmentTexture = equipmentItem.GetComponentInChildren <Image>().sprite;
     print(backpackDisp);
     equipLocatePage = backpackDisp.currPageNumber;
     transform.GetChild(0).gameObject.SetActive(true);
     if (currentImage != null)
     {
         PutEquipmentTexture();
     }
     currentEquipmentName = equipmentItem.name;
     isEquiped            = true;
     //继承背包装备的obitem.cs
     if (equipmentItem.GetComponent <ObItem>() != null)
     {
         equipedItemOb = gameObject.AddComponent <ObItem>();
         equipedItemOb.correspondingOB = equipmentItem.GetComponent <ObItem>().correspondingOB;
     }
     if (currentEquipmentName == "Crutch")
     {
         int state = equipmentItem.GetComponent <ObItem>().correspondingOB.GetComponent <ObDisplay>().currentState;
         //while user equipped the crutch, set the bool to true
         itemEquiped["Crutch"] = true;
         if (firstTimeEquiped.ContainsKey("Crutch") && !firstTimeEquiped["Crutch"])
         {
             if (state == 1)
             {
                 TipsDialog.PrintDialog("FirstCrutchBroken");
             }
             else
             {
                 TipsDialog.PrintDialog("FirstCrutchFixed");
             }
             firstTimeEquiped["Crutch"] = true;
         }
     }
     else if (currentEquipmentName == "轻身符")
     {
         isLightWeighted = true;
     }
     else if (currentEquipmentName == "OilLight")
     {
         //while user equipped the OilLight, set the bool to true
         itemEquiped["OilLight"] = true;
         if (firstTimeEquiped.ContainsKey("OilLight") && !firstTimeEquiped["OilLight"])
         {
             int state = equipmentItem.GetComponent <ObItem>().correspondingOB.GetComponent <ObDisplay>().currentState;
             firstTimeEquiped["OilLight"] = true;
             if (SceneManager.GetActiveScene().name == "WaterLevelWell")
             {
                 TipsDialog.PrintDialog("FirstLightWell");
             }
             else
             {
                 TipsDialog.PrintDialog("FirstLight");
             }
         }
     }
     print("just equip " + equipedItemOb);
 }