Ejemplo n.º 1
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="player">The player.</param>
        /// <param name="npc">The NPC.</param>
        /// <param name="constants">The constant assumptions.</param>
        /// <param name="friendship">The current friendship data.</param>
        public FriendshipModel(SFarmer player, NPC npc, Friendship friendship, ConstantData constants)
        {
            // flags
            this.CanDate       = npc.datable.Value;
            this.IsDating      = friendship.IsDating();
            this.CanHousemate  = npc.Name == "Krobus";
            this.IsSpouse      = friendship.IsMarried() && !this.CanHousemate;
            this.IsHousemate   = friendship.IsMarried() && this.CanHousemate;
            this.IsDivorced    = friendship.IsDivorced();
            this.Status        = friendship.Status;
            this.TalkedToday   = friendship.TalkedToToday;
            this.GiftsToday    = friendship.GiftsToday;
            this.GiftsThisWeek = friendship.GiftsThisWeek;

            // points
            this.MaxPoints      = this.IsSpouse || this.IsHousemate ? constants.SpouseMaxFriendship : NPC.maxFriendshipPoints;
            this.Points         = friendship.Points;
            this.PointsPerLevel = NPC.friendshipPointsPerHeartLevel;
            this.FilledHearts   = this.Points / NPC.friendshipPointsPerHeartLevel;
            this.LockedHearts   = this.CanDate && !this.IsDating ? constants.DatingHearts : 0;
            this.EmptyHearts    = this.MaxPoints / NPC.friendshipPointsPerHeartLevel - this.FilledHearts - this.LockedHearts;
            if (this.IsSpouse || this.IsHousemate)
            {
                this.StardropPoints = constants.SpouseFriendshipForStardrop;
                this.HasStardrop    = !player.mailReceived.Contains(Constants.Constant.MailLetters.ReceivedSpouseStardrop);
            }
        }
Ejemplo n.º 2
0
    /// <summary>
    /// 检测是否在跟随范围内
    /// </summary>
    /// <param name="dis"></param>
    /// <returns></returns>
    public bool CheckNavDistance(float dis)
    {
        Debug.Log("检测是否跟随攻击");
        float distance = Vector3.Distance(ConstantData.GetInstance().Player.transform.position, ConstantData.GetInstance().currBoss.transform.position);

        return(Mathf.Abs(distance) < dis);
    }
Ejemplo n.º 3
0
 public VariableEvaluator(GameBase gamebase, ConstantData constant)
 {
     this.gamebase = gamebase;
     this.constant = constant;
     varData = new VariableData(gamebase, constant);
     GlobalStatic.VariableData = varData;
 }
Ejemplo n.º 4
0
        // Creates Constant wrapper
        private Constant CreateItem(
            // Fields of Constant table
            Guid ConstantId,
            int BitWidth,
            int Value,
            PinSide PinSide,
            string Note
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = ConstantId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            ConstantData dataConstant = new ConstantData()
            {
                ConstantId = ConstantId,
                BitWidth   = BitWidth,
                Value      = Value,
                PinSide    = PinSide,
                Note       = Note,
            };

            return(this.Create(this.Table.Insert(ref dataConstant), rowIdCircuit));
        }
Ejemplo n.º 5
0
 public void OnPlayRollDiceFinish()
 {
     RollDiceAni.Pause();
     RollSrpite.TrySetComponentValue(string.Format(ConstantData.KeyRollDicePointFormat, _curData.ShowPoint));
     RollSrpite.MakePixelPerfect();
     if (!_curData.QuickModel)
     {
         ConstantData.PlaySoundBySex(_curData.Sex, string.Format(PointSoundFormat, _curData.ShowPoint));
         CloudAni.Play();
         if (_curData.OneMoreTime)
         {
             if (gameObject.activeInHierarchy)
             {
                 if (_waitForOneMoreTimeCor != null)
                 {
                     StopCoroutine(_waitForOneMoreTimeCor);
                 }
                 _waitForOneMoreTimeCor = StartCoroutine(WaitShowOneMoreTime());
             }
         }
     }
     else
     {
         CloudSprite.spriteName = ConstantData.KeyDefaultSpriteName;
     }
 }
 public EtcsBrakingData()
 {
     Input = new InputData();
     Middle = new MiddleData();
     Output = new OutputData();
     Params = new ConstantData();
 }
Ejemplo n.º 7
0
        public ConstView(FileSystemEntry entry)
        {
            _entry = entry;

            Columns.Add(new GridColumn
            {
                DataCell = new TextBoxCell {
                    Binding = Binding.Property((ConstFileEntry r) => r.Index)
                },
                HeaderText = "Index"
            });

            Columns.Add(new GridColumn
            {
                DataCell = new TextBoxCell {
                    Binding = Binding.Property((ConstFileEntry r) => r.Value)
                },
                HeaderText = "Value"
            });


            var constFile = ConstantData.FromFileSystemEntry(_entry);

            DataStore = constFile.Entries
                        .Select((e, i) => new ConstFileEntry(e, i))
                        .ToList();
        }
Ejemplo n.º 8
0
    private void InitFacs()
    {
        LambdaFuncInt[] lfi = ConstantData.GetInstance().GetOnClickEvents();
        string[][]      st  = ConstantData.GetInstance().GetFacilitiesInfo();
        Resources       tempPrice;
        Resources       tmpProduct;

        for (int i = 0; i < st.Length; i++)
        {
            //make price
            tempPrice  = new Resources(StringIntToIntArr(st[i][2]));
            tmpProduct = new Resources(StringIntToIntArr(st[i][5]));

            facs.Add(new Facility(Int32.Parse(st[i][0]), st[i][1],
                                  st[i][1] + "\n" + this.rm.GetFormattedResourceString(tmpProduct, true),
                                  "Activate " + st[i][1] + "\n" + this.rm.GetFormattedResourceString(tempPrice),
                                  tempPrice,
                                  tmpProduct,
                                  new Resources(StringIntToIntArr(st[i][3])),
                                  new Army(StringIntToIntArr(st[i][4])),
                                  new Army(StringIntToIntArr(st[i][6])),
                                  lfi[i]
                                  ));
        }
        facs[0].Activate();
    }
Ejemplo n.º 9
0
 public EtcsBrakingData()
 {
     Input  = new InputData();
     Middle = new MiddleData();
     Output = new OutputData();
     Params = new ConstantData();
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 复活玩家
 /// </summary>
 public void ResetPlayer()
 {
     ConstantData.GetInstance().Player.gameObject.SetActive(true);
     //ConstantData.GetInstance().Player.transform.position = new Vector3(ConstantData.GetInstance().Player.transform.position.x,0.5f, ConstantData.GetInstance().Player.transform.position.z);
     ConstantData.GetInstance().Player.GetComponent <PlayerBase>().InitPlayer();
     ConstantData.GetInstance().Player.GetComponent <PlayerAnimCon>().Stand();
 }
Ejemplo n.º 11
0
 public void CheckAttack()
 {
     Collider[] colliders = Physics.OverlapSphere(transform.position, 2.5f, LayerMask.GetMask("Boss"));
     Debug.Log("Len" + colliders.Length);
     if (colliders.Length > 0)
     {
         for (int i = 0; i < colliders.Length; i++)
         {
             GameObject bosstemp = colliders[i].gameObject;
             //ConstantData.GetInstance().currBoss = bosstemp;
             //触发主角攻击
             // AttackManager.GetInstance().PlayerAttack(transform.gameObject, bosstemp);
             //触发 boss 自动攻击
             bosstemp.GetComponent <BossBase>().SetBossAttackState(true);
             //AttackManager.GetInstance().BossAutoAttack(bosstemp, transform.gameObject,2.0f);
         }
         GameObject currboss = colliders[0].gameObject;
         ConstantData.GetInstance().currBoss = currboss;
         //触发主角攻击
         AttackManager.GetInstance().PlayerAttack(transform.gameObject, currboss);
         //触发 boss 自动攻击
         currboss.GetComponent <BossBase>().SetBossAttackState(true);
         //AttackManager.GetInstance().BossAutoAttack(bosstemp, transform.gameObject,2.0f);
         Debug.Log("Attack the boss");
     }
 }
Ejemplo n.º 12
0
 public ConstantService(int capacity, ConstantData d)
 {
     _data          = d;
     _dragCoeffData = new float[capacity];
     _dragCoeffs    = new ComputeBuffer(capacity, Marshal.SizeOf(typeof(float)));
     CheckDragCoeffs();
 }
Ejemplo n.º 13
0
    /// <summary>
    /// boss 攻击
    /// </summary>
    /// <param name="boss"></param>
    /// <param name="player"></param>
    public void BossAttack(GameObject boss, GameObject player)
    {
        //boss 攻击状态 且 player 存活
        if (boss.GetComponent <BossBase>().GetBossAttackState() && player.GetComponent <PlayerBase>().GetPlayerState())
        {
            //boss.GetComponent<BossBase>().SetBossAttackState(true);
            boss.transform.LookAt(player.transform);
            boss.GetComponent <BossAnimCon>().Attack();
            float temp = player.GetComponent <PlayerBase>().GetPlayerBlood() - boss.GetComponent <BossBase>().GetBossAttack();
            if (temp > 0)
            {
                player.GetComponent <PlayerBase>().SetPlayerBlood(player.GetComponent <PlayerBase>().GetPlayerBlood() - boss.GetComponent <BossBase>().GetBossAttack());
                ConstantData.GetInstance().PlayerHUD.GetComponent <HUDText>().Add(-boss.GetComponent <BossBase>().GetBossAttack(), Color.red, 0.5f);
                Debug.Log(player.GetComponent <PlayerBase>().GetPlayerName() + " 血量" + player.GetComponent <PlayerBase>().GetPlayerBlood());
                Debug.Log("血量减少" + boss.GetComponent <BossBase>().GetBossAttack());
            }
            else
            {
                player.GetComponent <PlayerBase>().SetPlayerBlood(0);
                player.GetComponent <PlayerBase>().SetPlayerState(false);
                player.GetComponent <PlayerBase>().SetPlayerAttackState(false);
                player.GetComponent <PlayerBase>().SetPlayerAutoAttackState(false);
                boss.GetComponent <BossBase>().SetBossAttackState(false);
                StopAllCoroutines();
                boss.GetComponent <BossAnimCon>().Stand();
                player.GetComponent <PlayerAnimCon>().Dead();
                PublicFuncs.GetInstance().WaitTimeDoFun(0.5f, () =>
                {
                    player.SetActive(false);
                });
            }

            ConstantData.GetInstance().PlayerInfo.GetComponentInChildren <UISlider>().value = player.GetComponent <PlayerBase>().GetPlayerBlood() / 100f;
        }
    }
Ejemplo n.º 14
0
 void Update()
 {
     //boss 当前为攻击状态
     if (boss_attackstate)
     {
         timer -= Time.deltaTime;
         //检测寻路
         if (CheckNavDistance(3f))
         {
             bossnav.GetComponent <NavMeshAgent>().enabled = false;
             if (timer <= 0)
             {
                 timer = TIME;
                 AttackManager.GetInstance().BossAttack(transform.gameObject, ConstantData.GetInstance().Player);
             }
         }
         else if (CheckNavDistance(6f))
         {
             bossnav.GetComponent <NavMeshAgent>().enabled = true;
             bossnav.destination = ConstantData.GetInstance().Player.transform.position;
             transform.GetComponent <BossAnimCon>().Run();
         }
         //检测跟随攻击距离
         CheckAttackDistance(6f);
     }
 }
Ejemplo n.º 15
0
    public void ShowBossInfo(GameObject player, GameObject boss)
    {
        GameObject bossinfo = ConstantData.GetInstance().BossInfo;

        bossinfo.GetComponentInChildren <UISlider>().value = boss.GetComponent <BossBase>().GetBossBlood() / 100f;
        bossinfo.GetComponentInChildren <UILabel>().text   = boss.GetComponent <BossBase>().GetBossName();
    }
Ejemplo n.º 16
0
        /// <summary>
        /// Gets and adds if necessary, the constant name for a group, name and value.
        /// </summary>
        /// <param name="group">The group for the constant.</param>
        /// <param name="name">The name for the constant.</param>
        /// <param name="value">The value for the constant.</param>
        /// <param name="commentText">The comment for the constant.</param>
        /// <returns>The name of the constant.</returns>
        public string this[string group, string name, string value, string commentText]
        {
            get
            {
                // Check to see if group is created
                Dictionary <string, ConstantData> ldConsts;
                if (!mdConstants.TryGetValue(group, out ldConsts))
                {
                    // If not create and add it
                    ldConsts           = new Dictionary <string, ConstantData>();
                    mdConstants[group] = ldConsts;
                }

                // Check to see if constant is created
                ConstantData lcdConstant;
                if (!ldConsts.TryGetValue(value, out lcdConstant))
                {
                    // If not create and add it
                    lcdConstant     = new ConstantData(MakeConstantName(group, name), commentText);
                    ldConsts[value] = lcdConstant;
                }

                // Return constant name
                return(lcdConstant.Identifier);
            }
        }
Ejemplo n.º 17
0
 public ConstantService(int capacity, ConstantData d)
 {
     _data = d;
     _dragCoeffData = new float[capacity];
     _dragCoeffs = new ComputeBuffer (capacity, Marshal.SizeOf (typeof(float)));
     CheckDragCoeffs();
 }
Ejemplo n.º 18
0
        private GameObjectDefinition getChildDefinition()
        {
            int child = -1;

            if (varBitId != -1)
            {
                VarBit varBit   = VarBit.values[varBitId];
                int    configId = varBit.configId;
                int    lsb      = varBit.leastSignificantBit;
                int    msb      = varBit.mostSignificantBit;
                int    bit      = ConstantData.GetBitfieldMaxValue(msb - lsb);
                child = clientInstance.GetInterfaceSettings(configId) >> lsb & bit;
            }
            else if (configId != -1)
            {
                child = clientInstance.GetInterfaceSettings(configId);
            }

            if (child < 0 || child >= childrenIds.Length || childrenIds[child] == -1)
            {
                return(null);
            }
            else
            {
                return(GameObjectDefinition.getDefinition(childrenIds[child]));
            }
        }
Ejemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     ab = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/AssetsBundle/npcbundle");
 }
Ejemplo n.º 20
0
        /// <summary>
        /// 再来一次相关显示
        /// </summary>
        /// <returns></returns>
        IEnumerator  WaitShowOneMoreTime()
        {
            OneMoreTime.ResetToBeginning();
            yield return(_waiteForOneMoreTimeYield);

            OneMoreTime.PlayForward();
            ConstantData.PlaySoundBySex(_curData.Sex, ConstantData.KeyRollAgin);
        }
Ejemplo n.º 21
0
 public static ConstantData GetInstance()
 {
     if (instance == null)
     {
         instance = new ConstantData();
     }
     return(instance);
 }
Ejemplo n.º 22
0
        public void CanReadConstFiles()
        {
            InstalledFilesTestData.ReadFiles(".const", _output, entry =>
            {
                var constFile = ConstantData.FromFileSystemEntry(entry);

                Assert.NotNull(constFile);
            });
        }
Ejemplo n.º 23
0
 /// <summary>
 /// 奔跑动画
 /// </summary>
 public void Run()
 {
     IsAttackWQState(0);
     //animation.Stop();
     animation.clip = clips[0];
     animation.Play();
     animation.CrossFade("ZhanLi_TY", 2.5f);
     ConstantData.GetInstance().BossInfo.SetActive(false);
     ConstantData.GetInstance().BossHUD = null;
 }
Ejemplo n.º 24
0
 public SeedData(MusicContext dataContext, ILogger <SeedData> log,
                 IRepository repo, ConstantData constants)
 {
     context    = dataContext;
     logger     = log;
     repository = repo;
     Genres     = constants.Genres;
     Occasions  = constants.Occasions;
     Musicians  = constants.Musicians;
 }
Ejemplo n.º 25
0
    public void CheckBossActive()
    {
        //Debug.Log("检测boss 显示状态");
        int len = ConstantData.GetInstance().BossList.Count;

        for (int i = 0; i < len; i++)
        {
            CheckDistance(ConstantData.GetInstance().BossList[i]);
        }
    }
Ejemplo n.º 26
0
 public void CheckDistanceToStopAttack(float dis)
 {
     if (ConstantData.GetInstance().currBoss != null)
     {
         float distance = Vector3.Distance(ConstantData.GetInstance().Player.transform.position, ConstantData.GetInstance().currBoss.transform.position);
         if (Mathf.Abs(distance) > dis)
         {
             AttackManager.GetInstance().StopAttakc();
         }
     }
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 设置键盘移动
 /// </summary>
 public void ChangePlayerCon()
 {
     if (ConstantData.GetInstance().EasyTouchConToggle.GetComponent <UIToggle>().value)
     {
         ConstantData.GetInstance().Player.GetComponent <PlayerMove>().enabled = true;
     }
     else
     {
         ConstantData.GetInstance().Player.GetComponent <PlayerMove>().enabled = false;
     }
 }
Ejemplo n.º 28
0
    /// <summary>
    /// 加载并初始化player
    /// </summary>
    private void InitPlayer()
    {
        GameObject playerprefab = LoadBundle("Player");

        ConstantData.GetInstance().Player = Instantiate(playerprefab);

        GameObject playerhud = LoadBundle("PlayerHUD");

        ConstantData.GetInstance().PlayerHUD = Instantiate(playerhud);
        ConstantData.GetInstance().PlayerHUD.GetComponent <UIFollowTarget>().target = ConstantData.GetInstance().Player.transform.Find("player_ui_point").transform;
    }
Ejemplo n.º 29
0
 void setNewItem(object obj = null)
 {
     Item            = new Item();
     Item.CategoryId = ParentCategory.Id;
     Item.Unit       = ConstantData.GetEnumName(ConstantData.Units.Kg);
     if (obj != null)
     {
         var entryObj = (Entry)obj;
         entryObj.Focus();
     }
 }
Ejemplo n.º 30
0
 /// <summary>
 /// 设置Bloom特效
 /// </summary>
 public void ChangeBloomEffect()
 {
     if (ConstantData.GetInstance().BlommEffectToggle.GetComponent <UIToggle>().value)
     {
         ConstantData.GetInstance().BloomEffect.SetActive(true);
     }
     else
     {
         ConstantData.GetInstance().BloomEffect.SetActive(false);
     }
 }
Ejemplo n.º 31
0
    public void fireBall(float powerScalar, Vector3 fireDir, Vector3 hitPoint)
    {
        HOAudioManager.FireBall();
        GameManager.Rules.OnBallFired();
        m_slowTime = 0;

        Vector3 fireForce = fireDir * powerScalar * ConstantData.GetPoolDatas().MaxImpulse;

        m_rigidbody.AddForceAtPosition(fireForce, hitPoint, ForceMode.Impulse);
        m_state = State.ROLL;
        OpenDrag();
    }
Ejemplo n.º 32
0
    /// <summary>
    /// 主角npc自动攻击协程
    /// </summary>
    /// <returns></returns>
    private IEnumerator PlayerAutoAttack()
    {
        while (ConstantData.GetInstance().Player.GetComponent <PlayerBase>().GetPlayerAutoAttackState())
        {
            Debug.Log("Player 开始自动攻击");
            ConstantData.GetInstance().Player.GetComponent <PlayerAnimCon>().Attack();
            ConstantData.GetInstance().Player.GetComponent <PlayerAnimCon>().CheckAttack();
            yield return(new WaitForSeconds(2.0f));

            Debug.Log("Player 自动攻击");
        }
    }
Ejemplo n.º 33
0
        public static int[] CharacterVarLength(VariableCode code, ConstantData constant)
        {
            int[]        ret  = null;
            VariableCode type = code & (VariableCode.__ARRAY_1D__ | VariableCode.__ARRAY_2D__ |
                                        VariableCode.__ARRAY_3D__ | VariableCode.__INTEGER__ | VariableCode.__STRING__);
            int i = (int)(code & VariableCode.__LOWERCASE__);

            if (i >= 0xF0)
            {
                return(null);
            }
            Int64 length64 = 0;

            switch (type)
            {
            case VariableCode.__STRING__:
            case VariableCode.__INTEGER__:
                ret = new int[0];
                break;

            case VariableCode.__INTEGER__ | VariableCode.__ARRAY_1D__:
                ret    = new int[1];
                ret[0] = constant.CharacterIntArrayLength[i];
                break;

            case VariableCode.__STRING__ | VariableCode.__ARRAY_1D__:
                ret    = new int[1];
                ret[0] = constant.CharacterStrArrayLength[i];
                break;

            case VariableCode.__INTEGER__ | VariableCode.__ARRAY_2D__:
                ret      = new int[2];
                length64 = constant.CharacterIntArray2DLength[i];
                ret[0]   = (int)(length64 >> 32);
                ret[1]   = (int)(length64 & 0x7FFFFFFF);
                break;

            case VariableCode.__STRING__ | VariableCode.__ARRAY_2D__:
                ret      = new int[2];
                length64 = constant.CharacterStrArray2DLength[i];
                ret[0]   = (int)(length64 >> 32);
                ret[1]   = (int)(length64 & 0x7FFFFFFF);
                break;

            case VariableCode.__INTEGER__ | VariableCode.__ARRAY_3D__:
                throw new NotImplCodeEE();

            case VariableCode.__STRING__ | VariableCode.__ARRAY_3D__:
                throw new NotImplCodeEE();
            }
            return(ret);
        }
Ejemplo n.º 34
0
 public ConstantService(ConstantData d)
 {
     _data = d;
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Gets and adds if necessary, the constant name for a group, name and value.
        /// </summary>
        /// <param name="group">The group for the constant.</param>
        /// <param name="name">The name for the constant.</param>
        /// <param name="value">The value for the constant.</param>
        /// <param name="commentText">The comment for the constant.</param>
        /// <returns>The name of the constant.</returns>
        public string this[string group, string name, string value, string commentText]
        {
            get
            {
                // Check to see if group is created
                Dictionary<string, ConstantData> ldConsts;
                if (!mdConstants.TryGetValue(group, out ldConsts))
                {
                    // If not create and add it
                    ldConsts = new Dictionary<string, ConstantData>();
                    mdConstants[group] = ldConsts;
                }

                // Check to see if constant is created
                ConstantData lcdConstant;
                if (!ldConsts.TryGetValue(value, out lcdConstant))
                {
                    // If not create and add it
                    lcdConstant = new ConstantData(MakeConstantName(group, name), commentText);
                    ldConsts[value] = lcdConstant;
                }

                // Return constant name
                return lcdConstant.Identifier;
            }
        }